@websy/websy-designs 1.3.3 → 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/websy-designs-es6.debug.js +21 -6
- package/dist/websy-designs-es6.js +150 -133
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +21 -6
- package/dist/websy-designs.js +153 -136
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -3387,6 +3387,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3387
3387
|
|
|
3388
3388
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3389
3389
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
3390
|
+
var locator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
3390
3391
|
var html = "";
|
|
3391
3392
|
|
|
3392
3393
|
if (this.options.template) {
|
|
@@ -3497,7 +3498,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3497
3498
|
parts.forEach(function (p) {
|
|
3498
3499
|
items = items[p];
|
|
3499
3500
|
});
|
|
3500
|
-
template = template.replace(m[0], _this21.buildHTML(items, 0, withoutFor));
|
|
3501
|
+
template = template.replace(m[0], _this21.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
3501
3502
|
}
|
|
3502
3503
|
});
|
|
3503
3504
|
|
|
@@ -3505,7 +3506,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3505
3506
|
|
|
3506
3507
|
tagMatches.forEach(function (m) {
|
|
3507
3508
|
if (m[0] && m.index > -1) {
|
|
3508
|
-
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(';'), "'"));
|
|
3509
3510
|
}
|
|
3510
3511
|
});
|
|
3511
3512
|
|
|
@@ -3567,8 +3568,6 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3567
3568
|
}, {
|
|
3568
3569
|
key: "handleClick",
|
|
3569
3570
|
value: function handleClick(event) {
|
|
3570
|
-
var _this22 = this;
|
|
3571
|
-
|
|
3572
3571
|
if (event.target.classList.contains('clickable')) {
|
|
3573
3572
|
var l = event.target.getAttribute('data-event');
|
|
3574
3573
|
|
|
@@ -3576,6 +3575,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3576
3575
|
l = l.split('(');
|
|
3577
3576
|
var params = [];
|
|
3578
3577
|
var id = event.target.getAttribute('data-id');
|
|
3578
|
+
var locator = event.target.getAttribute('data-locator');
|
|
3579
3579
|
|
|
3580
3580
|
if (l[1]) {
|
|
3581
3581
|
l[1] = l[1].replace(')', '');
|
|
@@ -3583,10 +3583,27 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3583
3583
|
}
|
|
3584
3584
|
|
|
3585
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
|
+
|
|
3586
3603
|
params = params.map(function (p) {
|
|
3587
3604
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
3588
|
-
if (
|
|
3589
|
-
p =
|
|
3605
|
+
if (data[+id]) {
|
|
3606
|
+
p = data[+id][p];
|
|
3590
3607
|
}
|
|
3591
3608
|
} else if (typeof p === 'string') {
|
|
3592
3609
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -3600,7 +3617,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3600
3617
|
|
|
3601
3618
|
event.stopPropagation();
|
|
3602
3619
|
|
|
3603
|
-
(_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)));
|
|
3604
3621
|
}
|
|
3605
3622
|
}
|
|
3606
3623
|
}
|
|
@@ -3608,13 +3625,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3608
3625
|
}, {
|
|
3609
3626
|
key: "render",
|
|
3610
3627
|
value: function render() {
|
|
3611
|
-
var
|
|
3628
|
+
var _this22 = this;
|
|
3612
3629
|
|
|
3613
3630
|
if (this.options.entity) {
|
|
3614
3631
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3615
|
-
|
|
3632
|
+
_this22.rows = results.rows;
|
|
3616
3633
|
|
|
3617
|
-
|
|
3634
|
+
_this22.resize();
|
|
3618
3635
|
});
|
|
3619
3636
|
} else {
|
|
3620
3637
|
this.resize();
|
|
@@ -3692,14 +3709,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3692
3709
|
_createClass(WebsyRouter, [{
|
|
3693
3710
|
key: "addGroup",
|
|
3694
3711
|
value: function addGroup(group) {
|
|
3695
|
-
var
|
|
3712
|
+
var _this23 = this;
|
|
3696
3713
|
|
|
3697
3714
|
if (!this.groups[group]) {
|
|
3698
3715
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3699
3716
|
|
|
3700
3717
|
if (els) {
|
|
3701
3718
|
this.getClosestParent(els[0], function (parent) {
|
|
3702
|
-
|
|
3719
|
+
_this23.groups[group] = {
|
|
3703
3720
|
activeView: '',
|
|
3704
3721
|
views: [],
|
|
3705
3722
|
parent: parent.getAttribute('data-view')
|
|
@@ -4024,12 +4041,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4024
4041
|
}, {
|
|
4025
4042
|
key: "showComponents",
|
|
4026
4043
|
value: function showComponents(view) {
|
|
4027
|
-
var
|
|
4044
|
+
var _this24 = this;
|
|
4028
4045
|
|
|
4029
4046
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4030
4047
|
this.options.views[view].components.forEach(function (c) {
|
|
4031
4048
|
if (typeof c.instance === 'undefined') {
|
|
4032
|
-
|
|
4049
|
+
_this24.prepComponent(c.elementId, c.options);
|
|
4033
4050
|
|
|
4034
4051
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4035
4052
|
} else if (c.instance.render) {
|
|
@@ -4398,7 +4415,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4398
4415
|
|
|
4399
4416
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4400
4417
|
function WebsyTemplate(elementId, options) {
|
|
4401
|
-
var
|
|
4418
|
+
var _this25 = this;
|
|
4402
4419
|
|
|
4403
4420
|
_classCallCheck(this, WebsyTemplate);
|
|
4404
4421
|
|
|
@@ -4424,9 +4441,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4424
4441
|
|
|
4425
4442
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4426
4443
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4427
|
-
|
|
4444
|
+
_this25.options.template = templateString;
|
|
4428
4445
|
|
|
4429
|
-
|
|
4446
|
+
_this25.render();
|
|
4430
4447
|
});
|
|
4431
4448
|
} else {
|
|
4432
4449
|
this.render();
|
|
@@ -4436,7 +4453,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4436
4453
|
_createClass(WebsyTemplate, [{
|
|
4437
4454
|
key: "buildHTML",
|
|
4438
4455
|
value: function buildHTML() {
|
|
4439
|
-
var
|
|
4456
|
+
var _this26 = this;
|
|
4440
4457
|
|
|
4441
4458
|
var html = "";
|
|
4442
4459
|
|
|
@@ -4498,14 +4515,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4498
4515
|
}
|
|
4499
4516
|
|
|
4500
4517
|
if (polarity === true) {
|
|
4501
|
-
if (typeof
|
|
4518
|
+
if (typeof _this26.options.data[parts[0]] !== 'undefined' && _this26.options.data[parts[0]] === parts[1]) {
|
|
4502
4519
|
// remove the <if> tags
|
|
4503
4520
|
removeAll = false;
|
|
4504
4521
|
} else if (parts[0] === parts[1]) {
|
|
4505
4522
|
removeAll = false;
|
|
4506
4523
|
}
|
|
4507
4524
|
} else if (polarity === false) {
|
|
4508
|
-
if (typeof
|
|
4525
|
+
if (typeof _this26.options.data[parts[0]] !== 'undefined' && _this26.options.data[parts[0]] !== parts[1]) {
|
|
4509
4526
|
// remove the <if> tags
|
|
4510
4527
|
removeAll = false;
|
|
4511
4528
|
}
|
|
@@ -4795,7 +4812,7 @@ var WebsyUtils = {
|
|
|
4795
4812
|
|
|
4796
4813
|
var WebsyTable = /*#__PURE__*/function () {
|
|
4797
4814
|
function WebsyTable(elementId, options) {
|
|
4798
|
-
var
|
|
4815
|
+
var _this27 = this;
|
|
4799
4816
|
|
|
4800
4817
|
_classCallCheck(this, WebsyTable);
|
|
4801
4818
|
|
|
@@ -4833,8 +4850,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4833
4850
|
allowClear: false,
|
|
4834
4851
|
disableSearch: true,
|
|
4835
4852
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4836
|
-
if (
|
|
4837
|
-
|
|
4853
|
+
if (_this27.options.onChangePageSize) {
|
|
4854
|
+
_this27.options.onChangePageSize(selectedItem.value);
|
|
4838
4855
|
}
|
|
4839
4856
|
}
|
|
4840
4857
|
});
|
|
@@ -4855,7 +4872,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4855
4872
|
_createClass(WebsyTable, [{
|
|
4856
4873
|
key: "appendRows",
|
|
4857
4874
|
value: function appendRows(data) {
|
|
4858
|
-
var
|
|
4875
|
+
var _this28 = this;
|
|
4859
4876
|
|
|
4860
4877
|
this.hideError();
|
|
4861
4878
|
var bodyHTML = '';
|
|
@@ -4863,15 +4880,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4863
4880
|
if (data) {
|
|
4864
4881
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4865
4882
|
return '<tr>' + r.map(function (c, i) {
|
|
4866
|
-
if (
|
|
4883
|
+
if (_this28.options.columns[i].show !== false) {
|
|
4867
4884
|
var style = '';
|
|
4868
4885
|
|
|
4869
4886
|
if (c.style) {
|
|
4870
4887
|
style += c.style;
|
|
4871
4888
|
}
|
|
4872
4889
|
|
|
4873
|
-
if (
|
|
4874
|
-
style += "width: ".concat(
|
|
4890
|
+
if (_this28.options.columns[i].width) {
|
|
4891
|
+
style += "width: ".concat(_this28.options.columns[i].width, "; ");
|
|
4875
4892
|
}
|
|
4876
4893
|
|
|
4877
4894
|
if (c.backgroundColor) {
|
|
@@ -4886,18 +4903,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4886
4903
|
style += "color: ".concat(c.color, "; ");
|
|
4887
4904
|
}
|
|
4888
4905
|
|
|
4889
|
-
if (
|
|
4890
|
-
return "\n <td \n data-row-index='".concat(
|
|
4891
|
-
} else if ((
|
|
4892
|
-
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 ");
|
|
4893
4910
|
} else {
|
|
4894
4911
|
var info = c.value;
|
|
4895
4912
|
|
|
4896
|
-
if (
|
|
4913
|
+
if (_this28.options.columns[i].showAsImage === true) {
|
|
4897
4914
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4898
4915
|
}
|
|
4899
4916
|
|
|
4900
|
-
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 ");
|
|
4901
4918
|
}
|
|
4902
4919
|
}
|
|
4903
4920
|
}).join('') + '</tr>';
|
|
@@ -5069,7 +5086,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5069
5086
|
}, {
|
|
5070
5087
|
key: "render",
|
|
5071
5088
|
value: function render(data) {
|
|
5072
|
-
var
|
|
5089
|
+
var _this29 = this;
|
|
5073
5090
|
|
|
5074
5091
|
if (!this.options.columns) {
|
|
5075
5092
|
return;
|
|
@@ -5104,7 +5121,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5104
5121
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5105
5122
|
}
|
|
5106
5123
|
|
|
5107
|
-
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 ");
|
|
5108
5125
|
}
|
|
5109
5126
|
}).join('') + '</tr>';
|
|
5110
5127
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5123,7 +5140,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5123
5140
|
|
|
5124
5141
|
if (pagingEl) {
|
|
5125
5142
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5126
|
-
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>");
|
|
5127
5144
|
});
|
|
5128
5145
|
var startIndex = 0;
|
|
5129
5146
|
|
|
@@ -5191,7 +5208,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5191
5208
|
|
|
5192
5209
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5193
5210
|
function WebsyTable2(elementId, options) {
|
|
5194
|
-
var
|
|
5211
|
+
var _this30 = this;
|
|
5195
5212
|
|
|
5196
5213
|
_classCallCheck(this, WebsyTable2);
|
|
5197
5214
|
|
|
@@ -5232,8 +5249,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5232
5249
|
allowClear: false,
|
|
5233
5250
|
disableSearch: true,
|
|
5234
5251
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5235
|
-
if (
|
|
5236
|
-
|
|
5252
|
+
if (_this30.options.onChangePageSize) {
|
|
5253
|
+
_this30.options.onChangePageSize(selectedItem.value);
|
|
5237
5254
|
}
|
|
5238
5255
|
}
|
|
5239
5256
|
});
|
|
@@ -5257,7 +5274,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5257
5274
|
_createClass(WebsyTable2, [{
|
|
5258
5275
|
key: "appendRows",
|
|
5259
5276
|
value: function appendRows(data) {
|
|
5260
|
-
var
|
|
5277
|
+
var _this31 = this;
|
|
5261
5278
|
|
|
5262
5279
|
this.hideError();
|
|
5263
5280
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -5266,15 +5283,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5266
5283
|
if (data) {
|
|
5267
5284
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5268
5285
|
return '<tr>' + r.map(function (c, i) {
|
|
5269
|
-
if (
|
|
5270
|
-
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;");
|
|
5271
5288
|
|
|
5272
5289
|
if (c.style) {
|
|
5273
5290
|
style += c.style;
|
|
5274
5291
|
}
|
|
5275
5292
|
|
|
5276
|
-
if (
|
|
5277
|
-
style += "width: ".concat(
|
|
5293
|
+
if (_this31.options.columns[i].width) {
|
|
5294
|
+
style += "width: ".concat(_this31.options.columns[i].width, "; ");
|
|
5278
5295
|
}
|
|
5279
5296
|
|
|
5280
5297
|
if (c.backgroundColor) {
|
|
@@ -5289,18 +5306,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5289
5306
|
style += "color: ".concat(c.color, "; ");
|
|
5290
5307
|
}
|
|
5291
5308
|
|
|
5292
|
-
if (
|
|
5293
|
-
return "\n <td \n data-row-index='".concat(
|
|
5294
|
-
} else if ((
|
|
5295
|
-
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 ");
|
|
5296
5313
|
} else {
|
|
5297
5314
|
var info = c.value;
|
|
5298
5315
|
|
|
5299
|
-
if (
|
|
5316
|
+
if (_this31.options.columns[i].showAsImage === true) {
|
|
5300
5317
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5301
5318
|
}
|
|
5302
5319
|
|
|
5303
|
-
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 ");
|
|
5304
5321
|
}
|
|
5305
5322
|
}
|
|
5306
5323
|
}).join('') + '</tr>';
|
|
@@ -5563,7 +5580,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5563
5580
|
}, {
|
|
5564
5581
|
key: "render",
|
|
5565
5582
|
value: function render(data) {
|
|
5566
|
-
var
|
|
5583
|
+
var _this32 = this;
|
|
5567
5584
|
|
|
5568
5585
|
if (!this.options.columns) {
|
|
5569
5586
|
return;
|
|
@@ -5599,7 +5616,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5599
5616
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5600
5617
|
}
|
|
5601
5618
|
|
|
5602
|
-
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 ");
|
|
5603
5620
|
}
|
|
5604
5621
|
}).join('') + '</tr>';
|
|
5605
5622
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5610,7 +5627,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5610
5627
|
var dropdownHTML = "";
|
|
5611
5628
|
this.options.columns.forEach(function (c, i) {
|
|
5612
5629
|
if (c.searchable && c.searchField) {
|
|
5613
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5630
|
+
dropdownHTML += "\n <div id=\"".concat(_this32.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
5614
5631
|
}
|
|
5615
5632
|
});
|
|
5616
5633
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5632,7 +5649,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5632
5649
|
|
|
5633
5650
|
if (pagingEl) {
|
|
5634
5651
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5635
|
-
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>");
|
|
5636
5653
|
});
|
|
5637
5654
|
var startIndex = 0;
|
|
5638
5655
|
|
|
@@ -5723,7 +5740,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5723
5740
|
}, {
|
|
5724
5741
|
key: "getColumnParameters",
|
|
5725
5742
|
value: function getColumnParameters(values) {
|
|
5726
|
-
var
|
|
5743
|
+
var _this33 = this;
|
|
5727
5744
|
|
|
5728
5745
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
5729
5746
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -5731,10 +5748,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5731
5748
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
5732
5749
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5733
5750
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
5734
|
-
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 ");
|
|
5735
5752
|
}).join('') + '</tr>';
|
|
5736
5753
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
5737
|
-
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 ");
|
|
5738
5755
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
5739
5756
|
|
|
5740
5757
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -5925,7 +5942,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5925
5942
|
}, {
|
|
5926
5943
|
key: "buildHeaderHtml",
|
|
5927
5944
|
value: function buildHeaderHtml() {
|
|
5928
|
-
var
|
|
5945
|
+
var _this34 = this;
|
|
5929
5946
|
|
|
5930
5947
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
5931
5948
|
var headerHtml = '';
|
|
@@ -5940,7 +5957,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5940
5957
|
}
|
|
5941
5958
|
|
|
5942
5959
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
5943
|
-
if (useWidths === false && rowIndex !==
|
|
5960
|
+
if (useWidths === false && rowIndex !== _this34.options.columns.length - 1) {
|
|
5944
5961
|
// if we're calculating the size we only want to render the last row of column headers
|
|
5945
5962
|
return;
|
|
5946
5963
|
}
|
|
@@ -5954,18 +5971,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5954
5971
|
// `
|
|
5955
5972
|
// }
|
|
5956
5973
|
|
|
5957
|
-
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>");
|
|
5958
5975
|
});
|
|
5959
5976
|
headerHtml += "</tr>";
|
|
5960
5977
|
});
|
|
5961
5978
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
5962
5979
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
5963
5980
|
if (c.searchable && c.isExternalSearch === true) {
|
|
5964
|
-
var testEl = document.getElementById("".concat(
|
|
5981
|
+
var testEl = document.getElementById("".concat(_this34.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
5965
5982
|
|
|
5966
5983
|
if (!testEl) {
|
|
5967
5984
|
var newE = document.createElement('div');
|
|
5968
|
-
newE.id = "".concat(
|
|
5985
|
+
newE.id = "".concat(_this34.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
5969
5986
|
newE.className = 'websy-modal-dropdown';
|
|
5970
5987
|
dropdownEl.appendChild(newE);
|
|
5971
5988
|
}
|
|
@@ -5981,7 +5998,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5981
5998
|
}, {
|
|
5982
5999
|
key: "buildTotalHtml",
|
|
5983
6000
|
value: function buildTotalHtml() {
|
|
5984
|
-
var
|
|
6001
|
+
var _this35 = this;
|
|
5985
6002
|
|
|
5986
6003
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
5987
6004
|
|
|
@@ -5994,7 +6011,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5994
6011
|
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
5995
6012
|
|
|
5996
6013
|
if (useWidths === true) {
|
|
5997
|
-
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 ");
|
|
5998
6015
|
}
|
|
5999
6016
|
|
|
6000
6017
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -6005,7 +6022,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6005
6022
|
}, {
|
|
6006
6023
|
key: "calculateSizes",
|
|
6007
6024
|
value: function calculateSizes() {
|
|
6008
|
-
var
|
|
6025
|
+
var _this36 = this;
|
|
6009
6026
|
|
|
6010
6027
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6011
6028
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -6047,28 +6064,28 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6047
6064
|
rows.forEach(function (row, rowIndex) {
|
|
6048
6065
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6049
6066
|
var colSize = col.getBoundingClientRect();
|
|
6050
|
-
|
|
6067
|
+
_this36.sizes.cellHeight = colSize.height;
|
|
6051
6068
|
|
|
6052
|
-
if (
|
|
6053
|
-
if (!
|
|
6054
|
-
|
|
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;
|
|
6055
6072
|
}
|
|
6056
6073
|
|
|
6057
|
-
|
|
6058
|
-
|
|
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;
|
|
6059
6076
|
}
|
|
6060
6077
|
});
|
|
6061
6078
|
});
|
|
6062
6079
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6063
|
-
if (colIndex <
|
|
6064
|
-
|
|
6080
|
+
if (colIndex < _this36.pinnedColumns) {
|
|
6081
|
+
_this36.sizes.scrollableWidth -= col.actualWidth;
|
|
6065
6082
|
}
|
|
6066
6083
|
});
|
|
6067
6084
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6068
6085
|
return a + (b.width || b.actualWidth);
|
|
6069
6086
|
}, 0);
|
|
6070
6087
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6071
|
-
return i >=
|
|
6088
|
+
return i >= _this36.pinnedColumns;
|
|
6072
6089
|
}).reduce(function (a, b) {
|
|
6073
6090
|
return a + (b.width || b.actualWidth);
|
|
6074
6091
|
}, 0);
|
|
@@ -6086,13 +6103,13 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6086
6103
|
}
|
|
6087
6104
|
}
|
|
6088
6105
|
|
|
6089
|
-
|
|
6106
|
+
_this36.sizes.totalWidth += c.width || c.actualWidth;
|
|
6090
6107
|
|
|
6091
|
-
if (i <
|
|
6092
|
-
|
|
6108
|
+
if (i < _this36.pinnedColumns) {
|
|
6109
|
+
_this36.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6093
6110
|
}
|
|
6094
6111
|
|
|
6095
|
-
equalWidth = (outerSize.width -
|
|
6112
|
+
equalWidth = (outerSize.width - _this36.sizes.totalWidth) / (_this36.options.columns[_this36.options.columns.length - 1].length - (i + 1));
|
|
6096
6113
|
});
|
|
6097
6114
|
} // take the height of the last cell as the official height for data cells
|
|
6098
6115
|
// this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
|
|
@@ -6521,7 +6538,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6521
6538
|
|
|
6522
6539
|
var WebsyChart = /*#__PURE__*/function () {
|
|
6523
6540
|
function WebsyChart(elementId, options) {
|
|
6524
|
-
var
|
|
6541
|
+
var _this37 = this;
|
|
6525
6542
|
|
|
6526
6543
|
_classCallCheck(this, WebsyChart);
|
|
6527
6544
|
|
|
@@ -6570,22 +6587,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6570
6587
|
this.invertOverride = function (input, input2) {
|
|
6571
6588
|
var xAxis = 'bottomAxis';
|
|
6572
6589
|
|
|
6573
|
-
if (
|
|
6590
|
+
if (_this37.options.orientation === 'horizontal') {
|
|
6574
6591
|
xAxis = 'leftAxis';
|
|
6575
6592
|
}
|
|
6576
6593
|
|
|
6577
|
-
var width =
|
|
6594
|
+
var width = _this37[xAxis].step();
|
|
6578
6595
|
|
|
6579
6596
|
var output;
|
|
6580
6597
|
|
|
6581
|
-
var domain = _toConsumableArray(
|
|
6598
|
+
var domain = _toConsumableArray(_this37[xAxis].domain());
|
|
6582
6599
|
|
|
6583
|
-
if (
|
|
6600
|
+
if (_this37.options.orientation === 'horizontal') {
|
|
6584
6601
|
domain = domain.reverse();
|
|
6585
6602
|
}
|
|
6586
6603
|
|
|
6587
6604
|
for (var j = 0; j < domain.length; j++) {
|
|
6588
|
-
var breakA =
|
|
6605
|
+
var breakA = _this37[xAxis](domain[j]) - width / 2;
|
|
6589
6606
|
var breakB = breakA + width;
|
|
6590
6607
|
|
|
6591
6608
|
if (input > breakA && input <= breakB) {
|
|
@@ -6685,10 +6702,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6685
6702
|
}, {
|
|
6686
6703
|
key: "handleEventMouseMove",
|
|
6687
6704
|
value: function handleEventMouseMove(event, d) {
|
|
6688
|
-
var
|
|
6705
|
+
var _this38 = this;
|
|
6689
6706
|
|
|
6690
6707
|
var bisectDate = d3.bisector(function (d) {
|
|
6691
|
-
return
|
|
6708
|
+
return _this38.parseX(d.x.value);
|
|
6692
6709
|
}).left;
|
|
6693
6710
|
|
|
6694
6711
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -6727,8 +6744,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6727
6744
|
}
|
|
6728
6745
|
|
|
6729
6746
|
this.options.data.series.forEach(function (s) {
|
|
6730
|
-
if (
|
|
6731
|
-
xPoint =
|
|
6747
|
+
if (_this38.options.data[xData].scale !== 'Time') {
|
|
6748
|
+
xPoint = _this38[xAxis](_this38.parseX(xLabel));
|
|
6732
6749
|
s.data.forEach(function (d) {
|
|
6733
6750
|
if (d.x.value === xLabel) {
|
|
6734
6751
|
if (!tooltipTitle) {
|
|
@@ -6747,13 +6764,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6747
6764
|
var pointA = s.data[index - 1];
|
|
6748
6765
|
var pointB = s.data[index];
|
|
6749
6766
|
|
|
6750
|
-
if (
|
|
6767
|
+
if (_this38.options.orientation === 'horizontal') {
|
|
6751
6768
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
6752
6769
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
6753
6770
|
}
|
|
6754
6771
|
|
|
6755
6772
|
if (pointA && !pointB) {
|
|
6756
|
-
xPoint =
|
|
6773
|
+
xPoint = _this38[xAxis](_this38.parseX(pointA.x.value));
|
|
6757
6774
|
tooltipTitle = pointA.x.value;
|
|
6758
6775
|
|
|
6759
6776
|
if (!pointA.y.color) {
|
|
@@ -6763,12 +6780,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6763
6780
|
tooltipData.push(pointA.y);
|
|
6764
6781
|
|
|
6765
6782
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
6766
|
-
tooltipTitle = d3.timeFormat(
|
|
6783
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
6767
6784
|
}
|
|
6768
6785
|
}
|
|
6769
6786
|
|
|
6770
6787
|
if (pointB && !pointA) {
|
|
6771
|
-
xPoint =
|
|
6788
|
+
xPoint = _this38[xAxis](_this38.parseX(pointB.x.value));
|
|
6772
6789
|
tooltipTitle = pointB.x.value;
|
|
6773
6790
|
|
|
6774
6791
|
if (!pointB.y.color) {
|
|
@@ -6778,14 +6795,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6778
6795
|
tooltipData.push(pointB.y);
|
|
6779
6796
|
|
|
6780
6797
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
6781
|
-
tooltipTitle = d3.timeFormat(
|
|
6798
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
6782
6799
|
}
|
|
6783
6800
|
}
|
|
6784
6801
|
|
|
6785
6802
|
if (pointA && pointB) {
|
|
6786
|
-
var d0 =
|
|
6803
|
+
var d0 = _this38[xAxis](_this38.parseX(pointA.x.value));
|
|
6787
6804
|
|
|
6788
|
-
var d1 =
|
|
6805
|
+
var d1 = _this38[xAxis](_this38.parseX(pointB.x.value));
|
|
6789
6806
|
|
|
6790
6807
|
var mid = Math.abs(d0 - d1) / 2;
|
|
6791
6808
|
|
|
@@ -6794,7 +6811,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6794
6811
|
tooltipTitle = pointB.x.value;
|
|
6795
6812
|
|
|
6796
6813
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
6797
|
-
tooltipTitle = d3.timeFormat(
|
|
6814
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
6798
6815
|
}
|
|
6799
6816
|
|
|
6800
6817
|
if (!pointB.y.color) {
|
|
@@ -6807,7 +6824,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6807
6824
|
tooltipTitle = pointA.x.value;
|
|
6808
6825
|
|
|
6809
6826
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
6810
|
-
tooltipTitle = d3.timeFormat(
|
|
6827
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
6811
6828
|
}
|
|
6812
6829
|
|
|
6813
6830
|
if (!pointA.y.color) {
|
|
@@ -6912,7 +6929,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6912
6929
|
}, {
|
|
6913
6930
|
key: "render",
|
|
6914
6931
|
value: function render(options) {
|
|
6915
|
-
var
|
|
6932
|
+
var _this39 = this;
|
|
6916
6933
|
|
|
6917
6934
|
/* global d3 options WebsyUtils */
|
|
6918
6935
|
if (typeof options !== 'undefined') {
|
|
@@ -6981,7 +6998,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6981
6998
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
6982
6999
|
return {
|
|
6983
7000
|
value: s.label || s.key,
|
|
6984
|
-
color: s.color ||
|
|
7001
|
+
color: s.color || _this39.options.colors[i % _this39.options.colors.length]
|
|
6985
7002
|
};
|
|
6986
7003
|
});
|
|
6987
7004
|
|
|
@@ -7233,7 +7250,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7233
7250
|
|
|
7234
7251
|
if (this.options.data.bottom.formatter) {
|
|
7235
7252
|
bAxisFunc.tickFormat(function (d) {
|
|
7236
|
-
return
|
|
7253
|
+
return _this39.options.data.bottom.formatter(d);
|
|
7237
7254
|
});
|
|
7238
7255
|
}
|
|
7239
7256
|
|
|
@@ -7259,8 +7276,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7259
7276
|
|
|
7260
7277
|
if (this.options.margin.axisLeft > 0) {
|
|
7261
7278
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7262
|
-
if (
|
|
7263
|
-
d =
|
|
7279
|
+
if (_this39.options.data.left.formatter) {
|
|
7280
|
+
d = _this39.options.data.left.formatter(d);
|
|
7264
7281
|
}
|
|
7265
7282
|
|
|
7266
7283
|
return d;
|
|
@@ -7297,8 +7314,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7297
7314
|
|
|
7298
7315
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
7299
7316
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7300
|
-
if (
|
|
7301
|
-
d =
|
|
7317
|
+
if (_this39.options.data.right.formatter) {
|
|
7318
|
+
d = _this39.options.data.right.formatter(d);
|
|
7302
7319
|
}
|
|
7303
7320
|
|
|
7304
7321
|
return d;
|
|
@@ -7324,16 +7341,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7324
7341
|
|
|
7325
7342
|
this.options.data.series.forEach(function (series, index) {
|
|
7326
7343
|
if (!series.key) {
|
|
7327
|
-
series.key =
|
|
7344
|
+
series.key = _this39.createIdentity();
|
|
7328
7345
|
}
|
|
7329
7346
|
|
|
7330
7347
|
if (!series.color) {
|
|
7331
|
-
series.color =
|
|
7348
|
+
series.color = _this39.options.colors[index % _this39.options.colors.length];
|
|
7332
7349
|
}
|
|
7333
7350
|
|
|
7334
|
-
|
|
7351
|
+
_this39["render".concat(series.type || 'bar')](series, index);
|
|
7335
7352
|
|
|
7336
|
-
|
|
7353
|
+
_this39.renderLabels(series, index);
|
|
7337
7354
|
});
|
|
7338
7355
|
}
|
|
7339
7356
|
}
|
|
@@ -7341,17 +7358,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7341
7358
|
}, {
|
|
7342
7359
|
key: "renderarea",
|
|
7343
7360
|
value: function renderarea(series, index) {
|
|
7344
|
-
var
|
|
7361
|
+
var _this40 = this;
|
|
7345
7362
|
|
|
7346
7363
|
/* global d3 series index */
|
|
7347
7364
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
7348
7365
|
return d3.area().x(function (d) {
|
|
7349
|
-
return
|
|
7366
|
+
return _this40[xAxis](_this40.parseX(d.x.value));
|
|
7350
7367
|
}).y0(function (d) {
|
|
7351
|
-
return
|
|
7368
|
+
return _this40[yAxis](0);
|
|
7352
7369
|
}).y1(function (d) {
|
|
7353
|
-
return
|
|
7354
|
-
}).curve(d3[curveStyle ||
|
|
7370
|
+
return _this40[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7371
|
+
}).curve(d3[curveStyle || _this40.options.curveStyle]);
|
|
7355
7372
|
};
|
|
7356
7373
|
|
|
7357
7374
|
var xAxis = 'bottomAxis';
|
|
@@ -7467,7 +7484,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7467
7484
|
}, {
|
|
7468
7485
|
key: "renderLabels",
|
|
7469
7486
|
value: function renderLabels(series, index) {
|
|
7470
|
-
var
|
|
7487
|
+
var _this41 = this;
|
|
7471
7488
|
|
|
7472
7489
|
/* global series index d3 WebsyDesigns */
|
|
7473
7490
|
var xAxis = 'bottomAxis';
|
|
@@ -7486,7 +7503,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7486
7503
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
7487
7504
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
7488
7505
|
labels.attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
7489
|
-
return
|
|
7506
|
+
return _this41.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7490
7507
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
7491
7508
|
return d.y.label || d.y.value;
|
|
7492
7509
|
}).each(function (d, i) {
|
|
@@ -7511,7 +7528,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7511
7528
|
}
|
|
7512
7529
|
});
|
|
7513
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) {
|
|
7514
|
-
return
|
|
7531
|
+
return _this41.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7515
7532
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
7516
7533
|
return d.y.label || d.y.value;
|
|
7517
7534
|
}).each(function (d, i) {
|
|
@@ -7568,15 +7585,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7568
7585
|
}, {
|
|
7569
7586
|
key: "renderline",
|
|
7570
7587
|
value: function renderline(series, index) {
|
|
7571
|
-
var
|
|
7588
|
+
var _this42 = this;
|
|
7572
7589
|
|
|
7573
7590
|
/* global series index d3 */
|
|
7574
7591
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
7575
7592
|
return d3.line().x(function (d) {
|
|
7576
|
-
return
|
|
7593
|
+
return _this42[xAxis](_this42.parseX(d.x.value));
|
|
7577
7594
|
}).y(function (d) {
|
|
7578
|
-
return
|
|
7579
|
-
}).curve(d3[curveStyle ||
|
|
7595
|
+
return _this42[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7596
|
+
}).curve(d3[curveStyle || _this42.options.curveStyle]);
|
|
7580
7597
|
};
|
|
7581
7598
|
|
|
7582
7599
|
var xAxis = 'bottomAxis';
|
|
@@ -7614,14 +7631,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7614
7631
|
}, {
|
|
7615
7632
|
key: "rendersymbol",
|
|
7616
7633
|
value: function rendersymbol(series, index) {
|
|
7617
|
-
var
|
|
7634
|
+
var _this43 = this;
|
|
7618
7635
|
|
|
7619
7636
|
/* global d3 series index series.key */
|
|
7620
7637
|
var drawSymbol = function drawSymbol(size) {
|
|
7621
7638
|
return d3.symbol() // .type(d => {
|
|
7622
7639
|
// return d3.symbols[0]
|
|
7623
7640
|
// })
|
|
7624
|
-
.size(size ||
|
|
7641
|
+
.size(size || _this43.options.symbolSize);
|
|
7625
7642
|
};
|
|
7626
7643
|
|
|
7627
7644
|
var xAxis = 'bottomAxis';
|
|
@@ -7639,7 +7656,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7639
7656
|
symbols.attr('d', function (d) {
|
|
7640
7657
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
7641
7658
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
7642
|
-
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), ")");
|
|
7643
7660
|
}); // Enter
|
|
7644
7661
|
|
|
7645
7662
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -7648,7 +7665,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7648
7665
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
7649
7666
|
return "symbol symbol_".concat(series.key);
|
|
7650
7667
|
}).attr('transform', function (d) {
|
|
7651
|
-
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), ")");
|
|
7652
7669
|
});
|
|
7653
7670
|
}
|
|
7654
7671
|
}, {
|
|
@@ -7803,7 +7820,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
7803
7820
|
}, {
|
|
7804
7821
|
key: "resize",
|
|
7805
7822
|
value: function resize() {
|
|
7806
|
-
var
|
|
7823
|
+
var _this44 = this;
|
|
7807
7824
|
|
|
7808
7825
|
var el = document.getElementById(this.elementId);
|
|
7809
7826
|
|
|
@@ -7816,7 +7833,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
7816
7833
|
// }
|
|
7817
7834
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
7818
7835
|
html += this._data.map(function (d, i) {
|
|
7819
|
-
return
|
|
7836
|
+
return _this44.getLegendItemHTML(d);
|
|
7820
7837
|
}).join('');
|
|
7821
7838
|
html += "\n <div>\n ";
|
|
7822
7839
|
el.innerHTML = html;
|
|
@@ -7988,7 +8005,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7988
8005
|
}, {
|
|
7989
8006
|
key: "render",
|
|
7990
8007
|
value: function render() {
|
|
7991
|
-
var
|
|
8008
|
+
var _this45 = this;
|
|
7992
8009
|
|
|
7993
8010
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
7994
8011
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -7997,7 +8014,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7997
8014
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
7998
8015
|
return {
|
|
7999
8016
|
value: s.label || s.key,
|
|
8000
|
-
color: s.color ||
|
|
8017
|
+
color: s.color || _this45.options.colors[i % _this45.options.colors.length]
|
|
8001
8018
|
};
|
|
8002
8019
|
});
|
|
8003
8020
|
var longestValue = legendData.map(function (s) {
|
|
@@ -8061,7 +8078,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8061
8078
|
|
|
8062
8079
|
if (this.polygons) {
|
|
8063
8080
|
this.polygons.forEach(function (p) {
|
|
8064
|
-
return
|
|
8081
|
+
return _this45.map.removeLayer(p);
|
|
8065
8082
|
});
|
|
8066
8083
|
}
|
|
8067
8084
|
|
|
@@ -8119,18 +8136,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8119
8136
|
}
|
|
8120
8137
|
|
|
8121
8138
|
if (!p.options.color) {
|
|
8122
|
-
p.options.color =
|
|
8139
|
+
p.options.color = _this45.options.colors[i % _this45.options.colors.length];
|
|
8123
8140
|
}
|
|
8124
8141
|
|
|
8125
8142
|
var pol = L.polygon(p.data.map(function (c) {
|
|
8126
8143
|
return c.map(function (d) {
|
|
8127
8144
|
return [d.Latitude, d.Longitude];
|
|
8128
8145
|
});
|
|
8129
|
-
}), p.options).addTo(
|
|
8146
|
+
}), p.options).addTo(_this45.map);
|
|
8130
8147
|
|
|
8131
|
-
|
|
8148
|
+
_this45.polygons.push(pol);
|
|
8132
8149
|
|
|
8133
|
-
|
|
8150
|
+
_this45.map.fitBounds(pol.getBounds());
|
|
8134
8151
|
});
|
|
8135
8152
|
} // if (this.data.markers.length > 0) {
|
|
8136
8153
|
// el.classList.remove('hidden')
|