@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
package/dist/websy-designs.js
CHANGED
|
@@ -3669,6 +3669,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3669
3669
|
|
|
3670
3670
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3671
3671
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
3672
|
+
var locator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
3672
3673
|
var html = "";
|
|
3673
3674
|
|
|
3674
3675
|
if (this.options.template) {
|
|
@@ -3779,7 +3780,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3779
3780
|
parts.forEach(function (p) {
|
|
3780
3781
|
items = items[p];
|
|
3781
3782
|
});
|
|
3782
|
-
template = template.replace(m[0], _this23.buildHTML(items, 0, withoutFor));
|
|
3783
|
+
template = template.replace(m[0], _this23.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
3783
3784
|
}
|
|
3784
3785
|
});
|
|
3785
3786
|
|
|
@@ -3787,7 +3788,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3787
3788
|
|
|
3788
3789
|
tagMatches.forEach(function (m) {
|
|
3789
3790
|
if (m[0] && m.index > -1) {
|
|
3790
|
-
template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix));
|
|
3791
|
+
template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
|
|
3791
3792
|
}
|
|
3792
3793
|
});
|
|
3793
3794
|
|
|
@@ -3849,8 +3850,6 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3849
3850
|
}, {
|
|
3850
3851
|
key: "handleClick",
|
|
3851
3852
|
value: function handleClick(event) {
|
|
3852
|
-
var _this24 = this;
|
|
3853
|
-
|
|
3854
3853
|
if (event.target.classList.contains('clickable')) {
|
|
3855
3854
|
var l = event.target.getAttribute('data-event');
|
|
3856
3855
|
|
|
@@ -3858,6 +3857,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3858
3857
|
l = l.split('(');
|
|
3859
3858
|
var params = [];
|
|
3860
3859
|
var id = event.target.getAttribute('data-id');
|
|
3860
|
+
var locator = event.target.getAttribute('data-locator');
|
|
3861
3861
|
|
|
3862
3862
|
if (l[1]) {
|
|
3863
3863
|
l[1] = l[1].replace(')', '');
|
|
@@ -3865,10 +3865,27 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3865
3865
|
}
|
|
3866
3866
|
|
|
3867
3867
|
l = l[0];
|
|
3868
|
+
var data = this.rows;
|
|
3869
|
+
|
|
3870
|
+
if (locator !== '') {
|
|
3871
|
+
var locatorItems = locator.split(';');
|
|
3872
|
+
locatorItems.forEach(function (loc) {
|
|
3873
|
+
var locatorParts = loc.split(':');
|
|
3874
|
+
|
|
3875
|
+
if (data[locatorParts[0]]) {
|
|
3876
|
+
data = data[locatorParts[0]];
|
|
3877
|
+
var parts = locatorParts[1].split('.');
|
|
3878
|
+
parts.forEach(function (p) {
|
|
3879
|
+
data = data[p];
|
|
3880
|
+
});
|
|
3881
|
+
}
|
|
3882
|
+
});
|
|
3883
|
+
}
|
|
3884
|
+
|
|
3868
3885
|
params = params.map(function (p) {
|
|
3869
3886
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
3870
|
-
if (
|
|
3871
|
-
p =
|
|
3887
|
+
if (data[+id]) {
|
|
3888
|
+
p = data[+id][p];
|
|
3872
3889
|
}
|
|
3873
3890
|
} else if (typeof p === 'string') {
|
|
3874
3891
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -3882,7 +3899,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3882
3899
|
|
|
3883
3900
|
event.stopPropagation();
|
|
3884
3901
|
|
|
3885
|
-
(_this$options$listene = this.options.listeners.click[l]).call.apply(_this$options$listene, [this, event,
|
|
3902
|
+
(_this$options$listene = this.options.listeners.click[l]).call.apply(_this$options$listene, [this, event, data[+id]].concat(_toConsumableArray(params)));
|
|
3886
3903
|
}
|
|
3887
3904
|
}
|
|
3888
3905
|
}
|
|
@@ -3890,13 +3907,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3890
3907
|
}, {
|
|
3891
3908
|
key: "render",
|
|
3892
3909
|
value: function render() {
|
|
3893
|
-
var
|
|
3910
|
+
var _this24 = this;
|
|
3894
3911
|
|
|
3895
3912
|
if (this.options.entity) {
|
|
3896
3913
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3897
|
-
|
|
3914
|
+
_this24.rows = results.rows;
|
|
3898
3915
|
|
|
3899
|
-
|
|
3916
|
+
_this24.resize();
|
|
3900
3917
|
});
|
|
3901
3918
|
} else {
|
|
3902
3919
|
this.resize();
|
|
@@ -3974,14 +3991,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3974
3991
|
_createClass(WebsyRouter, [{
|
|
3975
3992
|
key: "addGroup",
|
|
3976
3993
|
value: function addGroup(group) {
|
|
3977
|
-
var
|
|
3994
|
+
var _this25 = this;
|
|
3978
3995
|
|
|
3979
3996
|
if (!this.groups[group]) {
|
|
3980
3997
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3981
3998
|
|
|
3982
3999
|
if (els) {
|
|
3983
4000
|
this.getClosestParent(els[0], function (parent) {
|
|
3984
|
-
|
|
4001
|
+
_this25.groups[group] = {
|
|
3985
4002
|
activeView: '',
|
|
3986
4003
|
views: [],
|
|
3987
4004
|
parent: parent.getAttribute('data-view')
|
|
@@ -4306,12 +4323,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4306
4323
|
}, {
|
|
4307
4324
|
key: "showComponents",
|
|
4308
4325
|
value: function showComponents(view) {
|
|
4309
|
-
var
|
|
4326
|
+
var _this26 = this;
|
|
4310
4327
|
|
|
4311
4328
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4312
4329
|
this.options.views[view].components.forEach(function (c) {
|
|
4313
4330
|
if (typeof c.instance === 'undefined') {
|
|
4314
|
-
|
|
4331
|
+
_this26.prepComponent(c.elementId, c.options);
|
|
4315
4332
|
|
|
4316
4333
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4317
4334
|
} else if (c.instance.render) {
|
|
@@ -4631,7 +4648,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
4631
4648
|
_createClass(WebsySearch, [{
|
|
4632
4649
|
key: "handleKeyUp",
|
|
4633
4650
|
value: function handleKeyUp(event) {
|
|
4634
|
-
var
|
|
4651
|
+
var _this27 = this;
|
|
4635
4652
|
|
|
4636
4653
|
if (event.target.classList.contains('websy-search-input')) {
|
|
4637
4654
|
if (this.searchTimeoutFn) {
|
|
@@ -4640,8 +4657,8 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
4640
4657
|
|
|
4641
4658
|
if (event.target.value.length >= this.options.minLength) {
|
|
4642
4659
|
this.searchTimeoutFn = setTimeout(function () {
|
|
4643
|
-
if (
|
|
4644
|
-
|
|
4660
|
+
if (_this27.options.onSearch) {
|
|
4661
|
+
_this27.options.onSearch(event.target.value);
|
|
4645
4662
|
}
|
|
4646
4663
|
}, this.options.searchTimeout);
|
|
4647
4664
|
} else {
|
|
@@ -4792,7 +4809,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4792
4809
|
|
|
4793
4810
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4794
4811
|
function WebsyTemplate(elementId, options) {
|
|
4795
|
-
var
|
|
4812
|
+
var _this28 = this;
|
|
4796
4813
|
|
|
4797
4814
|
_classCallCheck(this, WebsyTemplate);
|
|
4798
4815
|
|
|
@@ -4818,9 +4835,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4818
4835
|
|
|
4819
4836
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4820
4837
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4821
|
-
|
|
4838
|
+
_this28.options.template = templateString;
|
|
4822
4839
|
|
|
4823
|
-
|
|
4840
|
+
_this28.render();
|
|
4824
4841
|
});
|
|
4825
4842
|
} else {
|
|
4826
4843
|
this.render();
|
|
@@ -4830,7 +4847,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4830
4847
|
_createClass(WebsyTemplate, [{
|
|
4831
4848
|
key: "buildHTML",
|
|
4832
4849
|
value: function buildHTML() {
|
|
4833
|
-
var
|
|
4850
|
+
var _this29 = this;
|
|
4834
4851
|
|
|
4835
4852
|
var html = "";
|
|
4836
4853
|
|
|
@@ -4892,14 +4909,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4892
4909
|
}
|
|
4893
4910
|
|
|
4894
4911
|
if (polarity === true) {
|
|
4895
|
-
if (typeof
|
|
4912
|
+
if (typeof _this29.options.data[parts[0]] !== 'undefined' && _this29.options.data[parts[0]] === parts[1]) {
|
|
4896
4913
|
// remove the <if> tags
|
|
4897
4914
|
removeAll = false;
|
|
4898
4915
|
} else if (parts[0] === parts[1]) {
|
|
4899
4916
|
removeAll = false;
|
|
4900
4917
|
}
|
|
4901
4918
|
} else if (polarity === false) {
|
|
4902
|
-
if (typeof
|
|
4919
|
+
if (typeof _this29.options.data[parts[0]] !== 'undefined' && _this29.options.data[parts[0]] !== parts[1]) {
|
|
4903
4920
|
// remove the <if> tags
|
|
4904
4921
|
removeAll = false;
|
|
4905
4922
|
}
|
|
@@ -5189,7 +5206,7 @@ var WebsyUtils = {
|
|
|
5189
5206
|
|
|
5190
5207
|
var WebsyTable = /*#__PURE__*/function () {
|
|
5191
5208
|
function WebsyTable(elementId, options) {
|
|
5192
|
-
var
|
|
5209
|
+
var _this30 = this;
|
|
5193
5210
|
|
|
5194
5211
|
_classCallCheck(this, WebsyTable);
|
|
5195
5212
|
|
|
@@ -5227,8 +5244,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5227
5244
|
allowClear: false,
|
|
5228
5245
|
disableSearch: true,
|
|
5229
5246
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5230
|
-
if (
|
|
5231
|
-
|
|
5247
|
+
if (_this30.options.onChangePageSize) {
|
|
5248
|
+
_this30.options.onChangePageSize(selectedItem.value);
|
|
5232
5249
|
}
|
|
5233
5250
|
}
|
|
5234
5251
|
});
|
|
@@ -5249,7 +5266,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5249
5266
|
_createClass(WebsyTable, [{
|
|
5250
5267
|
key: "appendRows",
|
|
5251
5268
|
value: function appendRows(data) {
|
|
5252
|
-
var
|
|
5269
|
+
var _this31 = this;
|
|
5253
5270
|
|
|
5254
5271
|
this.hideError();
|
|
5255
5272
|
var bodyHTML = '';
|
|
@@ -5257,15 +5274,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5257
5274
|
if (data) {
|
|
5258
5275
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5259
5276
|
return '<tr>' + r.map(function (c, i) {
|
|
5260
|
-
if (
|
|
5277
|
+
if (_this31.options.columns[i].show !== false) {
|
|
5261
5278
|
var style = '';
|
|
5262
5279
|
|
|
5263
5280
|
if (c.style) {
|
|
5264
5281
|
style += c.style;
|
|
5265
5282
|
}
|
|
5266
5283
|
|
|
5267
|
-
if (
|
|
5268
|
-
style += "width: ".concat(
|
|
5284
|
+
if (_this31.options.columns[i].width) {
|
|
5285
|
+
style += "width: ".concat(_this31.options.columns[i].width, "; ");
|
|
5269
5286
|
}
|
|
5270
5287
|
|
|
5271
5288
|
if (c.backgroundColor) {
|
|
@@ -5280,18 +5297,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5280
5297
|
style += "color: ".concat(c.color, "; ");
|
|
5281
5298
|
}
|
|
5282
5299
|
|
|
5283
|
-
if (
|
|
5284
|
-
return "\n <td \n data-row-index='".concat(
|
|
5285
|
-
} else if ((
|
|
5286
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5300
|
+
if (_this31.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5301
|
+
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 ");
|
|
5302
|
+
} else if ((_this31.options.columns[i].showAsNavigatorLink === true || _this31.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5303
|
+
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 ");
|
|
5287
5304
|
} else {
|
|
5288
5305
|
var info = c.value;
|
|
5289
5306
|
|
|
5290
|
-
if (
|
|
5307
|
+
if (_this31.options.columns[i].showAsImage === true) {
|
|
5291
5308
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5292
5309
|
}
|
|
5293
5310
|
|
|
5294
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5311
|
+
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 ");
|
|
5295
5312
|
}
|
|
5296
5313
|
}
|
|
5297
5314
|
}).join('') + '</tr>';
|
|
@@ -5463,7 +5480,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5463
5480
|
}, {
|
|
5464
5481
|
key: "render",
|
|
5465
5482
|
value: function render(data) {
|
|
5466
|
-
var
|
|
5483
|
+
var _this32 = this;
|
|
5467
5484
|
|
|
5468
5485
|
if (!this.options.columns) {
|
|
5469
5486
|
return;
|
|
@@ -5498,7 +5515,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5498
5515
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5499
5516
|
}
|
|
5500
5517
|
|
|
5501
|
-
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 ?
|
|
5518
|
+
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 ? _this32.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
5502
5519
|
}
|
|
5503
5520
|
}).join('') + '</tr>';
|
|
5504
5521
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5517,7 +5534,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5517
5534
|
|
|
5518
5535
|
if (pagingEl) {
|
|
5519
5536
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5520
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5537
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this32.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5521
5538
|
});
|
|
5522
5539
|
var startIndex = 0;
|
|
5523
5540
|
|
|
@@ -5585,7 +5602,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5585
5602
|
|
|
5586
5603
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5587
5604
|
function WebsyTable2(elementId, options) {
|
|
5588
|
-
var
|
|
5605
|
+
var _this33 = this;
|
|
5589
5606
|
|
|
5590
5607
|
_classCallCheck(this, WebsyTable2);
|
|
5591
5608
|
|
|
@@ -5626,8 +5643,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5626
5643
|
allowClear: false,
|
|
5627
5644
|
disableSearch: true,
|
|
5628
5645
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5629
|
-
if (
|
|
5630
|
-
|
|
5646
|
+
if (_this33.options.onChangePageSize) {
|
|
5647
|
+
_this33.options.onChangePageSize(selectedItem.value);
|
|
5631
5648
|
}
|
|
5632
5649
|
}
|
|
5633
5650
|
});
|
|
@@ -5651,7 +5668,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5651
5668
|
_createClass(WebsyTable2, [{
|
|
5652
5669
|
key: "appendRows",
|
|
5653
5670
|
value: function appendRows(data) {
|
|
5654
|
-
var
|
|
5671
|
+
var _this34 = this;
|
|
5655
5672
|
|
|
5656
5673
|
this.hideError();
|
|
5657
5674
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -5660,15 +5677,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5660
5677
|
if (data) {
|
|
5661
5678
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5662
5679
|
return '<tr>' + r.map(function (c, i) {
|
|
5663
|
-
if (
|
|
5664
|
-
var style = "height: ".concat(
|
|
5680
|
+
if (_this34.options.columns[i].show !== false) {
|
|
5681
|
+
var style = "height: ".concat(_this34.options.cellSize, "px; line-height: ").concat(_this34.options.cellSize, "px;");
|
|
5665
5682
|
|
|
5666
5683
|
if (c.style) {
|
|
5667
5684
|
style += c.style;
|
|
5668
5685
|
}
|
|
5669
5686
|
|
|
5670
|
-
if (
|
|
5671
|
-
style += "width: ".concat(
|
|
5687
|
+
if (_this34.options.columns[i].width) {
|
|
5688
|
+
style += "width: ".concat(_this34.options.columns[i].width, "; ");
|
|
5672
5689
|
}
|
|
5673
5690
|
|
|
5674
5691
|
if (c.backgroundColor) {
|
|
@@ -5683,18 +5700,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5683
5700
|
style += "color: ".concat(c.color, "; ");
|
|
5684
5701
|
}
|
|
5685
5702
|
|
|
5686
|
-
if (
|
|
5687
|
-
return "\n <td \n data-row-index='".concat(
|
|
5688
|
-
} else if ((
|
|
5689
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5703
|
+
if (_this34.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5704
|
+
return "\n <td \n data-row-index='".concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this34.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(_this34.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this34.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5705
|
+
} else if ((_this34.options.columns[i].showAsNavigatorLink === true || _this34.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5706
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this34.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this34.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this34.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5690
5707
|
} else {
|
|
5691
5708
|
var info = c.value;
|
|
5692
5709
|
|
|
5693
|
-
if (
|
|
5710
|
+
if (_this34.options.columns[i].showAsImage === true) {
|
|
5694
5711
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5695
5712
|
}
|
|
5696
5713
|
|
|
5697
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5714
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this34.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 ");
|
|
5698
5715
|
}
|
|
5699
5716
|
}
|
|
5700
5717
|
}).join('') + '</tr>';
|
|
@@ -5957,7 +5974,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5957
5974
|
}, {
|
|
5958
5975
|
key: "render",
|
|
5959
5976
|
value: function render(data) {
|
|
5960
|
-
var
|
|
5977
|
+
var _this35 = this;
|
|
5961
5978
|
|
|
5962
5979
|
if (!this.options.columns) {
|
|
5963
5980
|
return;
|
|
@@ -5993,7 +6010,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5993
6010
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5994
6011
|
}
|
|
5995
6012
|
|
|
5996
|
-
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 ?
|
|
6013
|
+
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 ? _this35.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5997
6014
|
}
|
|
5998
6015
|
}).join('') + '</tr>';
|
|
5999
6016
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6004,7 +6021,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6004
6021
|
var dropdownHTML = "";
|
|
6005
6022
|
this.options.columns.forEach(function (c, i) {
|
|
6006
6023
|
if (c.searchable && c.searchField) {
|
|
6007
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
6024
|
+
dropdownHTML += "\n <div id=\"".concat(_this35.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
6008
6025
|
}
|
|
6009
6026
|
});
|
|
6010
6027
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -6026,7 +6043,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6026
6043
|
|
|
6027
6044
|
if (pagingEl) {
|
|
6028
6045
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6029
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6046
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this35.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6030
6047
|
});
|
|
6031
6048
|
var startIndex = 0;
|
|
6032
6049
|
|
|
@@ -6117,7 +6134,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6117
6134
|
}, {
|
|
6118
6135
|
key: "getColumnParameters",
|
|
6119
6136
|
value: function getColumnParameters(values) {
|
|
6120
|
-
var
|
|
6137
|
+
var _this36 = this;
|
|
6121
6138
|
|
|
6122
6139
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6123
6140
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -6125,10 +6142,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6125
6142
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6126
6143
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6127
6144
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
6128
|
-
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 ?
|
|
6145
|
+
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 ? _this36.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6129
6146
|
}).join('') + '</tr>';
|
|
6130
6147
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6131
|
-
return "\n <td \n style='height: ".concat(
|
|
6148
|
+
return "\n <td \n style='height: ".concat(_this36.options.cellSize, "px; line-height: ").concat(_this36.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
6132
6149
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
6133
6150
|
|
|
6134
6151
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -6319,7 +6336,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6319
6336
|
}, {
|
|
6320
6337
|
key: "buildHeaderHtml",
|
|
6321
6338
|
value: function buildHeaderHtml() {
|
|
6322
|
-
var
|
|
6339
|
+
var _this37 = this;
|
|
6323
6340
|
|
|
6324
6341
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6325
6342
|
var headerHtml = '';
|
|
@@ -6334,7 +6351,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6334
6351
|
}
|
|
6335
6352
|
|
|
6336
6353
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6337
|
-
if (useWidths === false && rowIndex !==
|
|
6354
|
+
if (useWidths === false && rowIndex !== _this37.options.columns.length - 1) {
|
|
6338
6355
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6339
6356
|
return;
|
|
6340
6357
|
}
|
|
@@ -6348,18 +6365,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6348
6365
|
// `
|
|
6349
6366
|
// }
|
|
6350
6367
|
|
|
6351
|
-
headerHtml += " \n >\n <div>\n ".concat(col.name, "\n ").concat(col.searchable === true ?
|
|
6368
|
+
headerHtml += " \n >\n <div>\n ".concat(col.name, "\n ").concat(col.searchable === true ? _this37.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
|
|
6352
6369
|
});
|
|
6353
6370
|
headerHtml += "</tr>";
|
|
6354
6371
|
});
|
|
6355
6372
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6356
6373
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6357
6374
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6358
|
-
var testEl = document.getElementById("".concat(
|
|
6375
|
+
var testEl = document.getElementById("".concat(_this37.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6359
6376
|
|
|
6360
6377
|
if (!testEl) {
|
|
6361
6378
|
var newE = document.createElement('div');
|
|
6362
|
-
newE.id = "".concat(
|
|
6379
|
+
newE.id = "".concat(_this37.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6363
6380
|
newE.className = 'websy-modal-dropdown';
|
|
6364
6381
|
dropdownEl.appendChild(newE);
|
|
6365
6382
|
}
|
|
@@ -6375,7 +6392,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6375
6392
|
}, {
|
|
6376
6393
|
key: "buildTotalHtml",
|
|
6377
6394
|
value: function buildTotalHtml() {
|
|
6378
|
-
var
|
|
6395
|
+
var _this38 = this;
|
|
6379
6396
|
|
|
6380
6397
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6381
6398
|
|
|
@@ -6388,7 +6405,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6388
6405
|
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6389
6406
|
|
|
6390
6407
|
if (useWidths === true) {
|
|
6391
|
-
totalHtml += "\n style='width: ".concat(
|
|
6408
|
+
totalHtml += "\n style='width: ".concat(_this38.options.columns[_this38.options.columns.length - 1][colIndex].width || _this38.options.columns[_this38.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6392
6409
|
}
|
|
6393
6410
|
|
|
6394
6411
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -6399,7 +6416,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6399
6416
|
}, {
|
|
6400
6417
|
key: "calculateSizes",
|
|
6401
6418
|
value: function calculateSizes() {
|
|
6402
|
-
var
|
|
6419
|
+
var _this39 = this;
|
|
6403
6420
|
|
|
6404
6421
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6405
6422
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -6441,28 +6458,28 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6441
6458
|
rows.forEach(function (row, rowIndex) {
|
|
6442
6459
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6443
6460
|
var colSize = col.getBoundingClientRect();
|
|
6444
|
-
|
|
6461
|
+
_this39.sizes.cellHeight = colSize.height;
|
|
6445
6462
|
|
|
6446
|
-
if (
|
|
6447
|
-
if (!
|
|
6448
|
-
|
|
6463
|
+
if (_this39.options.columns[_this39.options.columns.length - 1][colIndex]) {
|
|
6464
|
+
if (!_this39.options.columns[_this39.options.columns.length - 1][colIndex].actualWidth) {
|
|
6465
|
+
_this39.options.columns[_this39.options.columns.length - 1][colIndex].actualWidth = 0;
|
|
6449
6466
|
}
|
|
6450
6467
|
|
|
6451
|
-
|
|
6452
|
-
|
|
6468
|
+
_this39.options.columns[_this39.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this39.options.columns[_this39.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
|
|
6469
|
+
_this39.options.columns[_this39.options.columns.length - 1][colIndex].cellHeight = colSize.height;
|
|
6453
6470
|
}
|
|
6454
6471
|
});
|
|
6455
6472
|
});
|
|
6456
6473
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6457
|
-
if (colIndex <
|
|
6458
|
-
|
|
6474
|
+
if (colIndex < _this39.pinnedColumns) {
|
|
6475
|
+
_this39.sizes.scrollableWidth -= col.actualWidth;
|
|
6459
6476
|
}
|
|
6460
6477
|
});
|
|
6461
6478
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6462
6479
|
return a + (b.width || b.actualWidth);
|
|
6463
6480
|
}, 0);
|
|
6464
6481
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6465
|
-
return i >=
|
|
6482
|
+
return i >= _this39.pinnedColumns;
|
|
6466
6483
|
}).reduce(function (a, b) {
|
|
6467
6484
|
return a + (b.width || b.actualWidth);
|
|
6468
6485
|
}, 0);
|
|
@@ -6480,13 +6497,13 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6480
6497
|
}
|
|
6481
6498
|
}
|
|
6482
6499
|
|
|
6483
|
-
|
|
6500
|
+
_this39.sizes.totalWidth += c.width || c.actualWidth;
|
|
6484
6501
|
|
|
6485
|
-
if (i <
|
|
6486
|
-
|
|
6502
|
+
if (i < _this39.pinnedColumns) {
|
|
6503
|
+
_this39.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6487
6504
|
}
|
|
6488
6505
|
|
|
6489
|
-
equalWidth = (outerSize.width -
|
|
6506
|
+
equalWidth = (outerSize.width - _this39.sizes.totalWidth) / (_this39.options.columns[_this39.options.columns.length - 1].length - (i + 1));
|
|
6490
6507
|
});
|
|
6491
6508
|
} // take the height of the last cell as the official height for data cells
|
|
6492
6509
|
// this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
|
|
@@ -6915,7 +6932,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6915
6932
|
|
|
6916
6933
|
var WebsyChart = /*#__PURE__*/function () {
|
|
6917
6934
|
function WebsyChart(elementId, options) {
|
|
6918
|
-
var
|
|
6935
|
+
var _this40 = this;
|
|
6919
6936
|
|
|
6920
6937
|
_classCallCheck(this, WebsyChart);
|
|
6921
6938
|
|
|
@@ -6964,22 +6981,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6964
6981
|
this.invertOverride = function (input, input2) {
|
|
6965
6982
|
var xAxis = 'bottomAxis';
|
|
6966
6983
|
|
|
6967
|
-
if (
|
|
6984
|
+
if (_this40.options.orientation === 'horizontal') {
|
|
6968
6985
|
xAxis = 'leftAxis';
|
|
6969
6986
|
}
|
|
6970
6987
|
|
|
6971
|
-
var width =
|
|
6988
|
+
var width = _this40[xAxis].step();
|
|
6972
6989
|
|
|
6973
6990
|
var output;
|
|
6974
6991
|
|
|
6975
|
-
var domain = _toConsumableArray(
|
|
6992
|
+
var domain = _toConsumableArray(_this40[xAxis].domain());
|
|
6976
6993
|
|
|
6977
|
-
if (
|
|
6994
|
+
if (_this40.options.orientation === 'horizontal') {
|
|
6978
6995
|
domain = domain.reverse();
|
|
6979
6996
|
}
|
|
6980
6997
|
|
|
6981
6998
|
for (var j = 0; j < domain.length; j++) {
|
|
6982
|
-
var breakA =
|
|
6999
|
+
var breakA = _this40[xAxis](domain[j]) - width / 2;
|
|
6983
7000
|
var breakB = breakA + width;
|
|
6984
7001
|
|
|
6985
7002
|
if (input > breakA && input <= breakB) {
|
|
@@ -7079,10 +7096,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7079
7096
|
}, {
|
|
7080
7097
|
key: "handleEventMouseMove",
|
|
7081
7098
|
value: function handleEventMouseMove(event, d) {
|
|
7082
|
-
var
|
|
7099
|
+
var _this41 = this;
|
|
7083
7100
|
|
|
7084
7101
|
var bisectDate = d3.bisector(function (d) {
|
|
7085
|
-
return
|
|
7102
|
+
return _this41.parseX(d.x.value);
|
|
7086
7103
|
}).left;
|
|
7087
7104
|
|
|
7088
7105
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7121,8 +7138,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7121
7138
|
}
|
|
7122
7139
|
|
|
7123
7140
|
this.options.data.series.forEach(function (s) {
|
|
7124
|
-
if (
|
|
7125
|
-
xPoint =
|
|
7141
|
+
if (_this41.options.data[xData].scale !== 'Time') {
|
|
7142
|
+
xPoint = _this41[xAxis](_this41.parseX(xLabel));
|
|
7126
7143
|
s.data.forEach(function (d) {
|
|
7127
7144
|
if (d.x.value === xLabel) {
|
|
7128
7145
|
if (!tooltipTitle) {
|
|
@@ -7141,13 +7158,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7141
7158
|
var pointA = s.data[index - 1];
|
|
7142
7159
|
var pointB = s.data[index];
|
|
7143
7160
|
|
|
7144
|
-
if (
|
|
7161
|
+
if (_this41.options.orientation === 'horizontal') {
|
|
7145
7162
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7146
7163
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7147
7164
|
}
|
|
7148
7165
|
|
|
7149
7166
|
if (pointA && !pointB) {
|
|
7150
|
-
xPoint =
|
|
7167
|
+
xPoint = _this41[xAxis](_this41.parseX(pointA.x.value));
|
|
7151
7168
|
tooltipTitle = pointA.x.value;
|
|
7152
7169
|
|
|
7153
7170
|
if (!pointA.y.color) {
|
|
@@ -7157,12 +7174,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7157
7174
|
tooltipData.push(pointA.y);
|
|
7158
7175
|
|
|
7159
7176
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7160
|
-
tooltipTitle = d3.timeFormat(
|
|
7177
|
+
tooltipTitle = d3.timeFormat(_this41.options.dateFormat || _this41.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7161
7178
|
}
|
|
7162
7179
|
}
|
|
7163
7180
|
|
|
7164
7181
|
if (pointB && !pointA) {
|
|
7165
|
-
xPoint =
|
|
7182
|
+
xPoint = _this41[xAxis](_this41.parseX(pointB.x.value));
|
|
7166
7183
|
tooltipTitle = pointB.x.value;
|
|
7167
7184
|
|
|
7168
7185
|
if (!pointB.y.color) {
|
|
@@ -7172,14 +7189,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7172
7189
|
tooltipData.push(pointB.y);
|
|
7173
7190
|
|
|
7174
7191
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7175
|
-
tooltipTitle = d3.timeFormat(
|
|
7192
|
+
tooltipTitle = d3.timeFormat(_this41.options.dateFormat || _this41.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7176
7193
|
}
|
|
7177
7194
|
}
|
|
7178
7195
|
|
|
7179
7196
|
if (pointA && pointB) {
|
|
7180
|
-
var d0 =
|
|
7197
|
+
var d0 = _this41[xAxis](_this41.parseX(pointA.x.value));
|
|
7181
7198
|
|
|
7182
|
-
var d1 =
|
|
7199
|
+
var d1 = _this41[xAxis](_this41.parseX(pointB.x.value));
|
|
7183
7200
|
|
|
7184
7201
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7185
7202
|
|
|
@@ -7188,7 +7205,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7188
7205
|
tooltipTitle = pointB.x.value;
|
|
7189
7206
|
|
|
7190
7207
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7191
|
-
tooltipTitle = d3.timeFormat(
|
|
7208
|
+
tooltipTitle = d3.timeFormat(_this41.options.dateFormat || _this41.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7192
7209
|
}
|
|
7193
7210
|
|
|
7194
7211
|
if (!pointB.y.color) {
|
|
@@ -7201,7 +7218,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7201
7218
|
tooltipTitle = pointA.x.value;
|
|
7202
7219
|
|
|
7203
7220
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7204
|
-
tooltipTitle = d3.timeFormat(
|
|
7221
|
+
tooltipTitle = d3.timeFormat(_this41.options.dateFormat || _this41.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7205
7222
|
}
|
|
7206
7223
|
|
|
7207
7224
|
if (!pointA.y.color) {
|
|
@@ -7306,7 +7323,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7306
7323
|
}, {
|
|
7307
7324
|
key: "render",
|
|
7308
7325
|
value: function render(options) {
|
|
7309
|
-
var
|
|
7326
|
+
var _this42 = this;
|
|
7310
7327
|
|
|
7311
7328
|
/* global d3 options WebsyUtils */
|
|
7312
7329
|
if (typeof options !== 'undefined') {
|
|
@@ -7375,7 +7392,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7375
7392
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
7376
7393
|
return {
|
|
7377
7394
|
value: s.label || s.key,
|
|
7378
|
-
color: s.color ||
|
|
7395
|
+
color: s.color || _this42.options.colors[i % _this42.options.colors.length]
|
|
7379
7396
|
};
|
|
7380
7397
|
});
|
|
7381
7398
|
|
|
@@ -7627,7 +7644,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7627
7644
|
|
|
7628
7645
|
if (this.options.data.bottom.formatter) {
|
|
7629
7646
|
bAxisFunc.tickFormat(function (d) {
|
|
7630
|
-
return
|
|
7647
|
+
return _this42.options.data.bottom.formatter(d);
|
|
7631
7648
|
});
|
|
7632
7649
|
}
|
|
7633
7650
|
|
|
@@ -7653,8 +7670,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7653
7670
|
|
|
7654
7671
|
if (this.options.margin.axisLeft > 0) {
|
|
7655
7672
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7656
|
-
if (
|
|
7657
|
-
d =
|
|
7673
|
+
if (_this42.options.data.left.formatter) {
|
|
7674
|
+
d = _this42.options.data.left.formatter(d);
|
|
7658
7675
|
}
|
|
7659
7676
|
|
|
7660
7677
|
return d;
|
|
@@ -7691,8 +7708,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7691
7708
|
|
|
7692
7709
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
7693
7710
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7694
|
-
if (
|
|
7695
|
-
d =
|
|
7711
|
+
if (_this42.options.data.right.formatter) {
|
|
7712
|
+
d = _this42.options.data.right.formatter(d);
|
|
7696
7713
|
}
|
|
7697
7714
|
|
|
7698
7715
|
return d;
|
|
@@ -7718,16 +7735,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7718
7735
|
|
|
7719
7736
|
this.options.data.series.forEach(function (series, index) {
|
|
7720
7737
|
if (!series.key) {
|
|
7721
|
-
series.key =
|
|
7738
|
+
series.key = _this42.createIdentity();
|
|
7722
7739
|
}
|
|
7723
7740
|
|
|
7724
7741
|
if (!series.color) {
|
|
7725
|
-
series.color =
|
|
7742
|
+
series.color = _this42.options.colors[index % _this42.options.colors.length];
|
|
7726
7743
|
}
|
|
7727
7744
|
|
|
7728
|
-
|
|
7745
|
+
_this42["render".concat(series.type || 'bar')](series, index);
|
|
7729
7746
|
|
|
7730
|
-
|
|
7747
|
+
_this42.renderLabels(series, index);
|
|
7731
7748
|
});
|
|
7732
7749
|
}
|
|
7733
7750
|
}
|
|
@@ -7735,17 +7752,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7735
7752
|
}, {
|
|
7736
7753
|
key: "renderarea",
|
|
7737
7754
|
value: function renderarea(series, index) {
|
|
7738
|
-
var
|
|
7755
|
+
var _this43 = this;
|
|
7739
7756
|
|
|
7740
7757
|
/* global d3 series index */
|
|
7741
7758
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
7742
7759
|
return d3.area().x(function (d) {
|
|
7743
|
-
return
|
|
7760
|
+
return _this43[xAxis](_this43.parseX(d.x.value));
|
|
7744
7761
|
}).y0(function (d) {
|
|
7745
|
-
return
|
|
7762
|
+
return _this43[yAxis](0);
|
|
7746
7763
|
}).y1(function (d) {
|
|
7747
|
-
return
|
|
7748
|
-
}).curve(d3[curveStyle ||
|
|
7764
|
+
return _this43[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7765
|
+
}).curve(d3[curveStyle || _this43.options.curveStyle]);
|
|
7749
7766
|
};
|
|
7750
7767
|
|
|
7751
7768
|
var xAxis = 'bottomAxis';
|
|
@@ -7861,7 +7878,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7861
7878
|
}, {
|
|
7862
7879
|
key: "renderLabels",
|
|
7863
7880
|
value: function renderLabels(series, index) {
|
|
7864
|
-
var
|
|
7881
|
+
var _this44 = this;
|
|
7865
7882
|
|
|
7866
7883
|
/* global series index d3 WebsyDesigns */
|
|
7867
7884
|
var xAxis = 'bottomAxis';
|
|
@@ -7880,7 +7897,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7880
7897
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
7881
7898
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
7882
7899
|
labels.attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
7883
|
-
return
|
|
7900
|
+
return _this44.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7884
7901
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
7885
7902
|
return d.y.label || d.y.value;
|
|
7886
7903
|
}).each(function (d, i) {
|
|
@@ -7905,7 +7922,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7905
7922
|
}
|
|
7906
7923
|
});
|
|
7907
7924
|
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) {
|
|
7908
|
-
return
|
|
7925
|
+
return _this44.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7909
7926
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
7910
7927
|
return d.y.label || d.y.value;
|
|
7911
7928
|
}).each(function (d, i) {
|
|
@@ -7962,15 +7979,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7962
7979
|
}, {
|
|
7963
7980
|
key: "renderline",
|
|
7964
7981
|
value: function renderline(series, index) {
|
|
7965
|
-
var
|
|
7982
|
+
var _this45 = this;
|
|
7966
7983
|
|
|
7967
7984
|
/* global series index d3 */
|
|
7968
7985
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
7969
7986
|
return d3.line().x(function (d) {
|
|
7970
|
-
return
|
|
7987
|
+
return _this45[xAxis](_this45.parseX(d.x.value));
|
|
7971
7988
|
}).y(function (d) {
|
|
7972
|
-
return
|
|
7973
|
-
}).curve(d3[curveStyle ||
|
|
7989
|
+
return _this45[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7990
|
+
}).curve(d3[curveStyle || _this45.options.curveStyle]);
|
|
7974
7991
|
};
|
|
7975
7992
|
|
|
7976
7993
|
var xAxis = 'bottomAxis';
|
|
@@ -8008,14 +8025,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8008
8025
|
}, {
|
|
8009
8026
|
key: "rendersymbol",
|
|
8010
8027
|
value: function rendersymbol(series, index) {
|
|
8011
|
-
var
|
|
8028
|
+
var _this46 = this;
|
|
8012
8029
|
|
|
8013
8030
|
/* global d3 series index series.key */
|
|
8014
8031
|
var drawSymbol = function drawSymbol(size) {
|
|
8015
8032
|
return d3.symbol() // .type(d => {
|
|
8016
8033
|
// return d3.symbols[0]
|
|
8017
8034
|
// })
|
|
8018
|
-
.size(size ||
|
|
8035
|
+
.size(size || _this46.options.symbolSize);
|
|
8019
8036
|
};
|
|
8020
8037
|
|
|
8021
8038
|
var xAxis = 'bottomAxis';
|
|
@@ -8033,7 +8050,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8033
8050
|
symbols.attr('d', function (d) {
|
|
8034
8051
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
8035
8052
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
8036
|
-
return "translate(".concat(
|
|
8053
|
+
return "translate(".concat(_this46[xAxis](_this46.parseX(d.x.value)), ", ").concat(_this46[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8037
8054
|
}); // Enter
|
|
8038
8055
|
|
|
8039
8056
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -8042,7 +8059,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8042
8059
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
8043
8060
|
return "symbol symbol_".concat(series.key);
|
|
8044
8061
|
}).attr('transform', function (d) {
|
|
8045
|
-
return "translate(".concat(
|
|
8062
|
+
return "translate(".concat(_this46[xAxis](_this46.parseX(d.x.value)), ", ").concat(_this46[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8046
8063
|
});
|
|
8047
8064
|
}
|
|
8048
8065
|
}, {
|
|
@@ -8197,7 +8214,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8197
8214
|
}, {
|
|
8198
8215
|
key: "resize",
|
|
8199
8216
|
value: function resize() {
|
|
8200
|
-
var
|
|
8217
|
+
var _this47 = this;
|
|
8201
8218
|
|
|
8202
8219
|
var el = document.getElementById(this.elementId);
|
|
8203
8220
|
|
|
@@ -8210,7 +8227,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8210
8227
|
// }
|
|
8211
8228
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
8212
8229
|
html += this._data.map(function (d, i) {
|
|
8213
|
-
return
|
|
8230
|
+
return _this47.getLegendItemHTML(d);
|
|
8214
8231
|
}).join('');
|
|
8215
8232
|
html += "\n <div>\n ";
|
|
8216
8233
|
el.innerHTML = html;
|
|
@@ -8382,7 +8399,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8382
8399
|
}, {
|
|
8383
8400
|
key: "render",
|
|
8384
8401
|
value: function render() {
|
|
8385
|
-
var
|
|
8402
|
+
var _this48 = this;
|
|
8386
8403
|
|
|
8387
8404
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
8388
8405
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -8391,7 +8408,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8391
8408
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
8392
8409
|
return {
|
|
8393
8410
|
value: s.label || s.key,
|
|
8394
|
-
color: s.color ||
|
|
8411
|
+
color: s.color || _this48.options.colors[i % _this48.options.colors.length]
|
|
8395
8412
|
};
|
|
8396
8413
|
});
|
|
8397
8414
|
var longestValue = legendData.map(function (s) {
|
|
@@ -8455,7 +8472,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8455
8472
|
|
|
8456
8473
|
if (this.polygons) {
|
|
8457
8474
|
this.polygons.forEach(function (p) {
|
|
8458
|
-
return
|
|
8475
|
+
return _this48.map.removeLayer(p);
|
|
8459
8476
|
});
|
|
8460
8477
|
}
|
|
8461
8478
|
|
|
@@ -8513,18 +8530,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8513
8530
|
}
|
|
8514
8531
|
|
|
8515
8532
|
if (!p.options.color) {
|
|
8516
|
-
p.options.color =
|
|
8533
|
+
p.options.color = _this48.options.colors[i % _this48.options.colors.length];
|
|
8517
8534
|
}
|
|
8518
8535
|
|
|
8519
8536
|
var pol = L.polygon(p.data.map(function (c) {
|
|
8520
8537
|
return c.map(function (d) {
|
|
8521
8538
|
return [d.Latitude, d.Longitude];
|
|
8522
8539
|
});
|
|
8523
|
-
}), p.options).addTo(
|
|
8540
|
+
}), p.options).addTo(_this48.map);
|
|
8524
8541
|
|
|
8525
|
-
|
|
8542
|
+
_this48.polygons.push(pol);
|
|
8526
8543
|
|
|
8527
|
-
|
|
8544
|
+
_this48.map.fitBounds(pol.getBounds());
|
|
8528
8545
|
});
|
|
8529
8546
|
} // if (this.data.markers.length > 0) {
|
|
8530
8547
|
// el.classList.remove('hidden')
|