@websy/websy-designs 1.3.2 → 1.3.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 +2 -1
- package/dist/websy-designs-es6.debug.js +71 -10
- package/dist/websy-designs-es6.js +211 -137
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +72 -11
- package/dist/websy-designs.js +215 -141
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -3346,6 +3346,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3346
3346
|
this.rows = [];
|
|
3347
3347
|
this.apiService = new WebsyDesigns.APIService('/api');
|
|
3348
3348
|
this.templateService = new WebsyDesigns.APIService('');
|
|
3349
|
+
this.activeTemplate = '';
|
|
3349
3350
|
|
|
3350
3351
|
if (!elementId) {
|
|
3351
3352
|
console.log('No element Id provided for Websy Search List');
|
|
@@ -3374,6 +3375,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3374
3375
|
value: function appendData(d) {
|
|
3375
3376
|
var startIndex = this.rows.length;
|
|
3376
3377
|
this.rows = this.rows.concat(d);
|
|
3378
|
+
this.activeTemplate = this.options.template;
|
|
3377
3379
|
var html = this.buildHTML(d, startIndex);
|
|
3378
3380
|
var el = document.getElementById(this.elementId);
|
|
3379
3381
|
el.innerHTML += html.replace(/\n/g, '');
|
|
@@ -3384,12 +3386,14 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3384
3386
|
var _this21 = this;
|
|
3385
3387
|
|
|
3386
3388
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3389
|
+
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
3390
|
+
var locator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
3387
3391
|
var html = "";
|
|
3388
3392
|
|
|
3389
3393
|
if (this.options.template) {
|
|
3390
3394
|
if (d.length > 0) {
|
|
3391
3395
|
d.forEach(function (row, ix) {
|
|
3392
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(_this21.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3396
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this21.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3393
3397
|
|
|
3394
3398
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3395
3399
|
|
|
@@ -3473,19 +3477,47 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3473
3477
|
}
|
|
3474
3478
|
});
|
|
3475
3479
|
|
|
3480
|
+
var forMatches = _toConsumableArray(template.matchAll(/<\s*for[^>]*>([\s\S]*?)<\s*\/\s*for>/g));
|
|
3481
|
+
|
|
3482
|
+
forMatches.forEach(function (m) {
|
|
3483
|
+
var itemsMatch = m[0].match(/(items=["|']\w.+)["|']/g);
|
|
3484
|
+
var forMarkup = m[0].match(/<\s*for[^>]*>/);
|
|
3485
|
+
var withoutFor = m[0].replace(forMarkup, '').replace('</for>', '').replace(/<\s*for[^>]*>/g, '');
|
|
3486
|
+
|
|
3487
|
+
if (itemsMatch && itemsMatch[0]) {
|
|
3488
|
+
var c = itemsMatch[0].trim().replace('items=', '');
|
|
3489
|
+
|
|
3490
|
+
if (c.split('')[0] === '"') {
|
|
3491
|
+
c = c.replace(/"/g, '');
|
|
3492
|
+
} else if (c.split('')[0] === '\'') {
|
|
3493
|
+
c = c.replace(/'/g, '');
|
|
3494
|
+
}
|
|
3495
|
+
|
|
3496
|
+
var items = row;
|
|
3497
|
+
var parts = c.split('.');
|
|
3498
|
+
parts.forEach(function (p) {
|
|
3499
|
+
items = items[p];
|
|
3500
|
+
});
|
|
3501
|
+
template = template.replace(m[0], _this21.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
3502
|
+
}
|
|
3503
|
+
});
|
|
3504
|
+
|
|
3476
3505
|
var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
|
|
3477
3506
|
|
|
3478
3507
|
tagMatches.forEach(function (m) {
|
|
3479
3508
|
if (m[0] && m.index > -1) {
|
|
3480
|
-
template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix));
|
|
3509
|
+
template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
|
|
3481
3510
|
}
|
|
3482
3511
|
});
|
|
3483
3512
|
|
|
3484
|
-
|
|
3513
|
+
var flatRow = _this21.flattenObject(row);
|
|
3514
|
+
|
|
3515
|
+
for (var key in flatRow) {
|
|
3485
3516
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
3486
|
-
template = template.replace(rg,
|
|
3517
|
+
template = template.replace(rg, flatRow[key] || '');
|
|
3487
3518
|
}
|
|
3488
3519
|
|
|
3520
|
+
template = template.replace(/\{(.*?)\}/g, '');
|
|
3489
3521
|
html += template;
|
|
3490
3522
|
});
|
|
3491
3523
|
} else if (this.options.noRowsHTML) {
|
|
@@ -3506,11 +3538,36 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3506
3538
|
|
|
3507
3539
|
return null;
|
|
3508
3540
|
}
|
|
3541
|
+
}, {
|
|
3542
|
+
key: "flattenObject",
|
|
3543
|
+
value: function flattenObject(obj) {
|
|
3544
|
+
var toReturn = {};
|
|
3545
|
+
|
|
3546
|
+
for (var i in obj) {
|
|
3547
|
+
if (!obj.hasOwnProperty(i)) {
|
|
3548
|
+
continue;
|
|
3549
|
+
}
|
|
3550
|
+
|
|
3551
|
+
if (_typeof(obj[i]) === 'object') {
|
|
3552
|
+
var flatObject = this.flattenObject(obj[i]);
|
|
3553
|
+
|
|
3554
|
+
for (var x in flatObject) {
|
|
3555
|
+
if (!flatObject.hasOwnProperty(x)) {
|
|
3556
|
+
continue;
|
|
3557
|
+
}
|
|
3558
|
+
|
|
3559
|
+
toReturn[i + '.' + x] = flatObject[x];
|
|
3560
|
+
}
|
|
3561
|
+
} else {
|
|
3562
|
+
toReturn[i] = obj[i];
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3565
|
+
|
|
3566
|
+
return JSON.parse(JSON.stringify(toReturn));
|
|
3567
|
+
}
|
|
3509
3568
|
}, {
|
|
3510
3569
|
key: "handleClick",
|
|
3511
3570
|
value: function handleClick(event) {
|
|
3512
|
-
var _this22 = this;
|
|
3513
|
-
|
|
3514
3571
|
if (event.target.classList.contains('clickable')) {
|
|
3515
3572
|
var l = event.target.getAttribute('data-event');
|
|
3516
3573
|
|
|
@@ -3518,6 +3575,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3518
3575
|
l = l.split('(');
|
|
3519
3576
|
var params = [];
|
|
3520
3577
|
var id = event.target.getAttribute('data-id');
|
|
3578
|
+
var locator = event.target.getAttribute('data-locator');
|
|
3521
3579
|
|
|
3522
3580
|
if (l[1]) {
|
|
3523
3581
|
l[1] = l[1].replace(')', '');
|
|
@@ -3525,10 +3583,27 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3525
3583
|
}
|
|
3526
3584
|
|
|
3527
3585
|
l = l[0];
|
|
3586
|
+
var data = this.rows;
|
|
3587
|
+
|
|
3588
|
+
if (locator !== '') {
|
|
3589
|
+
var locatorItems = locator.split(';');
|
|
3590
|
+
locatorItems.forEach(function (loc) {
|
|
3591
|
+
var locatorParts = loc.split(':');
|
|
3592
|
+
|
|
3593
|
+
if (data[locatorParts[0]]) {
|
|
3594
|
+
data = data[locatorParts[0]];
|
|
3595
|
+
var parts = locatorParts[1].split('.');
|
|
3596
|
+
parts.forEach(function (p) {
|
|
3597
|
+
data = data[p];
|
|
3598
|
+
});
|
|
3599
|
+
}
|
|
3600
|
+
});
|
|
3601
|
+
}
|
|
3602
|
+
|
|
3528
3603
|
params = params.map(function (p) {
|
|
3529
3604
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
3530
|
-
if (
|
|
3531
|
-
p =
|
|
3605
|
+
if (data[+id]) {
|
|
3606
|
+
p = data[+id][p];
|
|
3532
3607
|
}
|
|
3533
3608
|
} else if (typeof p === 'string') {
|
|
3534
3609
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -3542,7 +3617,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3542
3617
|
|
|
3543
3618
|
event.stopPropagation();
|
|
3544
3619
|
|
|
3545
|
-
(_this$options$listene = this.options.listeners.click[l]).call.apply(_this$options$listene, [this, event,
|
|
3620
|
+
(_this$options$listene = this.options.listeners.click[l]).call.apply(_this$options$listene, [this, event, data[+id]].concat(_toConsumableArray(params)));
|
|
3546
3621
|
}
|
|
3547
3622
|
}
|
|
3548
3623
|
}
|
|
@@ -3550,13 +3625,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3550
3625
|
}, {
|
|
3551
3626
|
key: "render",
|
|
3552
3627
|
value: function render() {
|
|
3553
|
-
var
|
|
3628
|
+
var _this22 = this;
|
|
3554
3629
|
|
|
3555
3630
|
if (this.options.entity) {
|
|
3556
3631
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3557
|
-
|
|
3632
|
+
_this22.rows = results.rows;
|
|
3558
3633
|
|
|
3559
|
-
|
|
3634
|
+
_this22.resize();
|
|
3560
3635
|
});
|
|
3561
3636
|
} else {
|
|
3562
3637
|
this.resize();
|
|
@@ -3627,22 +3702,21 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3627
3702
|
|
|
3628
3703
|
if (this.options.onHide) {
|
|
3629
3704
|
this.on('hide', this.options.onHide);
|
|
3630
|
-
}
|
|
3705
|
+
} // this.init()
|
|
3631
3706
|
|
|
3632
|
-
this.init();
|
|
3633
3707
|
}
|
|
3634
3708
|
|
|
3635
3709
|
_createClass(WebsyRouter, [{
|
|
3636
3710
|
key: "addGroup",
|
|
3637
3711
|
value: function addGroup(group) {
|
|
3638
|
-
var
|
|
3712
|
+
var _this23 = this;
|
|
3639
3713
|
|
|
3640
3714
|
if (!this.groups[group]) {
|
|
3641
3715
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3642
3716
|
|
|
3643
3717
|
if (els) {
|
|
3644
3718
|
this.getClosestParent(els[0], function (parent) {
|
|
3645
|
-
|
|
3719
|
+
_this23.groups[group] = {
|
|
3646
3720
|
activeView: '',
|
|
3647
3721
|
views: [],
|
|
3648
3722
|
parent: parent.getAttribute('data-view')
|
|
@@ -3967,12 +4041,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3967
4041
|
}, {
|
|
3968
4042
|
key: "showComponents",
|
|
3969
4043
|
value: function showComponents(view) {
|
|
3970
|
-
var
|
|
4044
|
+
var _this24 = this;
|
|
3971
4045
|
|
|
3972
4046
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
3973
4047
|
this.options.views[view].components.forEach(function (c) {
|
|
3974
4048
|
if (typeof c.instance === 'undefined') {
|
|
3975
|
-
|
|
4049
|
+
_this24.prepComponent(c.elementId, c.options);
|
|
3976
4050
|
|
|
3977
4051
|
c.instance = new c.Component(c.elementId, c.options);
|
|
3978
4052
|
} else if (c.instance.render) {
|
|
@@ -4341,7 +4415,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4341
4415
|
|
|
4342
4416
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4343
4417
|
function WebsyTemplate(elementId, options) {
|
|
4344
|
-
var
|
|
4418
|
+
var _this25 = this;
|
|
4345
4419
|
|
|
4346
4420
|
_classCallCheck(this, WebsyTemplate);
|
|
4347
4421
|
|
|
@@ -4367,9 +4441,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4367
4441
|
|
|
4368
4442
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4369
4443
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4370
|
-
|
|
4444
|
+
_this25.options.template = templateString;
|
|
4371
4445
|
|
|
4372
|
-
|
|
4446
|
+
_this25.render();
|
|
4373
4447
|
});
|
|
4374
4448
|
} else {
|
|
4375
4449
|
this.render();
|
|
@@ -4379,7 +4453,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4379
4453
|
_createClass(WebsyTemplate, [{
|
|
4380
4454
|
key: "buildHTML",
|
|
4381
4455
|
value: function buildHTML() {
|
|
4382
|
-
var
|
|
4456
|
+
var _this26 = this;
|
|
4383
4457
|
|
|
4384
4458
|
var html = "";
|
|
4385
4459
|
|
|
@@ -4441,14 +4515,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4441
4515
|
}
|
|
4442
4516
|
|
|
4443
4517
|
if (polarity === true) {
|
|
4444
|
-
if (typeof
|
|
4518
|
+
if (typeof _this26.options.data[parts[0]] !== 'undefined' && _this26.options.data[parts[0]] === parts[1]) {
|
|
4445
4519
|
// remove the <if> tags
|
|
4446
4520
|
removeAll = false;
|
|
4447
4521
|
} else if (parts[0] === parts[1]) {
|
|
4448
4522
|
removeAll = false;
|
|
4449
4523
|
}
|
|
4450
4524
|
} else if (polarity === false) {
|
|
4451
|
-
if (typeof
|
|
4525
|
+
if (typeof _this26.options.data[parts[0]] !== 'undefined' && _this26.options.data[parts[0]] !== parts[1]) {
|
|
4452
4526
|
// remove the <if> tags
|
|
4453
4527
|
removeAll = false;
|
|
4454
4528
|
}
|
|
@@ -4738,7 +4812,7 @@ var WebsyUtils = {
|
|
|
4738
4812
|
|
|
4739
4813
|
var WebsyTable = /*#__PURE__*/function () {
|
|
4740
4814
|
function WebsyTable(elementId, options) {
|
|
4741
|
-
var
|
|
4815
|
+
var _this27 = this;
|
|
4742
4816
|
|
|
4743
4817
|
_classCallCheck(this, WebsyTable);
|
|
4744
4818
|
|
|
@@ -4776,8 +4850,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4776
4850
|
allowClear: false,
|
|
4777
4851
|
disableSearch: true,
|
|
4778
4852
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4779
|
-
if (
|
|
4780
|
-
|
|
4853
|
+
if (_this27.options.onChangePageSize) {
|
|
4854
|
+
_this27.options.onChangePageSize(selectedItem.value);
|
|
4781
4855
|
}
|
|
4782
4856
|
}
|
|
4783
4857
|
});
|
|
@@ -4798,7 +4872,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4798
4872
|
_createClass(WebsyTable, [{
|
|
4799
4873
|
key: "appendRows",
|
|
4800
4874
|
value: function appendRows(data) {
|
|
4801
|
-
var
|
|
4875
|
+
var _this28 = this;
|
|
4802
4876
|
|
|
4803
4877
|
this.hideError();
|
|
4804
4878
|
var bodyHTML = '';
|
|
@@ -4806,15 +4880,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4806
4880
|
if (data) {
|
|
4807
4881
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4808
4882
|
return '<tr>' + r.map(function (c, i) {
|
|
4809
|
-
if (
|
|
4883
|
+
if (_this28.options.columns[i].show !== false) {
|
|
4810
4884
|
var style = '';
|
|
4811
4885
|
|
|
4812
4886
|
if (c.style) {
|
|
4813
4887
|
style += c.style;
|
|
4814
4888
|
}
|
|
4815
4889
|
|
|
4816
|
-
if (
|
|
4817
|
-
style += "width: ".concat(
|
|
4890
|
+
if (_this28.options.columns[i].width) {
|
|
4891
|
+
style += "width: ".concat(_this28.options.columns[i].width, "; ");
|
|
4818
4892
|
}
|
|
4819
4893
|
|
|
4820
4894
|
if (c.backgroundColor) {
|
|
@@ -4829,18 +4903,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4829
4903
|
style += "color: ".concat(c.color, "; ");
|
|
4830
4904
|
}
|
|
4831
4905
|
|
|
4832
|
-
if (
|
|
4833
|
-
return "\n <td \n data-row-index='".concat(
|
|
4834
|
-
} else if ((
|
|
4835
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
4906
|
+
if (_this28.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
4907
|
+
return "\n <td \n data-row-index='".concat(_this28.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this28.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(_this28.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this28.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
4908
|
+
} else if ((_this28.options.columns[i].showAsNavigatorLink === true || _this28.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
4909
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this28.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this28.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this28.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this28.options.columns[i].linkText || c.value, "</td>\n ");
|
|
4836
4910
|
} else {
|
|
4837
4911
|
var info = c.value;
|
|
4838
4912
|
|
|
4839
|
-
if (
|
|
4913
|
+
if (_this28.options.columns[i].showAsImage === true) {
|
|
4840
4914
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4841
4915
|
}
|
|
4842
4916
|
|
|
4843
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
4917
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this28.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this28.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 ");
|
|
4844
4918
|
}
|
|
4845
4919
|
}
|
|
4846
4920
|
}).join('') + '</tr>';
|
|
@@ -5012,7 +5086,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5012
5086
|
}, {
|
|
5013
5087
|
key: "render",
|
|
5014
5088
|
value: function render(data) {
|
|
5015
|
-
var
|
|
5089
|
+
var _this29 = this;
|
|
5016
5090
|
|
|
5017
5091
|
if (!this.options.columns) {
|
|
5018
5092
|
return;
|
|
@@ -5047,7 +5121,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5047
5121
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5048
5122
|
}
|
|
5049
5123
|
|
|
5050
|
-
return "\n <th style=\"".concat(style, "\">\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 ?
|
|
5124
|
+
return "\n <th style=\"".concat(style, "\">\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 ? _this29.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
5051
5125
|
}
|
|
5052
5126
|
}).join('') + '</tr>';
|
|
5053
5127
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5066,7 +5140,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5066
5140
|
|
|
5067
5141
|
if (pagingEl) {
|
|
5068
5142
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5069
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5143
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this29.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5070
5144
|
});
|
|
5071
5145
|
var startIndex = 0;
|
|
5072
5146
|
|
|
@@ -5134,7 +5208,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5134
5208
|
|
|
5135
5209
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5136
5210
|
function WebsyTable2(elementId, options) {
|
|
5137
|
-
var
|
|
5211
|
+
var _this30 = this;
|
|
5138
5212
|
|
|
5139
5213
|
_classCallCheck(this, WebsyTable2);
|
|
5140
5214
|
|
|
@@ -5175,8 +5249,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5175
5249
|
allowClear: false,
|
|
5176
5250
|
disableSearch: true,
|
|
5177
5251
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5178
|
-
if (
|
|
5179
|
-
|
|
5252
|
+
if (_this30.options.onChangePageSize) {
|
|
5253
|
+
_this30.options.onChangePageSize(selectedItem.value);
|
|
5180
5254
|
}
|
|
5181
5255
|
}
|
|
5182
5256
|
});
|
|
@@ -5200,7 +5274,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5200
5274
|
_createClass(WebsyTable2, [{
|
|
5201
5275
|
key: "appendRows",
|
|
5202
5276
|
value: function appendRows(data) {
|
|
5203
|
-
var
|
|
5277
|
+
var _this31 = this;
|
|
5204
5278
|
|
|
5205
5279
|
this.hideError();
|
|
5206
5280
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -5209,15 +5283,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5209
5283
|
if (data) {
|
|
5210
5284
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5211
5285
|
return '<tr>' + r.map(function (c, i) {
|
|
5212
|
-
if (
|
|
5213
|
-
var style = "height: ".concat(
|
|
5286
|
+
if (_this31.options.columns[i].show !== false) {
|
|
5287
|
+
var style = "height: ".concat(_this31.options.cellSize, "px; line-height: ").concat(_this31.options.cellSize, "px;");
|
|
5214
5288
|
|
|
5215
5289
|
if (c.style) {
|
|
5216
5290
|
style += c.style;
|
|
5217
5291
|
}
|
|
5218
5292
|
|
|
5219
|
-
if (
|
|
5220
|
-
style += "width: ".concat(
|
|
5293
|
+
if (_this31.options.columns[i].width) {
|
|
5294
|
+
style += "width: ".concat(_this31.options.columns[i].width, "; ");
|
|
5221
5295
|
}
|
|
5222
5296
|
|
|
5223
5297
|
if (c.backgroundColor) {
|
|
@@ -5232,18 +5306,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5232
5306
|
style += "color: ".concat(c.color, "; ");
|
|
5233
5307
|
}
|
|
5234
5308
|
|
|
5235
|
-
if (
|
|
5236
|
-
return "\n <td \n data-row-index='".concat(
|
|
5237
|
-
} else if ((
|
|
5238
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5309
|
+
if (_this31.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5310
|
+
return "\n <td \n data-row-index='".concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this31.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(_this31.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this31.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5311
|
+
} else if ((_this31.options.columns[i].showAsNavigatorLink === true || _this31.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5312
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this31.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this31.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this31.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5239
5313
|
} else {
|
|
5240
5314
|
var info = c.value;
|
|
5241
5315
|
|
|
5242
|
-
if (
|
|
5316
|
+
if (_this31.options.columns[i].showAsImage === true) {
|
|
5243
5317
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5244
5318
|
}
|
|
5245
5319
|
|
|
5246
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5320
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this31.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 ");
|
|
5247
5321
|
}
|
|
5248
5322
|
}
|
|
5249
5323
|
}).join('') + '</tr>';
|
|
@@ -5506,7 +5580,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5506
5580
|
}, {
|
|
5507
5581
|
key: "render",
|
|
5508
5582
|
value: function render(data) {
|
|
5509
|
-
var
|
|
5583
|
+
var _this32 = this;
|
|
5510
5584
|
|
|
5511
5585
|
if (!this.options.columns) {
|
|
5512
5586
|
return;
|
|
@@ -5542,7 +5616,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5542
5616
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5543
5617
|
}
|
|
5544
5618
|
|
|
5545
|
-
return "\n <th style=\"".concat(style, "\">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-sort-index=\"").concat(c.sortIndex || i, "\"\n data-index=\"").concat(i, "\"\n data-sort=\"").concat(c.sort, "\"\n style=\"").concat(c.style || '', "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n ").concat(c.searchable === true ?
|
|
5619
|
+
return "\n <th style=\"".concat(style, "\">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-sort-index=\"").concat(c.sortIndex || i, "\"\n data-index=\"").concat(i, "\"\n data-sort=\"").concat(c.sort, "\"\n style=\"").concat(c.style || '', "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n ").concat(c.searchable === true ? _this32.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5546
5620
|
}
|
|
5547
5621
|
}).join('') + '</tr>';
|
|
5548
5622
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5553,7 +5627,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5553
5627
|
var dropdownHTML = "";
|
|
5554
5628
|
this.options.columns.forEach(function (c, i) {
|
|
5555
5629
|
if (c.searchable && c.searchField) {
|
|
5556
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5630
|
+
dropdownHTML += "\n <div id=\"".concat(_this32.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
5557
5631
|
}
|
|
5558
5632
|
});
|
|
5559
5633
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5575,7 +5649,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5575
5649
|
|
|
5576
5650
|
if (pagingEl) {
|
|
5577
5651
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5578
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5652
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this32.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5579
5653
|
});
|
|
5580
5654
|
var startIndex = 0;
|
|
5581
5655
|
|
|
@@ -5666,7 +5740,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5666
5740
|
}, {
|
|
5667
5741
|
key: "getColumnParameters",
|
|
5668
5742
|
value: function getColumnParameters(values) {
|
|
5669
|
-
var
|
|
5743
|
+
var _this33 = this;
|
|
5670
5744
|
|
|
5671
5745
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
5672
5746
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -5674,10 +5748,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5674
5748
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
5675
5749
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5676
5750
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
5677
|
-
return "\n <th>\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField\" \n >\n ".concat(c.value || 'nbsp;', "\n </div>\n </div> \n ").concat(c.searchable === true ?
|
|
5751
|
+
return "\n <th>\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField\" \n >\n ".concat(c.value || 'nbsp;', "\n </div>\n </div> \n ").concat(c.searchable === true ? _this33.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5678
5752
|
}).join('') + '</tr>';
|
|
5679
5753
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
5680
|
-
return "\n <td \n style='height: ".concat(
|
|
5754
|
+
return "\n <td \n style='height: ".concat(_this33.options.cellSize, "px; line-height: ").concat(_this33.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
5681
5755
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
5682
5756
|
|
|
5683
5757
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -5868,7 +5942,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5868
5942
|
}, {
|
|
5869
5943
|
key: "buildHeaderHtml",
|
|
5870
5944
|
value: function buildHeaderHtml() {
|
|
5871
|
-
var
|
|
5945
|
+
var _this34 = this;
|
|
5872
5946
|
|
|
5873
5947
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
5874
5948
|
var headerHtml = '';
|
|
@@ -5883,7 +5957,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5883
5957
|
}
|
|
5884
5958
|
|
|
5885
5959
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
5886
|
-
if (useWidths === false && rowIndex !==
|
|
5960
|
+
if (useWidths === false && rowIndex !== _this34.options.columns.length - 1) {
|
|
5887
5961
|
// if we're calculating the size we only want to render the last row of column headers
|
|
5888
5962
|
return;
|
|
5889
5963
|
}
|
|
@@ -5897,18 +5971,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5897
5971
|
// `
|
|
5898
5972
|
// }
|
|
5899
5973
|
|
|
5900
|
-
headerHtml += " \n >\n <div>\n ".concat(col.name, "\n ").concat(col.searchable === true ?
|
|
5974
|
+
headerHtml += " \n >\n <div>\n ".concat(col.name, "\n ").concat(col.searchable === true ? _this34.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
|
|
5901
5975
|
});
|
|
5902
5976
|
headerHtml += "</tr>";
|
|
5903
5977
|
});
|
|
5904
5978
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
5905
5979
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
5906
5980
|
if (c.searchable && c.isExternalSearch === true) {
|
|
5907
|
-
var testEl = document.getElementById("".concat(
|
|
5981
|
+
var testEl = document.getElementById("".concat(_this34.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
5908
5982
|
|
|
5909
5983
|
if (!testEl) {
|
|
5910
5984
|
var newE = document.createElement('div');
|
|
5911
|
-
newE.id = "".concat(
|
|
5985
|
+
newE.id = "".concat(_this34.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
5912
5986
|
newE.className = 'websy-modal-dropdown';
|
|
5913
5987
|
dropdownEl.appendChild(newE);
|
|
5914
5988
|
}
|
|
@@ -5924,7 +5998,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5924
5998
|
}, {
|
|
5925
5999
|
key: "buildTotalHtml",
|
|
5926
6000
|
value: function buildTotalHtml() {
|
|
5927
|
-
var
|
|
6001
|
+
var _this35 = this;
|
|
5928
6002
|
|
|
5929
6003
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
5930
6004
|
|
|
@@ -5937,7 +6011,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5937
6011
|
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
5938
6012
|
|
|
5939
6013
|
if (useWidths === true) {
|
|
5940
|
-
totalHtml += "\n style='width: ".concat(
|
|
6014
|
+
totalHtml += "\n style='width: ".concat(_this35.options.columns[_this35.options.columns.length - 1][colIndex].width || _this35.options.columns[_this35.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
5941
6015
|
}
|
|
5942
6016
|
|
|
5943
6017
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -5948,7 +6022,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5948
6022
|
}, {
|
|
5949
6023
|
key: "calculateSizes",
|
|
5950
6024
|
value: function calculateSizes() {
|
|
5951
|
-
var
|
|
6025
|
+
var _this36 = this;
|
|
5952
6026
|
|
|
5953
6027
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
5954
6028
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -5990,28 +6064,28 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5990
6064
|
rows.forEach(function (row, rowIndex) {
|
|
5991
6065
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
5992
6066
|
var colSize = col.getBoundingClientRect();
|
|
5993
|
-
|
|
6067
|
+
_this36.sizes.cellHeight = colSize.height;
|
|
5994
6068
|
|
|
5995
|
-
if (
|
|
5996
|
-
if (!
|
|
5997
|
-
|
|
6069
|
+
if (_this36.options.columns[_this36.options.columns.length - 1][colIndex]) {
|
|
6070
|
+
if (!_this36.options.columns[_this36.options.columns.length - 1][colIndex].actualWidth) {
|
|
6071
|
+
_this36.options.columns[_this36.options.columns.length - 1][colIndex].actualWidth = 0;
|
|
5998
6072
|
}
|
|
5999
6073
|
|
|
6000
|
-
|
|
6001
|
-
|
|
6074
|
+
_this36.options.columns[_this36.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this36.options.columns[_this36.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
|
|
6075
|
+
_this36.options.columns[_this36.options.columns.length - 1][colIndex].cellHeight = colSize.height;
|
|
6002
6076
|
}
|
|
6003
6077
|
});
|
|
6004
6078
|
});
|
|
6005
6079
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6006
|
-
if (colIndex <
|
|
6007
|
-
|
|
6080
|
+
if (colIndex < _this36.pinnedColumns) {
|
|
6081
|
+
_this36.sizes.scrollableWidth -= col.actualWidth;
|
|
6008
6082
|
}
|
|
6009
6083
|
});
|
|
6010
6084
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6011
6085
|
return a + (b.width || b.actualWidth);
|
|
6012
6086
|
}, 0);
|
|
6013
6087
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6014
|
-
return i >=
|
|
6088
|
+
return i >= _this36.pinnedColumns;
|
|
6015
6089
|
}).reduce(function (a, b) {
|
|
6016
6090
|
return a + (b.width || b.actualWidth);
|
|
6017
6091
|
}, 0);
|
|
@@ -6029,13 +6103,13 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6029
6103
|
}
|
|
6030
6104
|
}
|
|
6031
6105
|
|
|
6032
|
-
|
|
6106
|
+
_this36.sizes.totalWidth += c.width || c.actualWidth;
|
|
6033
6107
|
|
|
6034
|
-
if (i <
|
|
6035
|
-
|
|
6108
|
+
if (i < _this36.pinnedColumns) {
|
|
6109
|
+
_this36.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6036
6110
|
}
|
|
6037
6111
|
|
|
6038
|
-
equalWidth = (outerSize.width -
|
|
6112
|
+
equalWidth = (outerSize.width - _this36.sizes.totalWidth) / (_this36.options.columns[_this36.options.columns.length - 1].length - (i + 1));
|
|
6039
6113
|
});
|
|
6040
6114
|
} // take the height of the last cell as the official height for data cells
|
|
6041
6115
|
// this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
|
|
@@ -6464,7 +6538,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6464
6538
|
|
|
6465
6539
|
var WebsyChart = /*#__PURE__*/function () {
|
|
6466
6540
|
function WebsyChart(elementId, options) {
|
|
6467
|
-
var
|
|
6541
|
+
var _this37 = this;
|
|
6468
6542
|
|
|
6469
6543
|
_classCallCheck(this, WebsyChart);
|
|
6470
6544
|
|
|
@@ -6513,22 +6587,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6513
6587
|
this.invertOverride = function (input, input2) {
|
|
6514
6588
|
var xAxis = 'bottomAxis';
|
|
6515
6589
|
|
|
6516
|
-
if (
|
|
6590
|
+
if (_this37.options.orientation === 'horizontal') {
|
|
6517
6591
|
xAxis = 'leftAxis';
|
|
6518
6592
|
}
|
|
6519
6593
|
|
|
6520
|
-
var width =
|
|
6594
|
+
var width = _this37[xAxis].step();
|
|
6521
6595
|
|
|
6522
6596
|
var output;
|
|
6523
6597
|
|
|
6524
|
-
var domain = _toConsumableArray(
|
|
6598
|
+
var domain = _toConsumableArray(_this37[xAxis].domain());
|
|
6525
6599
|
|
|
6526
|
-
if (
|
|
6600
|
+
if (_this37.options.orientation === 'horizontal') {
|
|
6527
6601
|
domain = domain.reverse();
|
|
6528
6602
|
}
|
|
6529
6603
|
|
|
6530
6604
|
for (var j = 0; j < domain.length; j++) {
|
|
6531
|
-
var breakA =
|
|
6605
|
+
var breakA = _this37[xAxis](domain[j]) - width / 2;
|
|
6532
6606
|
var breakB = breakA + width;
|
|
6533
6607
|
|
|
6534
6608
|
if (input > breakA && input <= breakB) {
|
|
@@ -6628,10 +6702,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6628
6702
|
}, {
|
|
6629
6703
|
key: "handleEventMouseMove",
|
|
6630
6704
|
value: function handleEventMouseMove(event, d) {
|
|
6631
|
-
var
|
|
6705
|
+
var _this38 = this;
|
|
6632
6706
|
|
|
6633
6707
|
var bisectDate = d3.bisector(function (d) {
|
|
6634
|
-
return
|
|
6708
|
+
return _this38.parseX(d.x.value);
|
|
6635
6709
|
}).left;
|
|
6636
6710
|
|
|
6637
6711
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -6670,8 +6744,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6670
6744
|
}
|
|
6671
6745
|
|
|
6672
6746
|
this.options.data.series.forEach(function (s) {
|
|
6673
|
-
if (
|
|
6674
|
-
xPoint =
|
|
6747
|
+
if (_this38.options.data[xData].scale !== 'Time') {
|
|
6748
|
+
xPoint = _this38[xAxis](_this38.parseX(xLabel));
|
|
6675
6749
|
s.data.forEach(function (d) {
|
|
6676
6750
|
if (d.x.value === xLabel) {
|
|
6677
6751
|
if (!tooltipTitle) {
|
|
@@ -6690,13 +6764,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6690
6764
|
var pointA = s.data[index - 1];
|
|
6691
6765
|
var pointB = s.data[index];
|
|
6692
6766
|
|
|
6693
|
-
if (
|
|
6767
|
+
if (_this38.options.orientation === 'horizontal') {
|
|
6694
6768
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
6695
6769
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
6696
6770
|
}
|
|
6697
6771
|
|
|
6698
6772
|
if (pointA && !pointB) {
|
|
6699
|
-
xPoint =
|
|
6773
|
+
xPoint = _this38[xAxis](_this38.parseX(pointA.x.value));
|
|
6700
6774
|
tooltipTitle = pointA.x.value;
|
|
6701
6775
|
|
|
6702
6776
|
if (!pointA.y.color) {
|
|
@@ -6706,12 +6780,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6706
6780
|
tooltipData.push(pointA.y);
|
|
6707
6781
|
|
|
6708
6782
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
6709
|
-
tooltipTitle = d3.timeFormat(
|
|
6783
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
6710
6784
|
}
|
|
6711
6785
|
}
|
|
6712
6786
|
|
|
6713
6787
|
if (pointB && !pointA) {
|
|
6714
|
-
xPoint =
|
|
6788
|
+
xPoint = _this38[xAxis](_this38.parseX(pointB.x.value));
|
|
6715
6789
|
tooltipTitle = pointB.x.value;
|
|
6716
6790
|
|
|
6717
6791
|
if (!pointB.y.color) {
|
|
@@ -6721,14 +6795,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6721
6795
|
tooltipData.push(pointB.y);
|
|
6722
6796
|
|
|
6723
6797
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
6724
|
-
tooltipTitle = d3.timeFormat(
|
|
6798
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
6725
6799
|
}
|
|
6726
6800
|
}
|
|
6727
6801
|
|
|
6728
6802
|
if (pointA && pointB) {
|
|
6729
|
-
var d0 =
|
|
6803
|
+
var d0 = _this38[xAxis](_this38.parseX(pointA.x.value));
|
|
6730
6804
|
|
|
6731
|
-
var d1 =
|
|
6805
|
+
var d1 = _this38[xAxis](_this38.parseX(pointB.x.value));
|
|
6732
6806
|
|
|
6733
6807
|
var mid = Math.abs(d0 - d1) / 2;
|
|
6734
6808
|
|
|
@@ -6737,7 +6811,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6737
6811
|
tooltipTitle = pointB.x.value;
|
|
6738
6812
|
|
|
6739
6813
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
6740
|
-
tooltipTitle = d3.timeFormat(
|
|
6814
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
6741
6815
|
}
|
|
6742
6816
|
|
|
6743
6817
|
if (!pointB.y.color) {
|
|
@@ -6750,7 +6824,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6750
6824
|
tooltipTitle = pointA.x.value;
|
|
6751
6825
|
|
|
6752
6826
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
6753
|
-
tooltipTitle = d3.timeFormat(
|
|
6827
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
6754
6828
|
}
|
|
6755
6829
|
|
|
6756
6830
|
if (!pointA.y.color) {
|
|
@@ -6855,7 +6929,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6855
6929
|
}, {
|
|
6856
6930
|
key: "render",
|
|
6857
6931
|
value: function render(options) {
|
|
6858
|
-
var
|
|
6932
|
+
var _this39 = this;
|
|
6859
6933
|
|
|
6860
6934
|
/* global d3 options WebsyUtils */
|
|
6861
6935
|
if (typeof options !== 'undefined') {
|
|
@@ -6924,7 +6998,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6924
6998
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
6925
6999
|
return {
|
|
6926
7000
|
value: s.label || s.key,
|
|
6927
|
-
color: s.color ||
|
|
7001
|
+
color: s.color || _this39.options.colors[i % _this39.options.colors.length]
|
|
6928
7002
|
};
|
|
6929
7003
|
});
|
|
6930
7004
|
|
|
@@ -7176,7 +7250,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7176
7250
|
|
|
7177
7251
|
if (this.options.data.bottom.formatter) {
|
|
7178
7252
|
bAxisFunc.tickFormat(function (d) {
|
|
7179
|
-
return
|
|
7253
|
+
return _this39.options.data.bottom.formatter(d);
|
|
7180
7254
|
});
|
|
7181
7255
|
}
|
|
7182
7256
|
|
|
@@ -7202,8 +7276,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7202
7276
|
|
|
7203
7277
|
if (this.options.margin.axisLeft > 0) {
|
|
7204
7278
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7205
|
-
if (
|
|
7206
|
-
d =
|
|
7279
|
+
if (_this39.options.data.left.formatter) {
|
|
7280
|
+
d = _this39.options.data.left.formatter(d);
|
|
7207
7281
|
}
|
|
7208
7282
|
|
|
7209
7283
|
return d;
|
|
@@ -7240,8 +7314,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7240
7314
|
|
|
7241
7315
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
7242
7316
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7243
|
-
if (
|
|
7244
|
-
d =
|
|
7317
|
+
if (_this39.options.data.right.formatter) {
|
|
7318
|
+
d = _this39.options.data.right.formatter(d);
|
|
7245
7319
|
}
|
|
7246
7320
|
|
|
7247
7321
|
return d;
|
|
@@ -7267,16 +7341,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7267
7341
|
|
|
7268
7342
|
this.options.data.series.forEach(function (series, index) {
|
|
7269
7343
|
if (!series.key) {
|
|
7270
|
-
series.key =
|
|
7344
|
+
series.key = _this39.createIdentity();
|
|
7271
7345
|
}
|
|
7272
7346
|
|
|
7273
7347
|
if (!series.color) {
|
|
7274
|
-
series.color =
|
|
7348
|
+
series.color = _this39.options.colors[index % _this39.options.colors.length];
|
|
7275
7349
|
}
|
|
7276
7350
|
|
|
7277
|
-
|
|
7351
|
+
_this39["render".concat(series.type || 'bar')](series, index);
|
|
7278
7352
|
|
|
7279
|
-
|
|
7353
|
+
_this39.renderLabels(series, index);
|
|
7280
7354
|
});
|
|
7281
7355
|
}
|
|
7282
7356
|
}
|
|
@@ -7284,17 +7358,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7284
7358
|
}, {
|
|
7285
7359
|
key: "renderarea",
|
|
7286
7360
|
value: function renderarea(series, index) {
|
|
7287
|
-
var
|
|
7361
|
+
var _this40 = this;
|
|
7288
7362
|
|
|
7289
7363
|
/* global d3 series index */
|
|
7290
7364
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
7291
7365
|
return d3.area().x(function (d) {
|
|
7292
|
-
return
|
|
7366
|
+
return _this40[xAxis](_this40.parseX(d.x.value));
|
|
7293
7367
|
}).y0(function (d) {
|
|
7294
|
-
return
|
|
7368
|
+
return _this40[yAxis](0);
|
|
7295
7369
|
}).y1(function (d) {
|
|
7296
|
-
return
|
|
7297
|
-
}).curve(d3[curveStyle ||
|
|
7370
|
+
return _this40[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7371
|
+
}).curve(d3[curveStyle || _this40.options.curveStyle]);
|
|
7298
7372
|
};
|
|
7299
7373
|
|
|
7300
7374
|
var xAxis = 'bottomAxis';
|
|
@@ -7410,7 +7484,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7410
7484
|
}, {
|
|
7411
7485
|
key: "renderLabels",
|
|
7412
7486
|
value: function renderLabels(series, index) {
|
|
7413
|
-
var
|
|
7487
|
+
var _this41 = this;
|
|
7414
7488
|
|
|
7415
7489
|
/* global series index d3 WebsyDesigns */
|
|
7416
7490
|
var xAxis = 'bottomAxis';
|
|
@@ -7429,7 +7503,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7429
7503
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
7430
7504
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
7431
7505
|
labels.attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
7432
|
-
return
|
|
7506
|
+
return _this41.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7433
7507
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
7434
7508
|
return d.y.label || d.y.value;
|
|
7435
7509
|
}).each(function (d, i) {
|
|
@@ -7454,7 +7528,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7454
7528
|
}
|
|
7455
7529
|
});
|
|
7456
7530
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
7457
|
-
return
|
|
7531
|
+
return _this41.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7458
7532
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
7459
7533
|
return d.y.label || d.y.value;
|
|
7460
7534
|
}).each(function (d, i) {
|
|
@@ -7511,15 +7585,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7511
7585
|
}, {
|
|
7512
7586
|
key: "renderline",
|
|
7513
7587
|
value: function renderline(series, index) {
|
|
7514
|
-
var
|
|
7588
|
+
var _this42 = this;
|
|
7515
7589
|
|
|
7516
7590
|
/* global series index d3 */
|
|
7517
7591
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
7518
7592
|
return d3.line().x(function (d) {
|
|
7519
|
-
return
|
|
7593
|
+
return _this42[xAxis](_this42.parseX(d.x.value));
|
|
7520
7594
|
}).y(function (d) {
|
|
7521
|
-
return
|
|
7522
|
-
}).curve(d3[curveStyle ||
|
|
7595
|
+
return _this42[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7596
|
+
}).curve(d3[curveStyle || _this42.options.curveStyle]);
|
|
7523
7597
|
};
|
|
7524
7598
|
|
|
7525
7599
|
var xAxis = 'bottomAxis';
|
|
@@ -7557,14 +7631,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7557
7631
|
}, {
|
|
7558
7632
|
key: "rendersymbol",
|
|
7559
7633
|
value: function rendersymbol(series, index) {
|
|
7560
|
-
var
|
|
7634
|
+
var _this43 = this;
|
|
7561
7635
|
|
|
7562
7636
|
/* global d3 series index series.key */
|
|
7563
7637
|
var drawSymbol = function drawSymbol(size) {
|
|
7564
7638
|
return d3.symbol() // .type(d => {
|
|
7565
7639
|
// return d3.symbols[0]
|
|
7566
7640
|
// })
|
|
7567
|
-
.size(size ||
|
|
7641
|
+
.size(size || _this43.options.symbolSize);
|
|
7568
7642
|
};
|
|
7569
7643
|
|
|
7570
7644
|
var xAxis = 'bottomAxis';
|
|
@@ -7582,7 +7656,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7582
7656
|
symbols.attr('d', function (d) {
|
|
7583
7657
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
7584
7658
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
7585
|
-
return "translate(".concat(
|
|
7659
|
+
return "translate(".concat(_this43[xAxis](_this43.parseX(d.x.value)), ", ").concat(_this43[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
7586
7660
|
}); // Enter
|
|
7587
7661
|
|
|
7588
7662
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -7591,7 +7665,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7591
7665
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
7592
7666
|
return "symbol symbol_".concat(series.key);
|
|
7593
7667
|
}).attr('transform', function (d) {
|
|
7594
|
-
return "translate(".concat(
|
|
7668
|
+
return "translate(".concat(_this43[xAxis](_this43.parseX(d.x.value)), ", ").concat(_this43[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
7595
7669
|
});
|
|
7596
7670
|
}
|
|
7597
7671
|
}, {
|
|
@@ -7746,7 +7820,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
7746
7820
|
}, {
|
|
7747
7821
|
key: "resize",
|
|
7748
7822
|
value: function resize() {
|
|
7749
|
-
var
|
|
7823
|
+
var _this44 = this;
|
|
7750
7824
|
|
|
7751
7825
|
var el = document.getElementById(this.elementId);
|
|
7752
7826
|
|
|
@@ -7759,7 +7833,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
7759
7833
|
// }
|
|
7760
7834
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
7761
7835
|
html += this._data.map(function (d, i) {
|
|
7762
|
-
return
|
|
7836
|
+
return _this44.getLegendItemHTML(d);
|
|
7763
7837
|
}).join('');
|
|
7764
7838
|
html += "\n <div>\n ";
|
|
7765
7839
|
el.innerHTML = html;
|
|
@@ -7931,7 +8005,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7931
8005
|
}, {
|
|
7932
8006
|
key: "render",
|
|
7933
8007
|
value: function render() {
|
|
7934
|
-
var
|
|
8008
|
+
var _this45 = this;
|
|
7935
8009
|
|
|
7936
8010
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
7937
8011
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -7940,7 +8014,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7940
8014
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
7941
8015
|
return {
|
|
7942
8016
|
value: s.label || s.key,
|
|
7943
|
-
color: s.color ||
|
|
8017
|
+
color: s.color || _this45.options.colors[i % _this45.options.colors.length]
|
|
7944
8018
|
};
|
|
7945
8019
|
});
|
|
7946
8020
|
var longestValue = legendData.map(function (s) {
|
|
@@ -8004,7 +8078,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8004
8078
|
|
|
8005
8079
|
if (this.polygons) {
|
|
8006
8080
|
this.polygons.forEach(function (p) {
|
|
8007
|
-
return
|
|
8081
|
+
return _this45.map.removeLayer(p);
|
|
8008
8082
|
});
|
|
8009
8083
|
}
|
|
8010
8084
|
|
|
@@ -8062,18 +8136,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8062
8136
|
}
|
|
8063
8137
|
|
|
8064
8138
|
if (!p.options.color) {
|
|
8065
|
-
p.options.color =
|
|
8139
|
+
p.options.color = _this45.options.colors[i % _this45.options.colors.length];
|
|
8066
8140
|
}
|
|
8067
8141
|
|
|
8068
8142
|
var pol = L.polygon(p.data.map(function (c) {
|
|
8069
8143
|
return c.map(function (d) {
|
|
8070
8144
|
return [d.Latitude, d.Longitude];
|
|
8071
8145
|
});
|
|
8072
|
-
}), p.options).addTo(
|
|
8146
|
+
}), p.options).addTo(_this45.map);
|
|
8073
8147
|
|
|
8074
|
-
|
|
8148
|
+
_this45.polygons.push(pol);
|
|
8075
8149
|
|
|
8076
|
-
|
|
8150
|
+
_this45.map.fitBounds(pol.getBounds());
|
|
8077
8151
|
});
|
|
8078
8152
|
} // if (this.data.markers.length > 0) {
|
|
8079
8153
|
// el.classList.remove('hidden')
|