@websy/websy-designs 1.3.2 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/routes/v1/shop.js +2 -1
- package/dist/websy-designs-es6.debug.js +71 -10
- package/dist/websy-designs-es6.js +211 -137
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +72 -11
- package/dist/websy-designs.js +215 -141
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
package/dist/websy-designs.js
CHANGED
|
@@ -3628,6 +3628,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3628
3628
|
this.rows = [];
|
|
3629
3629
|
this.apiService = new WebsyDesigns.APIService('/api');
|
|
3630
3630
|
this.templateService = new WebsyDesigns.APIService('');
|
|
3631
|
+
this.activeTemplate = '';
|
|
3631
3632
|
|
|
3632
3633
|
if (!elementId) {
|
|
3633
3634
|
console.log('No element Id provided for Websy Search List');
|
|
@@ -3656,6 +3657,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3656
3657
|
value: function appendData(d) {
|
|
3657
3658
|
var startIndex = this.rows.length;
|
|
3658
3659
|
this.rows = this.rows.concat(d);
|
|
3660
|
+
this.activeTemplate = this.options.template;
|
|
3659
3661
|
var html = this.buildHTML(d, startIndex);
|
|
3660
3662
|
var el = document.getElementById(this.elementId);
|
|
3661
3663
|
el.innerHTML += html.replace(/\n/g, '');
|
|
@@ -3666,12 +3668,14 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3666
3668
|
var _this23 = this;
|
|
3667
3669
|
|
|
3668
3670
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3671
|
+
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
3672
|
+
var locator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
3669
3673
|
var html = "";
|
|
3670
3674
|
|
|
3671
3675
|
if (this.options.template) {
|
|
3672
3676
|
if (d.length > 0) {
|
|
3673
3677
|
d.forEach(function (row, ix) {
|
|
3674
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(_this23.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3678
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this23.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3675
3679
|
|
|
3676
3680
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3677
3681
|
|
|
@@ -3755,19 +3759,47 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3755
3759
|
}
|
|
3756
3760
|
});
|
|
3757
3761
|
|
|
3762
|
+
var forMatches = _toConsumableArray(template.matchAll(/<\s*for[^>]*>([\s\S]*?)<\s*\/\s*for>/g));
|
|
3763
|
+
|
|
3764
|
+
forMatches.forEach(function (m) {
|
|
3765
|
+
var itemsMatch = m[0].match(/(items=["|']\w.+)["|']/g);
|
|
3766
|
+
var forMarkup = m[0].match(/<\s*for[^>]*>/);
|
|
3767
|
+
var withoutFor = m[0].replace(forMarkup, '').replace('</for>', '').replace(/<\s*for[^>]*>/g, '');
|
|
3768
|
+
|
|
3769
|
+
if (itemsMatch && itemsMatch[0]) {
|
|
3770
|
+
var c = itemsMatch[0].trim().replace('items=', '');
|
|
3771
|
+
|
|
3772
|
+
if (c.split('')[0] === '"') {
|
|
3773
|
+
c = c.replace(/"/g, '');
|
|
3774
|
+
} else if (c.split('')[0] === '\'') {
|
|
3775
|
+
c = c.replace(/'/g, '');
|
|
3776
|
+
}
|
|
3777
|
+
|
|
3778
|
+
var items = row;
|
|
3779
|
+
var parts = c.split('.');
|
|
3780
|
+
parts.forEach(function (p) {
|
|
3781
|
+
items = items[p];
|
|
3782
|
+
});
|
|
3783
|
+
template = template.replace(m[0], _this23.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
3784
|
+
}
|
|
3785
|
+
});
|
|
3786
|
+
|
|
3758
3787
|
var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
|
|
3759
3788
|
|
|
3760
3789
|
tagMatches.forEach(function (m) {
|
|
3761
3790
|
if (m[0] && m.index > -1) {
|
|
3762
|
-
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(';'), "'"));
|
|
3763
3792
|
}
|
|
3764
3793
|
});
|
|
3765
3794
|
|
|
3766
|
-
|
|
3795
|
+
var flatRow = _this23.flattenObject(row);
|
|
3796
|
+
|
|
3797
|
+
for (var key in flatRow) {
|
|
3767
3798
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
3768
|
-
template = template.replace(rg,
|
|
3799
|
+
template = template.replace(rg, flatRow[key] || '');
|
|
3769
3800
|
}
|
|
3770
3801
|
|
|
3802
|
+
template = template.replace(/\{(.*?)\}/g, '');
|
|
3771
3803
|
html += template;
|
|
3772
3804
|
});
|
|
3773
3805
|
} else if (this.options.noRowsHTML) {
|
|
@@ -3788,11 +3820,36 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3788
3820
|
|
|
3789
3821
|
return null;
|
|
3790
3822
|
}
|
|
3823
|
+
}, {
|
|
3824
|
+
key: "flattenObject",
|
|
3825
|
+
value: function flattenObject(obj) {
|
|
3826
|
+
var toReturn = {};
|
|
3827
|
+
|
|
3828
|
+
for (var i in obj) {
|
|
3829
|
+
if (!obj.hasOwnProperty(i)) {
|
|
3830
|
+
continue;
|
|
3831
|
+
}
|
|
3832
|
+
|
|
3833
|
+
if (_typeof(obj[i]) === 'object') {
|
|
3834
|
+
var flatObject = this.flattenObject(obj[i]);
|
|
3835
|
+
|
|
3836
|
+
for (var x in flatObject) {
|
|
3837
|
+
if (!flatObject.hasOwnProperty(x)) {
|
|
3838
|
+
continue;
|
|
3839
|
+
}
|
|
3840
|
+
|
|
3841
|
+
toReturn[i + '.' + x] = flatObject[x];
|
|
3842
|
+
}
|
|
3843
|
+
} else {
|
|
3844
|
+
toReturn[i] = obj[i];
|
|
3845
|
+
}
|
|
3846
|
+
}
|
|
3847
|
+
|
|
3848
|
+
return JSON.parse(JSON.stringify(toReturn));
|
|
3849
|
+
}
|
|
3791
3850
|
}, {
|
|
3792
3851
|
key: "handleClick",
|
|
3793
3852
|
value: function handleClick(event) {
|
|
3794
|
-
var _this24 = this;
|
|
3795
|
-
|
|
3796
3853
|
if (event.target.classList.contains('clickable')) {
|
|
3797
3854
|
var l = event.target.getAttribute('data-event');
|
|
3798
3855
|
|
|
@@ -3800,6 +3857,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3800
3857
|
l = l.split('(');
|
|
3801
3858
|
var params = [];
|
|
3802
3859
|
var id = event.target.getAttribute('data-id');
|
|
3860
|
+
var locator = event.target.getAttribute('data-locator');
|
|
3803
3861
|
|
|
3804
3862
|
if (l[1]) {
|
|
3805
3863
|
l[1] = l[1].replace(')', '');
|
|
@@ -3807,10 +3865,27 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3807
3865
|
}
|
|
3808
3866
|
|
|
3809
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
|
+
|
|
3810
3885
|
params = params.map(function (p) {
|
|
3811
3886
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
3812
|
-
if (
|
|
3813
|
-
p =
|
|
3887
|
+
if (data[+id]) {
|
|
3888
|
+
p = data[+id][p];
|
|
3814
3889
|
}
|
|
3815
3890
|
} else if (typeof p === 'string') {
|
|
3816
3891
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -3824,7 +3899,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3824
3899
|
|
|
3825
3900
|
event.stopPropagation();
|
|
3826
3901
|
|
|
3827
|
-
(_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)));
|
|
3828
3903
|
}
|
|
3829
3904
|
}
|
|
3830
3905
|
}
|
|
@@ -3832,13 +3907,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3832
3907
|
}, {
|
|
3833
3908
|
key: "render",
|
|
3834
3909
|
value: function render() {
|
|
3835
|
-
var
|
|
3910
|
+
var _this24 = this;
|
|
3836
3911
|
|
|
3837
3912
|
if (this.options.entity) {
|
|
3838
3913
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3839
|
-
|
|
3914
|
+
_this24.rows = results.rows;
|
|
3840
3915
|
|
|
3841
|
-
|
|
3916
|
+
_this24.resize();
|
|
3842
3917
|
});
|
|
3843
3918
|
} else {
|
|
3844
3919
|
this.resize();
|
|
@@ -3909,22 +3984,21 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3909
3984
|
|
|
3910
3985
|
if (this.options.onHide) {
|
|
3911
3986
|
this.on('hide', this.options.onHide);
|
|
3912
|
-
}
|
|
3987
|
+
} // this.init()
|
|
3913
3988
|
|
|
3914
|
-
this.init();
|
|
3915
3989
|
}
|
|
3916
3990
|
|
|
3917
3991
|
_createClass(WebsyRouter, [{
|
|
3918
3992
|
key: "addGroup",
|
|
3919
3993
|
value: function addGroup(group) {
|
|
3920
|
-
var
|
|
3994
|
+
var _this25 = this;
|
|
3921
3995
|
|
|
3922
3996
|
if (!this.groups[group]) {
|
|
3923
3997
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3924
3998
|
|
|
3925
3999
|
if (els) {
|
|
3926
4000
|
this.getClosestParent(els[0], function (parent) {
|
|
3927
|
-
|
|
4001
|
+
_this25.groups[group] = {
|
|
3928
4002
|
activeView: '',
|
|
3929
4003
|
views: [],
|
|
3930
4004
|
parent: parent.getAttribute('data-view')
|
|
@@ -4249,12 +4323,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4249
4323
|
}, {
|
|
4250
4324
|
key: "showComponents",
|
|
4251
4325
|
value: function showComponents(view) {
|
|
4252
|
-
var
|
|
4326
|
+
var _this26 = this;
|
|
4253
4327
|
|
|
4254
4328
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4255
4329
|
this.options.views[view].components.forEach(function (c) {
|
|
4256
4330
|
if (typeof c.instance === 'undefined') {
|
|
4257
|
-
|
|
4331
|
+
_this26.prepComponent(c.elementId, c.options);
|
|
4258
4332
|
|
|
4259
4333
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4260
4334
|
} else if (c.instance.render) {
|
|
@@ -4574,7 +4648,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
4574
4648
|
_createClass(WebsySearch, [{
|
|
4575
4649
|
key: "handleKeyUp",
|
|
4576
4650
|
value: function handleKeyUp(event) {
|
|
4577
|
-
var
|
|
4651
|
+
var _this27 = this;
|
|
4578
4652
|
|
|
4579
4653
|
if (event.target.classList.contains('websy-search-input')) {
|
|
4580
4654
|
if (this.searchTimeoutFn) {
|
|
@@ -4583,12 +4657,12 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
4583
4657
|
|
|
4584
4658
|
if (event.target.value.length >= this.options.minLength) {
|
|
4585
4659
|
this.searchTimeoutFn = setTimeout(function () {
|
|
4586
|
-
if (
|
|
4587
|
-
|
|
4660
|
+
if (_this27.options.onSearch) {
|
|
4661
|
+
_this27.options.onSearch(event.target.value);
|
|
4588
4662
|
}
|
|
4589
4663
|
}, this.options.searchTimeout);
|
|
4590
4664
|
} else {
|
|
4591
|
-
if (this.options.onSearch) {
|
|
4665
|
+
if (this.options.onSearch && (event.key === 'Delete' || event.key === 'Backspace')) {
|
|
4592
4666
|
this.options.onSearch('');
|
|
4593
4667
|
}
|
|
4594
4668
|
}
|
|
@@ -4735,7 +4809,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4735
4809
|
|
|
4736
4810
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4737
4811
|
function WebsyTemplate(elementId, options) {
|
|
4738
|
-
var
|
|
4812
|
+
var _this28 = this;
|
|
4739
4813
|
|
|
4740
4814
|
_classCallCheck(this, WebsyTemplate);
|
|
4741
4815
|
|
|
@@ -4761,9 +4835,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4761
4835
|
|
|
4762
4836
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4763
4837
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4764
|
-
|
|
4838
|
+
_this28.options.template = templateString;
|
|
4765
4839
|
|
|
4766
|
-
|
|
4840
|
+
_this28.render();
|
|
4767
4841
|
});
|
|
4768
4842
|
} else {
|
|
4769
4843
|
this.render();
|
|
@@ -4773,7 +4847,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4773
4847
|
_createClass(WebsyTemplate, [{
|
|
4774
4848
|
key: "buildHTML",
|
|
4775
4849
|
value: function buildHTML() {
|
|
4776
|
-
var
|
|
4850
|
+
var _this29 = this;
|
|
4777
4851
|
|
|
4778
4852
|
var html = "";
|
|
4779
4853
|
|
|
@@ -4835,14 +4909,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4835
4909
|
}
|
|
4836
4910
|
|
|
4837
4911
|
if (polarity === true) {
|
|
4838
|
-
if (typeof
|
|
4912
|
+
if (typeof _this29.options.data[parts[0]] !== 'undefined' && _this29.options.data[parts[0]] === parts[1]) {
|
|
4839
4913
|
// remove the <if> tags
|
|
4840
4914
|
removeAll = false;
|
|
4841
4915
|
} else if (parts[0] === parts[1]) {
|
|
4842
4916
|
removeAll = false;
|
|
4843
4917
|
}
|
|
4844
4918
|
} else if (polarity === false) {
|
|
4845
|
-
if (typeof
|
|
4919
|
+
if (typeof _this29.options.data[parts[0]] !== 'undefined' && _this29.options.data[parts[0]] !== parts[1]) {
|
|
4846
4920
|
// remove the <if> tags
|
|
4847
4921
|
removeAll = false;
|
|
4848
4922
|
}
|
|
@@ -5132,7 +5206,7 @@ var WebsyUtils = {
|
|
|
5132
5206
|
|
|
5133
5207
|
var WebsyTable = /*#__PURE__*/function () {
|
|
5134
5208
|
function WebsyTable(elementId, options) {
|
|
5135
|
-
var
|
|
5209
|
+
var _this30 = this;
|
|
5136
5210
|
|
|
5137
5211
|
_classCallCheck(this, WebsyTable);
|
|
5138
5212
|
|
|
@@ -5170,8 +5244,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5170
5244
|
allowClear: false,
|
|
5171
5245
|
disableSearch: true,
|
|
5172
5246
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5173
|
-
if (
|
|
5174
|
-
|
|
5247
|
+
if (_this30.options.onChangePageSize) {
|
|
5248
|
+
_this30.options.onChangePageSize(selectedItem.value);
|
|
5175
5249
|
}
|
|
5176
5250
|
}
|
|
5177
5251
|
});
|
|
@@ -5192,7 +5266,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5192
5266
|
_createClass(WebsyTable, [{
|
|
5193
5267
|
key: "appendRows",
|
|
5194
5268
|
value: function appendRows(data) {
|
|
5195
|
-
var
|
|
5269
|
+
var _this31 = this;
|
|
5196
5270
|
|
|
5197
5271
|
this.hideError();
|
|
5198
5272
|
var bodyHTML = '';
|
|
@@ -5200,15 +5274,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5200
5274
|
if (data) {
|
|
5201
5275
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5202
5276
|
return '<tr>' + r.map(function (c, i) {
|
|
5203
|
-
if (
|
|
5277
|
+
if (_this31.options.columns[i].show !== false) {
|
|
5204
5278
|
var style = '';
|
|
5205
5279
|
|
|
5206
5280
|
if (c.style) {
|
|
5207
5281
|
style += c.style;
|
|
5208
5282
|
}
|
|
5209
5283
|
|
|
5210
|
-
if (
|
|
5211
|
-
style += "width: ".concat(
|
|
5284
|
+
if (_this31.options.columns[i].width) {
|
|
5285
|
+
style += "width: ".concat(_this31.options.columns[i].width, "; ");
|
|
5212
5286
|
}
|
|
5213
5287
|
|
|
5214
5288
|
if (c.backgroundColor) {
|
|
@@ -5223,18 +5297,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5223
5297
|
style += "color: ".concat(c.color, "; ");
|
|
5224
5298
|
}
|
|
5225
5299
|
|
|
5226
|
-
if (
|
|
5227
|
-
return "\n <td \n data-row-index='".concat(
|
|
5228
|
-
} else if ((
|
|
5229
|
-
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 ");
|
|
5230
5304
|
} else {
|
|
5231
5305
|
var info = c.value;
|
|
5232
5306
|
|
|
5233
|
-
if (
|
|
5307
|
+
if (_this31.options.columns[i].showAsImage === true) {
|
|
5234
5308
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5235
5309
|
}
|
|
5236
5310
|
|
|
5237
|
-
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 ");
|
|
5238
5312
|
}
|
|
5239
5313
|
}
|
|
5240
5314
|
}).join('') + '</tr>';
|
|
@@ -5406,7 +5480,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5406
5480
|
}, {
|
|
5407
5481
|
key: "render",
|
|
5408
5482
|
value: function render(data) {
|
|
5409
|
-
var
|
|
5483
|
+
var _this32 = this;
|
|
5410
5484
|
|
|
5411
5485
|
if (!this.options.columns) {
|
|
5412
5486
|
return;
|
|
@@ -5441,7 +5515,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5441
5515
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5442
5516
|
}
|
|
5443
5517
|
|
|
5444
|
-
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 ");
|
|
5445
5519
|
}
|
|
5446
5520
|
}).join('') + '</tr>';
|
|
5447
5521
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5460,7 +5534,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5460
5534
|
|
|
5461
5535
|
if (pagingEl) {
|
|
5462
5536
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5463
|
-
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>");
|
|
5464
5538
|
});
|
|
5465
5539
|
var startIndex = 0;
|
|
5466
5540
|
|
|
@@ -5528,7 +5602,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5528
5602
|
|
|
5529
5603
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5530
5604
|
function WebsyTable2(elementId, options) {
|
|
5531
|
-
var
|
|
5605
|
+
var _this33 = this;
|
|
5532
5606
|
|
|
5533
5607
|
_classCallCheck(this, WebsyTable2);
|
|
5534
5608
|
|
|
@@ -5569,8 +5643,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5569
5643
|
allowClear: false,
|
|
5570
5644
|
disableSearch: true,
|
|
5571
5645
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5572
|
-
if (
|
|
5573
|
-
|
|
5646
|
+
if (_this33.options.onChangePageSize) {
|
|
5647
|
+
_this33.options.onChangePageSize(selectedItem.value);
|
|
5574
5648
|
}
|
|
5575
5649
|
}
|
|
5576
5650
|
});
|
|
@@ -5594,7 +5668,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5594
5668
|
_createClass(WebsyTable2, [{
|
|
5595
5669
|
key: "appendRows",
|
|
5596
5670
|
value: function appendRows(data) {
|
|
5597
|
-
var
|
|
5671
|
+
var _this34 = this;
|
|
5598
5672
|
|
|
5599
5673
|
this.hideError();
|
|
5600
5674
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -5603,15 +5677,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5603
5677
|
if (data) {
|
|
5604
5678
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5605
5679
|
return '<tr>' + r.map(function (c, i) {
|
|
5606
|
-
if (
|
|
5607
|
-
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;");
|
|
5608
5682
|
|
|
5609
5683
|
if (c.style) {
|
|
5610
5684
|
style += c.style;
|
|
5611
5685
|
}
|
|
5612
5686
|
|
|
5613
|
-
if (
|
|
5614
|
-
style += "width: ".concat(
|
|
5687
|
+
if (_this34.options.columns[i].width) {
|
|
5688
|
+
style += "width: ".concat(_this34.options.columns[i].width, "; ");
|
|
5615
5689
|
}
|
|
5616
5690
|
|
|
5617
5691
|
if (c.backgroundColor) {
|
|
@@ -5626,18 +5700,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5626
5700
|
style += "color: ".concat(c.color, "; ");
|
|
5627
5701
|
}
|
|
5628
5702
|
|
|
5629
|
-
if (
|
|
5630
|
-
return "\n <td \n data-row-index='".concat(
|
|
5631
|
-
} else if ((
|
|
5632
|
-
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 ");
|
|
5633
5707
|
} else {
|
|
5634
5708
|
var info = c.value;
|
|
5635
5709
|
|
|
5636
|
-
if (
|
|
5710
|
+
if (_this34.options.columns[i].showAsImage === true) {
|
|
5637
5711
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5638
5712
|
}
|
|
5639
5713
|
|
|
5640
|
-
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 ");
|
|
5641
5715
|
}
|
|
5642
5716
|
}
|
|
5643
5717
|
}).join('') + '</tr>';
|
|
@@ -5900,7 +5974,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5900
5974
|
}, {
|
|
5901
5975
|
key: "render",
|
|
5902
5976
|
value: function render(data) {
|
|
5903
|
-
var
|
|
5977
|
+
var _this35 = this;
|
|
5904
5978
|
|
|
5905
5979
|
if (!this.options.columns) {
|
|
5906
5980
|
return;
|
|
@@ -5936,7 +6010,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5936
6010
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5937
6011
|
}
|
|
5938
6012
|
|
|
5939
|
-
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 ");
|
|
5940
6014
|
}
|
|
5941
6015
|
}).join('') + '</tr>';
|
|
5942
6016
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5947,7 +6021,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5947
6021
|
var dropdownHTML = "";
|
|
5948
6022
|
this.options.columns.forEach(function (c, i) {
|
|
5949
6023
|
if (c.searchable && c.searchField) {
|
|
5950
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
6024
|
+
dropdownHTML += "\n <div id=\"".concat(_this35.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
5951
6025
|
}
|
|
5952
6026
|
});
|
|
5953
6027
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5969,7 +6043,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5969
6043
|
|
|
5970
6044
|
if (pagingEl) {
|
|
5971
6045
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5972
|
-
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>");
|
|
5973
6047
|
});
|
|
5974
6048
|
var startIndex = 0;
|
|
5975
6049
|
|
|
@@ -6060,7 +6134,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6060
6134
|
}, {
|
|
6061
6135
|
key: "getColumnParameters",
|
|
6062
6136
|
value: function getColumnParameters(values) {
|
|
6063
|
-
var
|
|
6137
|
+
var _this36 = this;
|
|
6064
6138
|
|
|
6065
6139
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6066
6140
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -6068,10 +6142,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6068
6142
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6069
6143
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6070
6144
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
6071
|
-
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 ");
|
|
6072
6146
|
}).join('') + '</tr>';
|
|
6073
6147
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6074
|
-
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 ");
|
|
6075
6149
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
6076
6150
|
|
|
6077
6151
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -6262,7 +6336,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6262
6336
|
}, {
|
|
6263
6337
|
key: "buildHeaderHtml",
|
|
6264
6338
|
value: function buildHeaderHtml() {
|
|
6265
|
-
var
|
|
6339
|
+
var _this37 = this;
|
|
6266
6340
|
|
|
6267
6341
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6268
6342
|
var headerHtml = '';
|
|
@@ -6277,7 +6351,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6277
6351
|
}
|
|
6278
6352
|
|
|
6279
6353
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6280
|
-
if (useWidths === false && rowIndex !==
|
|
6354
|
+
if (useWidths === false && rowIndex !== _this37.options.columns.length - 1) {
|
|
6281
6355
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6282
6356
|
return;
|
|
6283
6357
|
}
|
|
@@ -6291,18 +6365,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6291
6365
|
// `
|
|
6292
6366
|
// }
|
|
6293
6367
|
|
|
6294
|
-
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>");
|
|
6295
6369
|
});
|
|
6296
6370
|
headerHtml += "</tr>";
|
|
6297
6371
|
});
|
|
6298
6372
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6299
6373
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6300
6374
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6301
|
-
var testEl = document.getElementById("".concat(
|
|
6375
|
+
var testEl = document.getElementById("".concat(_this37.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6302
6376
|
|
|
6303
6377
|
if (!testEl) {
|
|
6304
6378
|
var newE = document.createElement('div');
|
|
6305
|
-
newE.id = "".concat(
|
|
6379
|
+
newE.id = "".concat(_this37.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6306
6380
|
newE.className = 'websy-modal-dropdown';
|
|
6307
6381
|
dropdownEl.appendChild(newE);
|
|
6308
6382
|
}
|
|
@@ -6318,7 +6392,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6318
6392
|
}, {
|
|
6319
6393
|
key: "buildTotalHtml",
|
|
6320
6394
|
value: function buildTotalHtml() {
|
|
6321
|
-
var
|
|
6395
|
+
var _this38 = this;
|
|
6322
6396
|
|
|
6323
6397
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6324
6398
|
|
|
@@ -6331,7 +6405,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6331
6405
|
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6332
6406
|
|
|
6333
6407
|
if (useWidths === true) {
|
|
6334
|
-
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 ");
|
|
6335
6409
|
}
|
|
6336
6410
|
|
|
6337
6411
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -6342,7 +6416,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6342
6416
|
}, {
|
|
6343
6417
|
key: "calculateSizes",
|
|
6344
6418
|
value: function calculateSizes() {
|
|
6345
|
-
var
|
|
6419
|
+
var _this39 = this;
|
|
6346
6420
|
|
|
6347
6421
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6348
6422
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -6384,28 +6458,28 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6384
6458
|
rows.forEach(function (row, rowIndex) {
|
|
6385
6459
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6386
6460
|
var colSize = col.getBoundingClientRect();
|
|
6387
|
-
|
|
6461
|
+
_this39.sizes.cellHeight = colSize.height;
|
|
6388
6462
|
|
|
6389
|
-
if (
|
|
6390
|
-
if (!
|
|
6391
|
-
|
|
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;
|
|
6392
6466
|
}
|
|
6393
6467
|
|
|
6394
|
-
|
|
6395
|
-
|
|
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;
|
|
6396
6470
|
}
|
|
6397
6471
|
});
|
|
6398
6472
|
});
|
|
6399
6473
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6400
|
-
if (colIndex <
|
|
6401
|
-
|
|
6474
|
+
if (colIndex < _this39.pinnedColumns) {
|
|
6475
|
+
_this39.sizes.scrollableWidth -= col.actualWidth;
|
|
6402
6476
|
}
|
|
6403
6477
|
});
|
|
6404
6478
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6405
6479
|
return a + (b.width || b.actualWidth);
|
|
6406
6480
|
}, 0);
|
|
6407
6481
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6408
|
-
return i >=
|
|
6482
|
+
return i >= _this39.pinnedColumns;
|
|
6409
6483
|
}).reduce(function (a, b) {
|
|
6410
6484
|
return a + (b.width || b.actualWidth);
|
|
6411
6485
|
}, 0);
|
|
@@ -6423,13 +6497,13 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6423
6497
|
}
|
|
6424
6498
|
}
|
|
6425
6499
|
|
|
6426
|
-
|
|
6500
|
+
_this39.sizes.totalWidth += c.width || c.actualWidth;
|
|
6427
6501
|
|
|
6428
|
-
if (i <
|
|
6429
|
-
|
|
6502
|
+
if (i < _this39.pinnedColumns) {
|
|
6503
|
+
_this39.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6430
6504
|
}
|
|
6431
6505
|
|
|
6432
|
-
equalWidth = (outerSize.width -
|
|
6506
|
+
equalWidth = (outerSize.width - _this39.sizes.totalWidth) / (_this39.options.columns[_this39.options.columns.length - 1].length - (i + 1));
|
|
6433
6507
|
});
|
|
6434
6508
|
} // take the height of the last cell as the official height for data cells
|
|
6435
6509
|
// this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
|
|
@@ -6858,7 +6932,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6858
6932
|
|
|
6859
6933
|
var WebsyChart = /*#__PURE__*/function () {
|
|
6860
6934
|
function WebsyChart(elementId, options) {
|
|
6861
|
-
var
|
|
6935
|
+
var _this40 = this;
|
|
6862
6936
|
|
|
6863
6937
|
_classCallCheck(this, WebsyChart);
|
|
6864
6938
|
|
|
@@ -6907,22 +6981,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6907
6981
|
this.invertOverride = function (input, input2) {
|
|
6908
6982
|
var xAxis = 'bottomAxis';
|
|
6909
6983
|
|
|
6910
|
-
if (
|
|
6984
|
+
if (_this40.options.orientation === 'horizontal') {
|
|
6911
6985
|
xAxis = 'leftAxis';
|
|
6912
6986
|
}
|
|
6913
6987
|
|
|
6914
|
-
var width =
|
|
6988
|
+
var width = _this40[xAxis].step();
|
|
6915
6989
|
|
|
6916
6990
|
var output;
|
|
6917
6991
|
|
|
6918
|
-
var domain = _toConsumableArray(
|
|
6992
|
+
var domain = _toConsumableArray(_this40[xAxis].domain());
|
|
6919
6993
|
|
|
6920
|
-
if (
|
|
6994
|
+
if (_this40.options.orientation === 'horizontal') {
|
|
6921
6995
|
domain = domain.reverse();
|
|
6922
6996
|
}
|
|
6923
6997
|
|
|
6924
6998
|
for (var j = 0; j < domain.length; j++) {
|
|
6925
|
-
var breakA =
|
|
6999
|
+
var breakA = _this40[xAxis](domain[j]) - width / 2;
|
|
6926
7000
|
var breakB = breakA + width;
|
|
6927
7001
|
|
|
6928
7002
|
if (input > breakA && input <= breakB) {
|
|
@@ -7022,10 +7096,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7022
7096
|
}, {
|
|
7023
7097
|
key: "handleEventMouseMove",
|
|
7024
7098
|
value: function handleEventMouseMove(event, d) {
|
|
7025
|
-
var
|
|
7099
|
+
var _this41 = this;
|
|
7026
7100
|
|
|
7027
7101
|
var bisectDate = d3.bisector(function (d) {
|
|
7028
|
-
return
|
|
7102
|
+
return _this41.parseX(d.x.value);
|
|
7029
7103
|
}).left;
|
|
7030
7104
|
|
|
7031
7105
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7064,8 +7138,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7064
7138
|
}
|
|
7065
7139
|
|
|
7066
7140
|
this.options.data.series.forEach(function (s) {
|
|
7067
|
-
if (
|
|
7068
|
-
xPoint =
|
|
7141
|
+
if (_this41.options.data[xData].scale !== 'Time') {
|
|
7142
|
+
xPoint = _this41[xAxis](_this41.parseX(xLabel));
|
|
7069
7143
|
s.data.forEach(function (d) {
|
|
7070
7144
|
if (d.x.value === xLabel) {
|
|
7071
7145
|
if (!tooltipTitle) {
|
|
@@ -7084,13 +7158,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7084
7158
|
var pointA = s.data[index - 1];
|
|
7085
7159
|
var pointB = s.data[index];
|
|
7086
7160
|
|
|
7087
|
-
if (
|
|
7161
|
+
if (_this41.options.orientation === 'horizontal') {
|
|
7088
7162
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7089
7163
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7090
7164
|
}
|
|
7091
7165
|
|
|
7092
7166
|
if (pointA && !pointB) {
|
|
7093
|
-
xPoint =
|
|
7167
|
+
xPoint = _this41[xAxis](_this41.parseX(pointA.x.value));
|
|
7094
7168
|
tooltipTitle = pointA.x.value;
|
|
7095
7169
|
|
|
7096
7170
|
if (!pointA.y.color) {
|
|
@@ -7100,12 +7174,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7100
7174
|
tooltipData.push(pointA.y);
|
|
7101
7175
|
|
|
7102
7176
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7103
|
-
tooltipTitle = d3.timeFormat(
|
|
7177
|
+
tooltipTitle = d3.timeFormat(_this41.options.dateFormat || _this41.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7104
7178
|
}
|
|
7105
7179
|
}
|
|
7106
7180
|
|
|
7107
7181
|
if (pointB && !pointA) {
|
|
7108
|
-
xPoint =
|
|
7182
|
+
xPoint = _this41[xAxis](_this41.parseX(pointB.x.value));
|
|
7109
7183
|
tooltipTitle = pointB.x.value;
|
|
7110
7184
|
|
|
7111
7185
|
if (!pointB.y.color) {
|
|
@@ -7115,14 +7189,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7115
7189
|
tooltipData.push(pointB.y);
|
|
7116
7190
|
|
|
7117
7191
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7118
|
-
tooltipTitle = d3.timeFormat(
|
|
7192
|
+
tooltipTitle = d3.timeFormat(_this41.options.dateFormat || _this41.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7119
7193
|
}
|
|
7120
7194
|
}
|
|
7121
7195
|
|
|
7122
7196
|
if (pointA && pointB) {
|
|
7123
|
-
var d0 =
|
|
7197
|
+
var d0 = _this41[xAxis](_this41.parseX(pointA.x.value));
|
|
7124
7198
|
|
|
7125
|
-
var d1 =
|
|
7199
|
+
var d1 = _this41[xAxis](_this41.parseX(pointB.x.value));
|
|
7126
7200
|
|
|
7127
7201
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7128
7202
|
|
|
@@ -7131,7 +7205,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7131
7205
|
tooltipTitle = pointB.x.value;
|
|
7132
7206
|
|
|
7133
7207
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7134
|
-
tooltipTitle = d3.timeFormat(
|
|
7208
|
+
tooltipTitle = d3.timeFormat(_this41.options.dateFormat || _this41.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7135
7209
|
}
|
|
7136
7210
|
|
|
7137
7211
|
if (!pointB.y.color) {
|
|
@@ -7144,7 +7218,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7144
7218
|
tooltipTitle = pointA.x.value;
|
|
7145
7219
|
|
|
7146
7220
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7147
|
-
tooltipTitle = d3.timeFormat(
|
|
7221
|
+
tooltipTitle = d3.timeFormat(_this41.options.dateFormat || _this41.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7148
7222
|
}
|
|
7149
7223
|
|
|
7150
7224
|
if (!pointA.y.color) {
|
|
@@ -7249,7 +7323,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7249
7323
|
}, {
|
|
7250
7324
|
key: "render",
|
|
7251
7325
|
value: function render(options) {
|
|
7252
|
-
var
|
|
7326
|
+
var _this42 = this;
|
|
7253
7327
|
|
|
7254
7328
|
/* global d3 options WebsyUtils */
|
|
7255
7329
|
if (typeof options !== 'undefined') {
|
|
@@ -7318,7 +7392,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7318
7392
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
7319
7393
|
return {
|
|
7320
7394
|
value: s.label || s.key,
|
|
7321
|
-
color: s.color ||
|
|
7395
|
+
color: s.color || _this42.options.colors[i % _this42.options.colors.length]
|
|
7322
7396
|
};
|
|
7323
7397
|
});
|
|
7324
7398
|
|
|
@@ -7570,7 +7644,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7570
7644
|
|
|
7571
7645
|
if (this.options.data.bottom.formatter) {
|
|
7572
7646
|
bAxisFunc.tickFormat(function (d) {
|
|
7573
|
-
return
|
|
7647
|
+
return _this42.options.data.bottom.formatter(d);
|
|
7574
7648
|
});
|
|
7575
7649
|
}
|
|
7576
7650
|
|
|
@@ -7596,8 +7670,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7596
7670
|
|
|
7597
7671
|
if (this.options.margin.axisLeft > 0) {
|
|
7598
7672
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7599
|
-
if (
|
|
7600
|
-
d =
|
|
7673
|
+
if (_this42.options.data.left.formatter) {
|
|
7674
|
+
d = _this42.options.data.left.formatter(d);
|
|
7601
7675
|
}
|
|
7602
7676
|
|
|
7603
7677
|
return d;
|
|
@@ -7634,8 +7708,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7634
7708
|
|
|
7635
7709
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
7636
7710
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7637
|
-
if (
|
|
7638
|
-
d =
|
|
7711
|
+
if (_this42.options.data.right.formatter) {
|
|
7712
|
+
d = _this42.options.data.right.formatter(d);
|
|
7639
7713
|
}
|
|
7640
7714
|
|
|
7641
7715
|
return d;
|
|
@@ -7661,16 +7735,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7661
7735
|
|
|
7662
7736
|
this.options.data.series.forEach(function (series, index) {
|
|
7663
7737
|
if (!series.key) {
|
|
7664
|
-
series.key =
|
|
7738
|
+
series.key = _this42.createIdentity();
|
|
7665
7739
|
}
|
|
7666
7740
|
|
|
7667
7741
|
if (!series.color) {
|
|
7668
|
-
series.color =
|
|
7742
|
+
series.color = _this42.options.colors[index % _this42.options.colors.length];
|
|
7669
7743
|
}
|
|
7670
7744
|
|
|
7671
|
-
|
|
7745
|
+
_this42["render".concat(series.type || 'bar')](series, index);
|
|
7672
7746
|
|
|
7673
|
-
|
|
7747
|
+
_this42.renderLabels(series, index);
|
|
7674
7748
|
});
|
|
7675
7749
|
}
|
|
7676
7750
|
}
|
|
@@ -7678,17 +7752,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7678
7752
|
}, {
|
|
7679
7753
|
key: "renderarea",
|
|
7680
7754
|
value: function renderarea(series, index) {
|
|
7681
|
-
var
|
|
7755
|
+
var _this43 = this;
|
|
7682
7756
|
|
|
7683
7757
|
/* global d3 series index */
|
|
7684
7758
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
7685
7759
|
return d3.area().x(function (d) {
|
|
7686
|
-
return
|
|
7760
|
+
return _this43[xAxis](_this43.parseX(d.x.value));
|
|
7687
7761
|
}).y0(function (d) {
|
|
7688
|
-
return
|
|
7762
|
+
return _this43[yAxis](0);
|
|
7689
7763
|
}).y1(function (d) {
|
|
7690
|
-
return
|
|
7691
|
-
}).curve(d3[curveStyle ||
|
|
7764
|
+
return _this43[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7765
|
+
}).curve(d3[curveStyle || _this43.options.curveStyle]);
|
|
7692
7766
|
};
|
|
7693
7767
|
|
|
7694
7768
|
var xAxis = 'bottomAxis';
|
|
@@ -7804,7 +7878,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7804
7878
|
}, {
|
|
7805
7879
|
key: "renderLabels",
|
|
7806
7880
|
value: function renderLabels(series, index) {
|
|
7807
|
-
var
|
|
7881
|
+
var _this44 = this;
|
|
7808
7882
|
|
|
7809
7883
|
/* global series index d3 WebsyDesigns */
|
|
7810
7884
|
var xAxis = 'bottomAxis';
|
|
@@ -7823,7 +7897,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7823
7897
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
7824
7898
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
7825
7899
|
labels.attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
7826
|
-
return
|
|
7900
|
+
return _this44.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7827
7901
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
7828
7902
|
return d.y.label || d.y.value;
|
|
7829
7903
|
}).each(function (d, i) {
|
|
@@ -7848,7 +7922,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7848
7922
|
}
|
|
7849
7923
|
});
|
|
7850
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) {
|
|
7851
|
-
return
|
|
7925
|
+
return _this44.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7852
7926
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
7853
7927
|
return d.y.label || d.y.value;
|
|
7854
7928
|
}).each(function (d, i) {
|
|
@@ -7905,15 +7979,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7905
7979
|
}, {
|
|
7906
7980
|
key: "renderline",
|
|
7907
7981
|
value: function renderline(series, index) {
|
|
7908
|
-
var
|
|
7982
|
+
var _this45 = this;
|
|
7909
7983
|
|
|
7910
7984
|
/* global series index d3 */
|
|
7911
7985
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
7912
7986
|
return d3.line().x(function (d) {
|
|
7913
|
-
return
|
|
7987
|
+
return _this45[xAxis](_this45.parseX(d.x.value));
|
|
7914
7988
|
}).y(function (d) {
|
|
7915
|
-
return
|
|
7916
|
-
}).curve(d3[curveStyle ||
|
|
7989
|
+
return _this45[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7990
|
+
}).curve(d3[curveStyle || _this45.options.curveStyle]);
|
|
7917
7991
|
};
|
|
7918
7992
|
|
|
7919
7993
|
var xAxis = 'bottomAxis';
|
|
@@ -7951,14 +8025,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7951
8025
|
}, {
|
|
7952
8026
|
key: "rendersymbol",
|
|
7953
8027
|
value: function rendersymbol(series, index) {
|
|
7954
|
-
var
|
|
8028
|
+
var _this46 = this;
|
|
7955
8029
|
|
|
7956
8030
|
/* global d3 series index series.key */
|
|
7957
8031
|
var drawSymbol = function drawSymbol(size) {
|
|
7958
8032
|
return d3.symbol() // .type(d => {
|
|
7959
8033
|
// return d3.symbols[0]
|
|
7960
8034
|
// })
|
|
7961
|
-
.size(size ||
|
|
8035
|
+
.size(size || _this46.options.symbolSize);
|
|
7962
8036
|
};
|
|
7963
8037
|
|
|
7964
8038
|
var xAxis = 'bottomAxis';
|
|
@@ -7976,7 +8050,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7976
8050
|
symbols.attr('d', function (d) {
|
|
7977
8051
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
7978
8052
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
7979
|
-
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), ")");
|
|
7980
8054
|
}); // Enter
|
|
7981
8055
|
|
|
7982
8056
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -7985,7 +8059,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7985
8059
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
7986
8060
|
return "symbol symbol_".concat(series.key);
|
|
7987
8061
|
}).attr('transform', function (d) {
|
|
7988
|
-
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), ")");
|
|
7989
8063
|
});
|
|
7990
8064
|
}
|
|
7991
8065
|
}, {
|
|
@@ -8140,7 +8214,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8140
8214
|
}, {
|
|
8141
8215
|
key: "resize",
|
|
8142
8216
|
value: function resize() {
|
|
8143
|
-
var
|
|
8217
|
+
var _this47 = this;
|
|
8144
8218
|
|
|
8145
8219
|
var el = document.getElementById(this.elementId);
|
|
8146
8220
|
|
|
@@ -8153,7 +8227,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8153
8227
|
// }
|
|
8154
8228
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
8155
8229
|
html += this._data.map(function (d, i) {
|
|
8156
|
-
return
|
|
8230
|
+
return _this47.getLegendItemHTML(d);
|
|
8157
8231
|
}).join('');
|
|
8158
8232
|
html += "\n <div>\n ";
|
|
8159
8233
|
el.innerHTML = html;
|
|
@@ -8325,7 +8399,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8325
8399
|
}, {
|
|
8326
8400
|
key: "render",
|
|
8327
8401
|
value: function render() {
|
|
8328
|
-
var
|
|
8402
|
+
var _this48 = this;
|
|
8329
8403
|
|
|
8330
8404
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
8331
8405
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -8334,7 +8408,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8334
8408
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
8335
8409
|
return {
|
|
8336
8410
|
value: s.label || s.key,
|
|
8337
|
-
color: s.color ||
|
|
8411
|
+
color: s.color || _this48.options.colors[i % _this48.options.colors.length]
|
|
8338
8412
|
};
|
|
8339
8413
|
});
|
|
8340
8414
|
var longestValue = legendData.map(function (s) {
|
|
@@ -8398,7 +8472,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8398
8472
|
|
|
8399
8473
|
if (this.polygons) {
|
|
8400
8474
|
this.polygons.forEach(function (p) {
|
|
8401
|
-
return
|
|
8475
|
+
return _this48.map.removeLayer(p);
|
|
8402
8476
|
});
|
|
8403
8477
|
}
|
|
8404
8478
|
|
|
@@ -8456,18 +8530,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8456
8530
|
}
|
|
8457
8531
|
|
|
8458
8532
|
if (!p.options.color) {
|
|
8459
|
-
p.options.color =
|
|
8533
|
+
p.options.color = _this48.options.colors[i % _this48.options.colors.length];
|
|
8460
8534
|
}
|
|
8461
8535
|
|
|
8462
8536
|
var pol = L.polygon(p.data.map(function (c) {
|
|
8463
8537
|
return c.map(function (d) {
|
|
8464
8538
|
return [d.Latitude, d.Longitude];
|
|
8465
8539
|
});
|
|
8466
|
-
}), p.options).addTo(
|
|
8540
|
+
}), p.options).addTo(_this48.map);
|
|
8467
8541
|
|
|
8468
|
-
|
|
8542
|
+
_this48.polygons.push(pol);
|
|
8469
8543
|
|
|
8470
|
-
|
|
8544
|
+
_this48.map.fitBounds(pol.getBounds());
|
|
8471
8545
|
});
|
|
8472
8546
|
} // if (this.data.markers.length > 0) {
|
|
8473
8547
|
// el.classList.remove('hidden')
|