@websy/websy-designs 1.11.0 → 1.11.1
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 +107 -26
- package/dist/websy-designs-es6.js +315 -232
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +107 -26
- package/dist/websy-designs.js +322 -239
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
package/dist/websy-designs.js
CHANGED
|
@@ -1884,8 +1884,9 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1884
1884
|
get: function get() {
|
|
1885
1885
|
var _this12 = this;
|
|
1886
1886
|
if (this.selectedItems && this.selectedItems.length > 0) {
|
|
1887
|
+
// return this.selectedItems.map((d, i) => this.options.items[+d])
|
|
1887
1888
|
return this.selectedItems.map(function (d, i) {
|
|
1888
|
-
return _this12.
|
|
1889
|
+
return _this12._originalData[+d];
|
|
1889
1890
|
});
|
|
1890
1891
|
}
|
|
1891
1892
|
return [];
|
|
@@ -3898,7 +3899,7 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3898
3899
|
} else {
|
|
3899
3900
|
fileName = _this30.options.fileName || 'Export';
|
|
3900
3901
|
}
|
|
3901
|
-
msg += "download
|
|
3902
|
+
msg += "download=\"".concat(fileName.replace(/'/g, ''), ".pdf\"");
|
|
3902
3903
|
}
|
|
3903
3904
|
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this30.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3904
3905
|
_this30.popup.show({
|
|
@@ -4578,7 +4579,11 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4578
4579
|
}]);
|
|
4579
4580
|
return WebsyResultList;
|
|
4580
4581
|
}();
|
|
4581
|
-
/*
|
|
4582
|
+
/*
|
|
4583
|
+
global
|
|
4584
|
+
history
|
|
4585
|
+
WebsyDesigns
|
|
4586
|
+
*/
|
|
4582
4587
|
var WebsyRouter = /*#__PURE__*/function () {
|
|
4583
4588
|
function WebsyRouter(options) {
|
|
4584
4589
|
_classCallCheck(this, WebsyRouter);
|
|
@@ -4599,6 +4604,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4599
4604
|
persistentParameters: false,
|
|
4600
4605
|
fieldValueSeparator: ':'
|
|
4601
4606
|
};
|
|
4607
|
+
this.apiService = new WebsyDesigns.APIService('');
|
|
4602
4608
|
this.triggerIdList = [];
|
|
4603
4609
|
this.viewIdList = [];
|
|
4604
4610
|
this.previousPath = '';
|
|
@@ -4634,7 +4640,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4634
4640
|
value: function addGroup(group) {
|
|
4635
4641
|
var _this35 = this;
|
|
4636
4642
|
if (!this.groups[group]) {
|
|
4637
|
-
var els = document.querySelectorAll(".
|
|
4643
|
+
var els = document.querySelectorAll(".".concat(this.options.viewClass, "[data-group=\"").concat(group, "\"]"));
|
|
4638
4644
|
if (els) {
|
|
4639
4645
|
this.getClosestParent(els[0], function (parent) {
|
|
4640
4646
|
_this35.groups[group] = {
|
|
@@ -4767,9 +4773,9 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4767
4773
|
if (!this.groups) {
|
|
4768
4774
|
this.groups = {};
|
|
4769
4775
|
}
|
|
4770
|
-
var parentEl = document.querySelector(".
|
|
4776
|
+
var parentEl = document.querySelector(".".concat(this.options.viewClass, "[data-view=\"").concat(parent, "\"]"));
|
|
4771
4777
|
if (parentEl) {
|
|
4772
|
-
var els = parentEl.querySelectorAll(".
|
|
4778
|
+
var els = parentEl.querySelectorAll(".".concat(this.options.viewClass, "[data-group]"));
|
|
4773
4779
|
for (var i = 0; i < els.length; i++) {
|
|
4774
4780
|
var g = els[i].getAttribute('data-group');
|
|
4775
4781
|
var v = els[i].getAttribute('data-view');
|
|
@@ -5052,28 +5058,90 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
5052
5058
|
});
|
|
5053
5059
|
}
|
|
5054
5060
|
}
|
|
5061
|
+
}, {
|
|
5062
|
+
key: "preloadView",
|
|
5063
|
+
value: function preloadView(view, callbackFn) {
|
|
5064
|
+
if (this.options.views[view].load) {
|
|
5065
|
+
this.options.views[view].load(callbackFn);
|
|
5066
|
+
}
|
|
5067
|
+
}
|
|
5068
|
+
}, {
|
|
5069
|
+
key: "initView",
|
|
5070
|
+
value: function initView(view) {
|
|
5071
|
+
var _this38 = this;
|
|
5072
|
+
return new Promise(function (resolve, reject) {
|
|
5073
|
+
if (!_this38.options.views[view]) {
|
|
5074
|
+
_this38.options.views[view] = {
|
|
5075
|
+
components: []
|
|
5076
|
+
};
|
|
5077
|
+
}
|
|
5078
|
+
if (_this38.options.views[view].ready === true) {
|
|
5079
|
+
resolve();
|
|
5080
|
+
} else if (_this38.options.views[view].template) {
|
|
5081
|
+
_this38.preloadView(view, function () {
|
|
5082
|
+
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5083
|
+
var viewEl = document.querySelector("[data-view='".concat(view, "'].").concat(_this38.options.viewClass));
|
|
5084
|
+
if (viewEl) {
|
|
5085
|
+
_this38.options.views[view].templateInstance = new WebsyDesigns.Template(viewEl, {
|
|
5086
|
+
template: _this38.options.views[view].template,
|
|
5087
|
+
data: data,
|
|
5088
|
+
readyCallbackFn: function readyCallbackFn() {
|
|
5089
|
+
_this38.options.views[view].ready = true;
|
|
5090
|
+
resolve();
|
|
5091
|
+
}
|
|
5092
|
+
});
|
|
5093
|
+
} else {
|
|
5094
|
+
console.log("No view element found for '".concat(view, "' to render template"));
|
|
5095
|
+
_this38.options.views[view].ready = true;
|
|
5096
|
+
resolve();
|
|
5097
|
+
}
|
|
5098
|
+
});
|
|
5099
|
+
} else if (_this38.options.views[view].ready !== true && _this38.options.views[view].load) {
|
|
5100
|
+
_this38.preloadView(view, function () {
|
|
5101
|
+
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5102
|
+
_this38.options.views[view].ready = true;
|
|
5103
|
+
resolve();
|
|
5104
|
+
});
|
|
5105
|
+
} else {
|
|
5106
|
+
_this38.options.views[view].ready = true;
|
|
5107
|
+
resolve();
|
|
5108
|
+
}
|
|
5109
|
+
});
|
|
5110
|
+
}
|
|
5055
5111
|
}, {
|
|
5056
5112
|
key: "showView",
|
|
5057
5113
|
value: function showView(view, params, group) {
|
|
5114
|
+
var _this39 = this;
|
|
5058
5115
|
if (view === '/' || view === '') {
|
|
5059
5116
|
view = this.options.defaultView || '';
|
|
5060
5117
|
}
|
|
5061
|
-
this.
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5118
|
+
this.initView(view).then(function () {
|
|
5119
|
+
_this39.activateItem(view, _this39.options.triggerClass);
|
|
5120
|
+
_this39.activateItem(view, _this39.options.viewClass);
|
|
5121
|
+
var children = _this39.getActiveViewsFromParent(view);
|
|
5122
|
+
for (var c = 0; c < children.length; c++) {
|
|
5123
|
+
_this39.activateItem(children[c].view, _this39.options.triggerClass);
|
|
5124
|
+
_this39.activateItem(children[c].view, _this39.options.viewClass);
|
|
5125
|
+
_this39.showComponents(children[c].view);
|
|
5126
|
+
if (children[c].show) {
|
|
5127
|
+
children[c].show.call(children[c]);
|
|
5128
|
+
}
|
|
5129
|
+
_this39.publish('show', [children[c].view, null, group]);
|
|
5130
|
+
}
|
|
5131
|
+
if (_this39.previousView !== _this39.currentView || group !== 'main') {
|
|
5132
|
+
_this39.showComponents(view);
|
|
5133
|
+
if (_this39.options.views[view].show) {
|
|
5134
|
+
_this39.options.views[view].show.call(_this39.options.views[view]);
|
|
5135
|
+
}
|
|
5136
|
+
_this39.publish('show', [view, params, group]);
|
|
5137
|
+
} else if (_this39.previousView === _this39.currentView && _this39.previousParams.path !== _this39.currentParams.path) {
|
|
5138
|
+
_this39.showComponents(view);
|
|
5139
|
+
if (_this39.options.views[view].show) {
|
|
5140
|
+
_this39.options.views[view].show.call(_this39.options.views[view]);
|
|
5141
|
+
}
|
|
5142
|
+
_this39.publish('show', [view, params, group]);
|
|
5143
|
+
}
|
|
5144
|
+
});
|
|
5077
5145
|
}
|
|
5078
5146
|
}, {
|
|
5079
5147
|
key: "reloadCurrentView",
|
|
@@ -5461,7 +5529,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5461
5529
|
}, {
|
|
5462
5530
|
key: "handleKeyUp",
|
|
5463
5531
|
value: function handleKeyUp(event) {
|
|
5464
|
-
var
|
|
5532
|
+
var _this40 = this;
|
|
5465
5533
|
if (event.target.classList.contains('websy-search-input')) {
|
|
5466
5534
|
this.cursorPosition = event.target.selectionStart;
|
|
5467
5535
|
this.searchText = event.target.value;
|
|
@@ -5484,8 +5552,8 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5484
5552
|
}
|
|
5485
5553
|
if (event.target.value.length >= this.options.minLength) {
|
|
5486
5554
|
this.searchTimeoutFn = setTimeout(function () {
|
|
5487
|
-
if (
|
|
5488
|
-
|
|
5555
|
+
if (_this40.options.onSearch) {
|
|
5556
|
+
_this40.options.onSearch(event.target.value, event);
|
|
5489
5557
|
}
|
|
5490
5558
|
}, this.options.searchTimeout);
|
|
5491
5559
|
} else {
|
|
@@ -5535,7 +5603,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5535
5603
|
}, {
|
|
5536
5604
|
key: "highlightActiveSuggestion",
|
|
5537
5605
|
value: function highlightActiveSuggestion() {
|
|
5538
|
-
var
|
|
5606
|
+
var _this41 = this;
|
|
5539
5607
|
// remove all previous highlights
|
|
5540
5608
|
// const parent = document.getElementById(`${this.elementId}_suggestionList`)
|
|
5541
5609
|
// if (parent) {
|
|
@@ -5554,7 +5622,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5554
5622
|
Array.from(els).forEach(function (e) {
|
|
5555
5623
|
e.classList.remove('active');
|
|
5556
5624
|
var index = e.getAttribute('data-index');
|
|
5557
|
-
if (+index ===
|
|
5625
|
+
if (+index === _this41.activeSuggestion) {
|
|
5558
5626
|
e.classList.add('active');
|
|
5559
5627
|
}
|
|
5560
5628
|
});
|
|
@@ -5674,13 +5742,13 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5674
5742
|
}, {
|
|
5675
5743
|
key: "startSuggestionTimeout",
|
|
5676
5744
|
value: function startSuggestionTimeout() {
|
|
5677
|
-
var
|
|
5745
|
+
var _this42 = this;
|
|
5678
5746
|
if (this.suggestingTimeoutFn) {
|
|
5679
5747
|
clearTimeout(this.suggestingTimeoutFn);
|
|
5680
5748
|
}
|
|
5681
5749
|
this.suggestingTimeoutFn = setTimeout(function () {
|
|
5682
5750
|
// close the suggestions after inactivity for [suggestingTimeout] milliseconds
|
|
5683
|
-
|
|
5751
|
+
_this42.hideSuggestions(_this42);
|
|
5684
5752
|
}, this.options.suggestingTimeout);
|
|
5685
5753
|
}
|
|
5686
5754
|
}, {
|
|
@@ -5844,7 +5912,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
5844
5912
|
/* global WebsyDesigns */
|
|
5845
5913
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
5846
5914
|
function WebsyTemplate(elementId, options) {
|
|
5847
|
-
var
|
|
5915
|
+
var _this43 = this;
|
|
5848
5916
|
_classCallCheck(this, WebsyTemplate);
|
|
5849
5917
|
var DEFAULTS = {
|
|
5850
5918
|
listeners: {
|
|
@@ -5852,7 +5920,16 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5852
5920
|
}
|
|
5853
5921
|
};
|
|
5854
5922
|
this.options = _extends({}, DEFAULTS, options);
|
|
5855
|
-
|
|
5923
|
+
if (_typeof(elementId) === 'object') {
|
|
5924
|
+
if (elementId.id) {
|
|
5925
|
+
this.elementId = elementId.id;
|
|
5926
|
+
} else {
|
|
5927
|
+
elementId.id = WebsyDesigns.Utils.createIdentity();
|
|
5928
|
+
this.elementId = elementId.id;
|
|
5929
|
+
}
|
|
5930
|
+
} else {
|
|
5931
|
+
this.elementId = elementId;
|
|
5932
|
+
}
|
|
5856
5933
|
this.templateService = new WebsyDesigns.APIService('');
|
|
5857
5934
|
if (!elementId) {
|
|
5858
5935
|
console.log('No element Id provided for Websy Template');
|
|
@@ -5864,8 +5941,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5864
5941
|
}
|
|
5865
5942
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
5866
5943
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
5867
|
-
|
|
5868
|
-
|
|
5944
|
+
_this43.options.template = templateString;
|
|
5945
|
+
_this43.render();
|
|
5869
5946
|
});
|
|
5870
5947
|
} else {
|
|
5871
5948
|
this.render();
|
|
@@ -5874,7 +5951,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5874
5951
|
_createClass(WebsyTemplate, [{
|
|
5875
5952
|
key: "buildHTML",
|
|
5876
5953
|
value: function buildHTML() {
|
|
5877
|
-
var
|
|
5954
|
+
var _this44 = this;
|
|
5878
5955
|
var html = "";
|
|
5879
5956
|
if (this.options.template) {
|
|
5880
5957
|
var template = this.options.template;
|
|
@@ -5923,14 +6000,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5923
6000
|
}
|
|
5924
6001
|
}
|
|
5925
6002
|
if (polarity === true) {
|
|
5926
|
-
if (typeof
|
|
6003
|
+
if (typeof _this44.options.data[parts[0]] !== 'undefined' && _this44.options.data[parts[0]] === parts[1]) {
|
|
5927
6004
|
// remove the <if> tags
|
|
5928
6005
|
removeAll = false;
|
|
5929
6006
|
} else if (parts[0] === parts[1]) {
|
|
5930
6007
|
removeAll = false;
|
|
5931
6008
|
}
|
|
5932
6009
|
} else if (polarity === false) {
|
|
5933
|
-
if (typeof
|
|
6010
|
+
if (typeof _this44.options.data[parts[0]] !== 'undefined' && _this44.options.data[parts[0]] !== parts[1]) {
|
|
5934
6011
|
// remove the <if> tags
|
|
5935
6012
|
removeAll = false;
|
|
5936
6013
|
}
|
|
@@ -5964,6 +6041,12 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5964
6041
|
}
|
|
5965
6042
|
return html;
|
|
5966
6043
|
}
|
|
6044
|
+
}, {
|
|
6045
|
+
key: "data",
|
|
6046
|
+
set: function set(d) {
|
|
6047
|
+
this.options.data = d;
|
|
6048
|
+
this.render();
|
|
6049
|
+
}
|
|
5967
6050
|
}, {
|
|
5968
6051
|
key: "handleClick",
|
|
5969
6052
|
value: function handleClick(event) {
|
|
@@ -6243,7 +6326,7 @@ var WebsyUtils = {
|
|
|
6243
6326
|
/* global WebsyDesigns */
|
|
6244
6327
|
var WebsyTable = /*#__PURE__*/function () {
|
|
6245
6328
|
function WebsyTable(elementId, options) {
|
|
6246
|
-
var
|
|
6329
|
+
var _this45 = this;
|
|
6247
6330
|
_classCallCheck(this, WebsyTable);
|
|
6248
6331
|
var DEFAULTS = {
|
|
6249
6332
|
pageSize: 20,
|
|
@@ -6276,8 +6359,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6276
6359
|
allowClear: false,
|
|
6277
6360
|
disableSearch: true,
|
|
6278
6361
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
6279
|
-
if (
|
|
6280
|
-
|
|
6362
|
+
if (_this45.options.onChangePageSize) {
|
|
6363
|
+
_this45.options.onChangePageSize(selectedItem.value);
|
|
6281
6364
|
}
|
|
6282
6365
|
}
|
|
6283
6366
|
});
|
|
@@ -6301,20 +6384,20 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6301
6384
|
}, {
|
|
6302
6385
|
key: "appendRows",
|
|
6303
6386
|
value: function appendRows(data) {
|
|
6304
|
-
var
|
|
6387
|
+
var _this46 = this;
|
|
6305
6388
|
this._isRendered = false;
|
|
6306
6389
|
this.hideError();
|
|
6307
6390
|
var bodyHTML = '';
|
|
6308
6391
|
if (data) {
|
|
6309
6392
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
6310
6393
|
return '<tr>' + r.map(function (c, i) {
|
|
6311
|
-
if (
|
|
6394
|
+
if (_this46.options.columns[i].show !== false) {
|
|
6312
6395
|
var style = '';
|
|
6313
6396
|
if (c.style) {
|
|
6314
6397
|
style += c.style;
|
|
6315
6398
|
}
|
|
6316
|
-
if (
|
|
6317
|
-
style += "width: ".concat(
|
|
6399
|
+
if (_this46.options.columns[i].width) {
|
|
6400
|
+
style += "width: ".concat(_this46.options.columns[i].width, "; ");
|
|
6318
6401
|
}
|
|
6319
6402
|
if (c.backgroundColor) {
|
|
6320
6403
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -6325,16 +6408,16 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6325
6408
|
if (c.color) {
|
|
6326
6409
|
style += "color: ".concat(c.color, "; ");
|
|
6327
6410
|
}
|
|
6328
|
-
if (
|
|
6329
|
-
return "\n <td \n data-row-index='".concat(
|
|
6330
|
-
} else if ((
|
|
6331
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
6411
|
+
if (_this46.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
6412
|
+
return "\n <td \n data-row-index='".concat(_this46.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this46.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(_this46.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this46.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
6413
|
+
} else if ((_this46.options.columns[i].showAsNavigatorLink === true || _this46.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
6414
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this46.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this46.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this46.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this46.options.columns[i].linkText || c.value, "</td>\n ");
|
|
6332
6415
|
} else {
|
|
6333
6416
|
var info = c.value;
|
|
6334
|
-
if (
|
|
6417
|
+
if (_this46.options.columns[i].showAsImage === true) {
|
|
6335
6418
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
6336
6419
|
}
|
|
6337
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
6420
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this46.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this46.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 ");
|
|
6338
6421
|
}
|
|
6339
6422
|
}
|
|
6340
6423
|
}).join('') + '</tr>';
|
|
@@ -6494,7 +6577,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6494
6577
|
}, {
|
|
6495
6578
|
key: "render",
|
|
6496
6579
|
value: function render(data) {
|
|
6497
|
-
var
|
|
6580
|
+
var _this47 = this;
|
|
6498
6581
|
this._isRendered = false;
|
|
6499
6582
|
if (!this.options.columns) {
|
|
6500
6583
|
return;
|
|
@@ -6522,7 +6605,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6522
6605
|
if (c.width) {
|
|
6523
6606
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
6524
6607
|
}
|
|
6525
|
-
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 ?
|
|
6608
|
+
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 ? _this47.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
6526
6609
|
}
|
|
6527
6610
|
}).join('') + '</tr>';
|
|
6528
6611
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6540,7 +6623,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6540
6623
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
6541
6624
|
if (pagingEl) {
|
|
6542
6625
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6543
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6626
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this47.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6544
6627
|
});
|
|
6545
6628
|
var startIndex = 0;
|
|
6546
6629
|
if (this.options.pageCount > 8) {
|
|
@@ -6596,7 +6679,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6596
6679
|
/* global WebsyDesigns */
|
|
6597
6680
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
6598
6681
|
function WebsyTable2(elementId, options) {
|
|
6599
|
-
var
|
|
6682
|
+
var _this48 = this;
|
|
6600
6683
|
_classCallCheck(this, WebsyTable2);
|
|
6601
6684
|
var DEFAULTS = {
|
|
6602
6685
|
pageSize: 20,
|
|
@@ -6631,8 +6714,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6631
6714
|
allowClear: false,
|
|
6632
6715
|
disableSearch: true,
|
|
6633
6716
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
6634
|
-
if (
|
|
6635
|
-
|
|
6717
|
+
if (_this48.options.onChangePageSize) {
|
|
6718
|
+
_this48.options.onChangePageSize(selectedItem.value);
|
|
6636
6719
|
}
|
|
6637
6720
|
}
|
|
6638
6721
|
});
|
|
@@ -6654,20 +6737,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6654
6737
|
_createClass(WebsyTable2, [{
|
|
6655
6738
|
key: "appendRows",
|
|
6656
6739
|
value: function appendRows(data) {
|
|
6657
|
-
var
|
|
6740
|
+
var _this49 = this;
|
|
6658
6741
|
this.hideError();
|
|
6659
6742
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6660
6743
|
var bodyHTML = '';
|
|
6661
6744
|
if (data) {
|
|
6662
6745
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
6663
6746
|
return '<tr>' + r.map(function (c, i) {
|
|
6664
|
-
if (
|
|
6665
|
-
var style = "height: ".concat(
|
|
6747
|
+
if (_this49.options.columns[i].show !== false) {
|
|
6748
|
+
var style = "height: ".concat(_this49.options.cellSize, "px; line-height: ").concat(_this49.options.cellSize, "px;");
|
|
6666
6749
|
if (c.style) {
|
|
6667
6750
|
style += c.style;
|
|
6668
6751
|
}
|
|
6669
|
-
if (
|
|
6670
|
-
style += "width: ".concat(
|
|
6752
|
+
if (_this49.options.columns[i].width) {
|
|
6753
|
+
style += "width: ".concat(_this49.options.columns[i].width, "; ");
|
|
6671
6754
|
}
|
|
6672
6755
|
if (c.backgroundColor) {
|
|
6673
6756
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -6678,16 +6761,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6678
6761
|
if (c.color) {
|
|
6679
6762
|
style += "color: ".concat(c.color, "; ");
|
|
6680
6763
|
}
|
|
6681
|
-
if (
|
|
6682
|
-
return "\n <td \n data-row-index='".concat(
|
|
6683
|
-
} else if ((
|
|
6684
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
6764
|
+
if (_this49.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
6765
|
+
return "\n <td \n data-row-index='".concat(_this49.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this49.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(_this49.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this49.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
6766
|
+
} else if ((_this49.options.columns[i].showAsNavigatorLink === true || _this49.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
6767
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this49.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this49.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this49.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this49.options.columns[i].linkText || c.value, "</td>\n ");
|
|
6685
6768
|
} else {
|
|
6686
6769
|
var info = c.value;
|
|
6687
|
-
if (
|
|
6770
|
+
if (_this49.options.columns[i].showAsImage === true) {
|
|
6688
6771
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
6689
6772
|
}
|
|
6690
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
6773
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this49.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this49.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 ");
|
|
6691
6774
|
}
|
|
6692
6775
|
}
|
|
6693
6776
|
}).join('') + '</tr>';
|
|
@@ -6921,7 +7004,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6921
7004
|
}, {
|
|
6922
7005
|
key: "render",
|
|
6923
7006
|
value: function render(data) {
|
|
6924
|
-
var
|
|
7007
|
+
var _this50 = this;
|
|
6925
7008
|
if (!this.options.columns) {
|
|
6926
7009
|
return;
|
|
6927
7010
|
}
|
|
@@ -6949,7 +7032,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6949
7032
|
if (c.width) {
|
|
6950
7033
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
6951
7034
|
}
|
|
6952
|
-
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 ?
|
|
7035
|
+
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 ? _this50.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6953
7036
|
}
|
|
6954
7037
|
}).join('') + '</tr>';
|
|
6955
7038
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6959,7 +7042,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6959
7042
|
var dropdownHTML = "";
|
|
6960
7043
|
this.options.columns.forEach(function (c, i) {
|
|
6961
7044
|
if (c.searchable && c.searchField) {
|
|
6962
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
7045
|
+
dropdownHTML += "\n <div id=\"".concat(_this50.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
6963
7046
|
}
|
|
6964
7047
|
});
|
|
6965
7048
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -6979,7 +7062,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6979
7062
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
6980
7063
|
if (pagingEl) {
|
|
6981
7064
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6982
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
7065
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this50.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6983
7066
|
});
|
|
6984
7067
|
var startIndex = 0;
|
|
6985
7068
|
if (this.options.pageCount > 8) {
|
|
@@ -7056,17 +7139,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
7056
7139
|
}, {
|
|
7057
7140
|
key: "getColumnParameters",
|
|
7058
7141
|
value: function getColumnParameters(values) {
|
|
7059
|
-
var
|
|
7142
|
+
var _this51 = this;
|
|
7060
7143
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
7061
7144
|
tableEl.style.tableLayout = 'auto';
|
|
7062
7145
|
tableEl.style.width = 'auto';
|
|
7063
7146
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
7064
7147
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
7065
7148
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
7066
|
-
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 ?
|
|
7149
|
+
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 ? _this51.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
7067
7150
|
}).join('') + '</tr>';
|
|
7068
7151
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
7069
|
-
return "\n <td \n style='height: ".concat(
|
|
7152
|
+
return "\n <td \n style='height: ".concat(_this51.options.cellSize, "px; line-height: ").concat(_this51.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
7070
7153
|
}).join('') + '</tr>';
|
|
7071
7154
|
// get height of the first data cell
|
|
7072
7155
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -7230,7 +7313,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7230
7313
|
}, {
|
|
7231
7314
|
key: "buildBodyHtml",
|
|
7232
7315
|
value: function buildBodyHtml() {
|
|
7233
|
-
var
|
|
7316
|
+
var _this52 = this;
|
|
7234
7317
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
7235
7318
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
7236
7319
|
if (!this.options.columns) {
|
|
@@ -7255,7 +7338,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7255
7338
|
row.forEach(function (cell, cellIndex) {
|
|
7256
7339
|
var sizeIndex = cell.level || cellIndex;
|
|
7257
7340
|
var colIndex = cell.index || cellIndex;
|
|
7258
|
-
if (typeof sizingColumns[sizeIndex] === 'undefined' ||
|
|
7341
|
+
if (typeof sizingColumns[sizeIndex] === 'undefined' || _this52.options.columns[_this52.options.columns.length - 1][colIndex].show === false) {
|
|
7259
7342
|
return; // need to revisit this logic
|
|
7260
7343
|
}
|
|
7261
7344
|
|
|
@@ -7282,7 +7365,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7282
7365
|
style += "color: ".concat(cell.color, "; ");
|
|
7283
7366
|
}
|
|
7284
7367
|
// console.log('rowspan', cell.rowspan)
|
|
7285
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex <
|
|
7368
|
+
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this52.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value.replace ? cell.value.replace(/'/g, '`') : cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(colIndex, "'\n ");
|
|
7286
7369
|
// if (useWidths === true) {
|
|
7287
7370
|
// bodyHtml += `
|
|
7288
7371
|
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
@@ -7291,10 +7374,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7291
7374
|
// }
|
|
7292
7375
|
bodyHtml += "\n ><div \n style='".concat(divStyle, "' \n class='websy-table-cell-content'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(colIndex, "'\n >");
|
|
7293
7376
|
if (cell.expandable === true) {
|
|
7294
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(
|
|
7377
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this52.options.plusIcon, "</i>");
|
|
7295
7378
|
}
|
|
7296
7379
|
if (cell.collapsable === true) {
|
|
7297
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(
|
|
7380
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this52.options.minusIcon, "</i>");
|
|
7298
7381
|
}
|
|
7299
7382
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
7300
7383
|
cell.value = "\n <a href=\"".concat(encodeURI(cell.value), "\" target='").concat(sizingColumns[sizeIndex].openInNewTab === true ? '_blank' : '_self', "'>").concat(cell.displayText || sizingColumns[sizeIndex].linkText || cell.value, "</a>\n ");
|
|
@@ -7315,7 +7398,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7315
7398
|
}, {
|
|
7316
7399
|
key: "buildHeaderHtml",
|
|
7317
7400
|
value: function buildHeaderHtml() {
|
|
7318
|
-
var
|
|
7401
|
+
var _this53 = this;
|
|
7319
7402
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
7320
7403
|
if (!this.options.columns) {
|
|
7321
7404
|
return '';
|
|
@@ -7336,7 +7419,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7336
7419
|
// // if we're calculating the size we only want to render the last row of column headers
|
|
7337
7420
|
// return
|
|
7338
7421
|
// }
|
|
7339
|
-
headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !==
|
|
7422
|
+
headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !== _this53.options.columns.length - 1 ? 'websy-table-parent-header' : '', "\">");
|
|
7340
7423
|
row.filter(function (c) {
|
|
7341
7424
|
return c.show !== false;
|
|
7342
7425
|
}).forEach(function (col, colIndex) {
|
|
@@ -7356,24 +7439,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7356
7439
|
if (col.style) {
|
|
7357
7440
|
style += col.style;
|
|
7358
7441
|
}
|
|
7359
|
-
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex <
|
|
7442
|
+
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this53.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
7360
7443
|
// if (useWidths === true && rowIndex === this.options.columns.length - 1) {
|
|
7361
7444
|
// headerHtml += `
|
|
7362
7445
|
// style='width: ${col.width || col.actualWidth}px'
|
|
7363
7446
|
// width='${col.width || col.actualWidth}'
|
|
7364
7447
|
// `
|
|
7365
7448
|
// }
|
|
7366
|
-
headerHtml += ">\n <div \n style='".concat(divStyle, "'\n data-col-index=\"").concat(colIndex, "\"\n class='").concat(['asc', 'desc'].indexOf(col.sort) !== -1 ? 'sortable-column' : '', "'\n >\n ").concat(col.name).concat(col.activeSort ?
|
|
7449
|
+
headerHtml += ">\n <div \n style='".concat(divStyle, "'\n data-col-index=\"").concat(colIndex, "\"\n class='").concat(['asc', 'desc'].indexOf(col.sort) !== -1 ? 'sortable-column' : '', "'\n >\n ").concat(col.name).concat(col.activeSort ? _this53.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this53.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
|
|
7367
7450
|
});
|
|
7368
7451
|
headerHtml += "</tr>";
|
|
7369
7452
|
});
|
|
7370
7453
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
7371
7454
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
7372
7455
|
if (c.searchable && c.isExternalSearch === true) {
|
|
7373
|
-
var testEl = document.getElementById("".concat(
|
|
7456
|
+
var testEl = document.getElementById("".concat(_this53.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
7374
7457
|
if (!testEl) {
|
|
7375
7458
|
var newE = document.createElement('div');
|
|
7376
|
-
newE.id = "".concat(
|
|
7459
|
+
newE.id = "".concat(_this53.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
7377
7460
|
newE.className = 'websy-modal-dropdown';
|
|
7378
7461
|
dropdownEl.appendChild(newE);
|
|
7379
7462
|
}
|
|
@@ -7396,7 +7479,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7396
7479
|
}, {
|
|
7397
7480
|
key: "buildTotalHtml",
|
|
7398
7481
|
value: function buildTotalHtml() {
|
|
7399
|
-
var
|
|
7482
|
+
var _this54 = this;
|
|
7400
7483
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
7401
7484
|
if (!this.options.totals) {
|
|
7402
7485
|
return '';
|
|
@@ -7412,7 +7495,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7412
7495
|
|
|
7413
7496
|
totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
7414
7497
|
if (useWidths === true) {
|
|
7415
|
-
totalHtml += "\n style='width: ".concat(
|
|
7498
|
+
totalHtml += "\n style='width: ".concat(_this54.options.columns[_this54.options.columns.length - 1][colIndex].width || _this54.options.columns[_this54.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
7416
7499
|
}
|
|
7417
7500
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
7418
7501
|
});
|
|
@@ -7422,7 +7505,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7422
7505
|
}, {
|
|
7423
7506
|
key: "calculateSizes",
|
|
7424
7507
|
value: function calculateSizes() {
|
|
7425
|
-
var
|
|
7508
|
+
var _this55 = this;
|
|
7426
7509
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
7427
7510
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
7428
7511
|
var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -7466,7 +7549,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7466
7549
|
rows.forEach(function (row, rowIndex) {
|
|
7467
7550
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
7468
7551
|
var colSize = col.getBoundingClientRect();
|
|
7469
|
-
|
|
7552
|
+
_this55.sizes.cellHeight = colSize.height;
|
|
7470
7553
|
if (columnsForSizing[colIndex]) {
|
|
7471
7554
|
if (!columnsForSizing[colIndex].actualWidth) {
|
|
7472
7555
|
columnsForSizing[colIndex].potentialWidth = 0;
|
|
@@ -7478,7 +7561,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7478
7561
|
// columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
|
|
7479
7562
|
// }
|
|
7480
7563
|
columnsForSizing[colIndex].cellHeight = colSize.height;
|
|
7481
|
-
if (colIndex >=
|
|
7564
|
+
if (colIndex >= _this55.pinnedColumns) {
|
|
7482
7565
|
firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
|
|
7483
7566
|
}
|
|
7484
7567
|
}
|
|
@@ -7493,7 +7576,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7493
7576
|
return a + (b.width || b.actualWidth);
|
|
7494
7577
|
}, 0);
|
|
7495
7578
|
this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
|
|
7496
|
-
return i >=
|
|
7579
|
+
return i >= _this55.pinnedColumns;
|
|
7497
7580
|
}).reduce(function (a, b) {
|
|
7498
7581
|
return a + (b.width || b.actualWidth);
|
|
7499
7582
|
}, 0);
|
|
@@ -7504,7 +7587,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7504
7587
|
var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
|
|
7505
7588
|
columnsForSizing.forEach(function (c) {
|
|
7506
7589
|
c.shouldGrow = true;
|
|
7507
|
-
if (
|
|
7590
|
+
if (_this55.options.autoFitColumns === false) {
|
|
7508
7591
|
c.shouldGrow = false;
|
|
7509
7592
|
if (c.potentialWidth > c.actualWidth) {
|
|
7510
7593
|
c.shouldGrow = true;
|
|
@@ -7523,7 +7606,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7523
7606
|
// if (!c.width) {
|
|
7524
7607
|
// if (c.actualWidth < equalWidth) {
|
|
7525
7608
|
// adjust the width
|
|
7526
|
-
if (
|
|
7609
|
+
if (_this55.options.autoFitColumns === true) {
|
|
7527
7610
|
if (c.width) {
|
|
7528
7611
|
c.width += equalWidth;
|
|
7529
7612
|
}
|
|
@@ -7547,9 +7630,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7547
7630
|
}
|
|
7548
7631
|
// }
|
|
7549
7632
|
// }
|
|
7550
|
-
|
|
7551
|
-
if (i >
|
|
7552
|
-
|
|
7633
|
+
_this55.sizes.totalWidth += c.width || c.actualWidth;
|
|
7634
|
+
if (i > _this55.pinnedColumns) {
|
|
7635
|
+
_this55.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
7553
7636
|
}
|
|
7554
7637
|
// equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
7555
7638
|
});
|
|
@@ -7608,7 +7691,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7608
7691
|
}, {
|
|
7609
7692
|
key: "createSample",
|
|
7610
7693
|
value: function createSample(data) {
|
|
7611
|
-
var
|
|
7694
|
+
var _this56 = this;
|
|
7612
7695
|
var output = [];
|
|
7613
7696
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
7614
7697
|
if (col.maxLength) {
|
|
@@ -7618,7 +7701,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7618
7701
|
} else if (data) {
|
|
7619
7702
|
var longest = '';
|
|
7620
7703
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
7621
|
-
if (data[i].length ===
|
|
7704
|
+
if (data[i].length === _this56.options.columns[_this56.options.columns.length - 1].length) {
|
|
7622
7705
|
if (longest.length < data[i][colIndex].value.length) {
|
|
7623
7706
|
longest = data[i][colIndex].value;
|
|
7624
7707
|
}
|
|
@@ -7890,7 +7973,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7890
7973
|
}, {
|
|
7891
7974
|
key: "perpetualScroll",
|
|
7892
7975
|
value: function perpetualScroll() {
|
|
7893
|
-
var
|
|
7976
|
+
var _this57 = this;
|
|
7894
7977
|
// if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
|
|
7895
7978
|
if (this.touchEndTime - this.currentTouchtime > 300) {
|
|
7896
7979
|
return;
|
|
@@ -7909,17 +7992,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7909
7992
|
var direction = touchDistance > 0 ? -1 : 1;
|
|
7910
7993
|
var _loop2 = function _loop2(i) {
|
|
7911
7994
|
setTimeout(function () {
|
|
7912
|
-
var delta =
|
|
7995
|
+
var delta = _this57.mouseYStart - _this57.currentClientY + _this57.sizes.cellHeight * (i + 1) * direction;
|
|
7913
7996
|
delta = Math.min(10, delta);
|
|
7914
7997
|
delta = Math.max(-10, delta);
|
|
7915
7998
|
// only run this if isPerpetual === true
|
|
7916
7999
|
// this value is reset to false on touchStart
|
|
7917
|
-
if (
|
|
8000
|
+
if (_this57.isPerpetual === true) {
|
|
7918
8001
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
|
|
7919
8002
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
|
|
7920
|
-
|
|
7921
|
-
if (
|
|
7922
|
-
clearTimeout(
|
|
8003
|
+
_this57.scrollY(Math.max(-5, Math.min(5, delta)));
|
|
8004
|
+
if (_this57.scrollTimeout) {
|
|
8005
|
+
clearTimeout(_this57.scrollTimeout);
|
|
7923
8006
|
}
|
|
7924
8007
|
}
|
|
7925
8008
|
}, 1000 / fps * i);
|
|
@@ -8187,7 +8270,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
8187
8270
|
/* global d3 include WebsyDesigns */
|
|
8188
8271
|
var WebsyChart = /*#__PURE__*/function () {
|
|
8189
8272
|
function WebsyChart(elementId, options) {
|
|
8190
|
-
var
|
|
8273
|
+
var _this58 = this;
|
|
8191
8274
|
_classCallCheck(this, WebsyChart);
|
|
8192
8275
|
var DEFAULTS = {
|
|
8193
8276
|
margin: {
|
|
@@ -8246,7 +8329,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8246
8329
|
this.invertOverride = function (input, input2) {
|
|
8247
8330
|
var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
8248
8331
|
var xAxis = 'bottom';
|
|
8249
|
-
if (
|
|
8332
|
+
if (_this58.options.orientation === 'horizontal') {
|
|
8250
8333
|
xAxis = 'left';
|
|
8251
8334
|
}
|
|
8252
8335
|
if (forBrush === true) {
|
|
@@ -8254,12 +8337,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8254
8337
|
}
|
|
8255
8338
|
xAxis += 'Axis';
|
|
8256
8339
|
var output;
|
|
8257
|
-
var width =
|
|
8340
|
+
var width = _this58.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
|
|
8258
8341
|
// if (this.customBottomRange) {
|
|
8259
|
-
for (var index = 0; index <
|
|
8260
|
-
if (input >
|
|
8261
|
-
if (
|
|
8262
|
-
if (input <
|
|
8342
|
+
for (var index = 0; index < _this58.customBottomRange.length; index++) {
|
|
8343
|
+
if (input > _this58.customBottomRange[index]) {
|
|
8344
|
+
if (_this58.customBottomRange[index + 1]) {
|
|
8345
|
+
if (input < _this58.customBottomRange[index + 1]) {
|
|
8263
8346
|
output = index;
|
|
8264
8347
|
break;
|
|
8265
8348
|
}
|
|
@@ -8424,9 +8507,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8424
8507
|
}, {
|
|
8425
8508
|
key: "handleEventMouseMove",
|
|
8426
8509
|
value: function handleEventMouseMove(event, d) {
|
|
8427
|
-
var
|
|
8510
|
+
var _this59 = this;
|
|
8428
8511
|
var bisectDate = d3.bisector(function (d) {
|
|
8429
|
-
return
|
|
8512
|
+
return _this59.parseX(d.x.value);
|
|
8430
8513
|
}).left;
|
|
8431
8514
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
8432
8515
|
var xAxis = 'bottomAxis';
|
|
@@ -8459,9 +8542,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8459
8542
|
xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
|
|
8460
8543
|
}
|
|
8461
8544
|
this.options.data.series.forEach(function (s) {
|
|
8462
|
-
if (
|
|
8545
|
+
if (_this59.options.data[xData].scale !== 'Time') {
|
|
8463
8546
|
// if (this.customBottomRange && this.customBottomRange.length > 0) {
|
|
8464
|
-
xPoint =
|
|
8547
|
+
xPoint = _this59.customBottomRange[x0] + (_this59.customBottomRange[x0 + 1] - _this59.customBottomRange[x0]) / 2;
|
|
8465
8548
|
// }
|
|
8466
8549
|
// else {
|
|
8467
8550
|
// xPoint = this[xAxis](this.parseX(xLabel))
|
|
@@ -8481,41 +8564,41 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8481
8564
|
var index = bisectDate(s.data, x0, 1);
|
|
8482
8565
|
var pointA = s.data[index - 1];
|
|
8483
8566
|
var pointB = s.data[index];
|
|
8484
|
-
if (
|
|
8567
|
+
if (_this59.options.orientation === 'horizontal') {
|
|
8485
8568
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
8486
8569
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
8487
8570
|
}
|
|
8488
8571
|
if (pointA && !pointB) {
|
|
8489
|
-
xPoint =
|
|
8572
|
+
xPoint = _this59[xAxis](_this59.parseX(pointA.x.value));
|
|
8490
8573
|
tooltipTitle = pointA.x.value;
|
|
8491
8574
|
if (!pointA.y.color) {
|
|
8492
8575
|
pointA.y.color = s.color;
|
|
8493
8576
|
}
|
|
8494
8577
|
tooltipData.push(pointA);
|
|
8495
8578
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
8496
|
-
tooltipTitle = d3.timeFormat(
|
|
8579
|
+
tooltipTitle = d3.timeFormat(_this59.options.dateFormat || _this59.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
8497
8580
|
}
|
|
8498
8581
|
}
|
|
8499
8582
|
if (pointB && !pointA) {
|
|
8500
|
-
xPoint =
|
|
8583
|
+
xPoint = _this59[xAxis](_this59.parseX(pointB.x.value));
|
|
8501
8584
|
tooltipTitle = pointB.x.value;
|
|
8502
8585
|
if (!pointB.y.color) {
|
|
8503
8586
|
pointB.y.color = s.color;
|
|
8504
8587
|
}
|
|
8505
8588
|
tooltipData.push(pointB);
|
|
8506
8589
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8507
|
-
tooltipTitle = d3.timeFormat(
|
|
8590
|
+
tooltipTitle = d3.timeFormat(_this59.options.dateFormat || _this59.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8508
8591
|
}
|
|
8509
8592
|
}
|
|
8510
8593
|
if (pointA && pointB) {
|
|
8511
|
-
var d0 =
|
|
8512
|
-
var d1 =
|
|
8594
|
+
var d0 = _this59[xAxis](_this59.parseX(pointA.x.value));
|
|
8595
|
+
var d1 = _this59[xAxis](_this59.parseX(pointB.x.value));
|
|
8513
8596
|
var mid = Math.abs(d0 - d1) / 2;
|
|
8514
8597
|
if (d3.pointer(event)[0] - d0 >= mid) {
|
|
8515
8598
|
xPoint = d1;
|
|
8516
8599
|
tooltipTitle = pointB.x.value;
|
|
8517
8600
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8518
|
-
tooltipTitle = d3.timeFormat(
|
|
8601
|
+
tooltipTitle = d3.timeFormat(_this59.options.dateFormat || _this59.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8519
8602
|
}
|
|
8520
8603
|
if (!pointB.y.color) {
|
|
8521
8604
|
pointB.y.color = s.color;
|
|
@@ -8525,7 +8608,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8525
8608
|
xPoint = d0;
|
|
8526
8609
|
tooltipTitle = pointA.x.value;
|
|
8527
8610
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8528
|
-
tooltipTitle = d3.timeFormat(
|
|
8611
|
+
tooltipTitle = d3.timeFormat(_this59.options.dateFormat || _this59.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8529
8612
|
}
|
|
8530
8613
|
if (!pointA.y.color) {
|
|
8531
8614
|
pointA.y.color = s.color;
|
|
@@ -8651,7 +8734,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8651
8734
|
}, {
|
|
8652
8735
|
key: "render",
|
|
8653
8736
|
value: function render(options) {
|
|
8654
|
-
var
|
|
8737
|
+
var _this60 = this;
|
|
8655
8738
|
/* global d3 options WebsyUtils */
|
|
8656
8739
|
this._isRendered = false;
|
|
8657
8740
|
if (typeof options !== 'undefined') {
|
|
@@ -8720,7 +8803,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8720
8803
|
this.options.data.series.map(function (s, i) {
|
|
8721
8804
|
return {
|
|
8722
8805
|
value: s.label || s.key,
|
|
8723
|
-
color: s.color ||
|
|
8806
|
+
color: s.color || _this60.options.colors[i % _this60.options.colors.length]
|
|
8724
8807
|
};
|
|
8725
8808
|
});
|
|
8726
8809
|
}
|
|
@@ -9077,25 +9160,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9077
9160
|
if (this.options.data[customRangeSideLC].data && this.options.data[customRangeSideLC].data[0] && (this.options.data[customRangeSideLC].data[0].valueCount || 1) && this.options.data[customRangeSideLC].scale === 'Ordinal') {
|
|
9078
9161
|
var acc = 0;
|
|
9079
9162
|
this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
9080
|
-
var adjustment =
|
|
9163
|
+
var adjustment = _this60.bandPadding * index + _this60.bandPadding;
|
|
9081
9164
|
// if (this.options.data.bottom.padding) {
|
|
9082
9165
|
// adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
|
|
9083
9166
|
// }
|
|
9084
|
-
var start =
|
|
9167
|
+
var start = _this60.widthForCalc / noOfPoints * acc;
|
|
9085
9168
|
for (var i = 0; i < (d.valueCount || 1); i++) {
|
|
9086
9169
|
var pos = i * proposedBandWidth;
|
|
9087
|
-
|
|
9170
|
+
_this60["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
|
|
9088
9171
|
}
|
|
9089
|
-
acc +=
|
|
9090
|
-
var end =
|
|
9172
|
+
acc += _this60.options.grouping !== 'stacked' && _this60.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
9173
|
+
var end = _this60.widthForCalc / noOfPoints * acc;
|
|
9091
9174
|
// this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
|
|
9092
9175
|
return end + adjustment;
|
|
9093
9176
|
})));
|
|
9094
9177
|
acc = 0;
|
|
9095
9178
|
this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
9096
|
-
var adjustment =
|
|
9097
|
-
acc +=
|
|
9098
|
-
return (
|
|
9179
|
+
var adjustment = _this60.brushBandPadding * index + _this60.brushBandPadding;
|
|
9180
|
+
acc += _this60.options.grouping !== 'stacked' && _this60.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
9181
|
+
return (_this60.options.orientation === 'vertical' ? _this60.plotWidth : _this60.plotHeight) / noOfPoints * acc;
|
|
9099
9182
|
})));
|
|
9100
9183
|
}
|
|
9101
9184
|
// }
|
|
@@ -9268,7 +9351,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9268
9351
|
this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
|
|
9269
9352
|
if (this.options.data.bottom.formatter) {
|
|
9270
9353
|
this.bAxisFunc.tickFormat(function (d) {
|
|
9271
|
-
return
|
|
9354
|
+
return _this60.options.data.bottom.formatter(d);
|
|
9272
9355
|
});
|
|
9273
9356
|
}
|
|
9274
9357
|
this.bottomAxisLayer.call(this.bAxisFunc);
|
|
@@ -9278,7 +9361,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9278
9361
|
}
|
|
9279
9362
|
if (this.customBottomRange.length > 0) {
|
|
9280
9363
|
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
9281
|
-
return "translate(".concat(
|
|
9364
|
+
return "translate(".concat(_this60.customBottomRange[i] + (_this60.customBottomRange[i + 1] - _this60.customBottomRange[i]) / 2, ", 0)");
|
|
9282
9365
|
});
|
|
9283
9366
|
}
|
|
9284
9367
|
}
|
|
@@ -9297,14 +9380,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9297
9380
|
}
|
|
9298
9381
|
if (this.options.margin.axisLeft > 0) {
|
|
9299
9382
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
9300
|
-
if (
|
|
9301
|
-
d =
|
|
9383
|
+
if (_this60.options.data.left.formatter) {
|
|
9384
|
+
d = _this60.options.data.left.formatter(d);
|
|
9302
9385
|
}
|
|
9303
9386
|
return d;
|
|
9304
9387
|
}));
|
|
9305
9388
|
if (this.customLeftRange.length > 0) {
|
|
9306
9389
|
this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
9307
|
-
return "translate(0, ".concat(
|
|
9390
|
+
return "translate(0, ".concat(_this60.customLeftRange[i] + (_this60.customLeftRange[i + 1] - _this60.customLeftRange[i]) / 2, ")");
|
|
9308
9391
|
});
|
|
9309
9392
|
}
|
|
9310
9393
|
}
|
|
@@ -9332,8 +9415,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9332
9415
|
}
|
|
9333
9416
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
9334
9417
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
|
|
9335
|
-
if (
|
|
9336
|
-
d =
|
|
9418
|
+
if (_this60.options.data.right.formatter) {
|
|
9419
|
+
d = _this60.options.data.right.formatter(d);
|
|
9337
9420
|
}
|
|
9338
9421
|
return d;
|
|
9339
9422
|
}));
|
|
@@ -9373,25 +9456,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9373
9456
|
}, {
|
|
9374
9457
|
key: "renderComponents",
|
|
9375
9458
|
value: function renderComponents() {
|
|
9376
|
-
var
|
|
9459
|
+
var _this61 = this;
|
|
9377
9460
|
// Draw the series data
|
|
9378
9461
|
this.renderedKeys = {};
|
|
9379
9462
|
this.options.data.series.forEach(function (series, index) {
|
|
9380
9463
|
if (!series.key) {
|
|
9381
|
-
series.key =
|
|
9464
|
+
series.key = _this61.createIdentity();
|
|
9382
9465
|
}
|
|
9383
9466
|
if (!series.color) {
|
|
9384
|
-
series.color =
|
|
9467
|
+
series.color = _this61.options.colors[index % _this61.options.colors.length];
|
|
9385
9468
|
}
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9469
|
+
_this61["render".concat(series.type || 'bar')](series, index);
|
|
9470
|
+
_this61.renderLabels(series, index);
|
|
9471
|
+
_this61.renderedKeys[series.key] = series.type;
|
|
9389
9472
|
});
|
|
9390
9473
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
9391
9474
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
9392
9475
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
9393
9476
|
this.options.refLines.forEach(function (l) {
|
|
9394
|
-
return
|
|
9477
|
+
return _this61.renderRefLine(l);
|
|
9395
9478
|
});
|
|
9396
9479
|
}
|
|
9397
9480
|
this._isRendered = true;
|
|
@@ -9399,25 +9482,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9399
9482
|
}, {
|
|
9400
9483
|
key: "renderarea",
|
|
9401
9484
|
value: function renderarea(series, index) {
|
|
9402
|
-
var
|
|
9485
|
+
var _this62 = this;
|
|
9403
9486
|
/* global d3 series index */
|
|
9404
9487
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
9405
9488
|
return d3.area().x(function (d) {
|
|
9406
|
-
if (
|
|
9407
|
-
return
|
|
9489
|
+
if (_this62.options.data[xAxis].scale === 'Time') {
|
|
9490
|
+
return _this62["".concat(xAxis, "Axis")](_this62.parseX(d.x.value));
|
|
9408
9491
|
} else {
|
|
9409
|
-
var xIndex =
|
|
9410
|
-
var xPos =
|
|
9411
|
-
if (
|
|
9412
|
-
xPos = xPos + (
|
|
9492
|
+
var xIndex = _this62[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9493
|
+
var xPos = _this62["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9494
|
+
if (_this62["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9495
|
+
xPos = xPos + (_this62["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9413
9496
|
}
|
|
9414
9497
|
return xPos;
|
|
9415
9498
|
}
|
|
9416
9499
|
}).y0(function (d) {
|
|
9417
|
-
return
|
|
9500
|
+
return _this62["".concat(yAxis, "Axis")](0);
|
|
9418
9501
|
}).y1(function (d) {
|
|
9419
|
-
return
|
|
9420
|
-
}).curve(d3[curveStyle ||
|
|
9502
|
+
return _this62["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9503
|
+
}).curve(d3[curveStyle || _this62.options.curveStyle]);
|
|
9421
9504
|
};
|
|
9422
9505
|
var xAxis = 'bottom';
|
|
9423
9506
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9457,7 +9540,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9457
9540
|
}, {
|
|
9458
9541
|
key: "renderbar",
|
|
9459
9542
|
value: function renderbar(series, index) {
|
|
9460
|
-
var
|
|
9543
|
+
var _this63 = this;
|
|
9461
9544
|
/* global series index d3 */
|
|
9462
9545
|
var xAxis = 'bottom';
|
|
9463
9546
|
var yAxis = 'left';
|
|
@@ -9624,26 +9707,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9624
9707
|
}
|
|
9625
9708
|
bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
9626
9709
|
bars.attr('width', function (d, i) {
|
|
9627
|
-
return Math.abs(getBarWidth.call(
|
|
9710
|
+
return Math.abs(getBarWidth.call(_this63, d, i, yAxis, xAxis));
|
|
9628
9711
|
}).attr('height', function (d, i) {
|
|
9629
|
-
return getBarHeight.call(
|
|
9712
|
+
return getBarHeight.call(_this63, d, i, yAxis, xAxis);
|
|
9630
9713
|
}).attr('x', function (d, i) {
|
|
9631
|
-
return getBarX.call(
|
|
9714
|
+
return getBarX.call(_this63, d, i, yAxis, xAxis);
|
|
9632
9715
|
}).attr('y', function (d, i) {
|
|
9633
|
-
return getBarY.call(
|
|
9716
|
+
return getBarY.call(_this63, d, i, yAxis, xAxis);
|
|
9634
9717
|
})
|
|
9635
9718
|
// .transition(this.transition)
|
|
9636
9719
|
.attr('fill', function (d) {
|
|
9637
9720
|
return d.y.color || d.color || series.color;
|
|
9638
9721
|
});
|
|
9639
9722
|
bars.enter().append('rect').attr('width', function (d, i) {
|
|
9640
|
-
return Math.abs(getBarWidth.call(
|
|
9723
|
+
return Math.abs(getBarWidth.call(_this63, d, i, yAxis, xAxis));
|
|
9641
9724
|
}).attr('height', function (d, i) {
|
|
9642
|
-
return getBarHeight.call(
|
|
9725
|
+
return getBarHeight.call(_this63, d, i, yAxis, xAxis);
|
|
9643
9726
|
}).attr('x', function (d, i) {
|
|
9644
|
-
return getBarX.call(
|
|
9727
|
+
return getBarX.call(_this63, d, i, yAxis, xAxis);
|
|
9645
9728
|
}).attr('y', function (d, i) {
|
|
9646
|
-
return getBarY.call(
|
|
9729
|
+
return getBarY.call(_this63, d, i, yAxis, xAxis);
|
|
9647
9730
|
})
|
|
9648
9731
|
// .transition(this.transition)
|
|
9649
9732
|
.attr('fill', function (d) {
|
|
@@ -9655,26 +9738,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9655
9738
|
this.brushBarsInitialized[series.key] = true;
|
|
9656
9739
|
brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
9657
9740
|
brushBars.attr('width', function (d, i) {
|
|
9658
|
-
return Math.abs(getBarWidth.call(
|
|
9741
|
+
return Math.abs(getBarWidth.call(_this63, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
9659
9742
|
}).attr('height', function (d, i) {
|
|
9660
|
-
return getBarHeight.call(
|
|
9743
|
+
return getBarHeight.call(_this63, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9661
9744
|
}).attr('x', function (d, i) {
|
|
9662
|
-
return getBarX.call(
|
|
9745
|
+
return getBarX.call(_this63, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9663
9746
|
}).attr('y', function (d, i) {
|
|
9664
|
-
return getBarY.call(
|
|
9747
|
+
return getBarY.call(_this63, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9665
9748
|
})
|
|
9666
9749
|
// .transition(this.transition)
|
|
9667
9750
|
.attr('fill', function (d) {
|
|
9668
9751
|
return d.y.color || d.color || series.color;
|
|
9669
9752
|
});
|
|
9670
9753
|
brushBars.enter().append('rect').attr('width', function (d, i) {
|
|
9671
|
-
return Math.abs(getBarWidth.call(
|
|
9754
|
+
return Math.abs(getBarWidth.call(_this63, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
9672
9755
|
}).attr('height', function (d, i) {
|
|
9673
|
-
return getBarHeight.call(
|
|
9756
|
+
return getBarHeight.call(_this63, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9674
9757
|
}).attr('x', function (d, i) {
|
|
9675
|
-
return getBarX.call(
|
|
9758
|
+
return getBarX.call(_this63, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9676
9759
|
}).attr('y', function (d, i) {
|
|
9677
|
-
return getBarY.call(
|
|
9760
|
+
return getBarY.call(_this63, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9678
9761
|
})
|
|
9679
9762
|
// .transition(this.transition)
|
|
9680
9763
|
.attr('fill', function (d) {
|
|
@@ -9695,7 +9778,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9695
9778
|
}, {
|
|
9696
9779
|
key: "renderLabels",
|
|
9697
9780
|
value: function renderLabels(series, index) {
|
|
9698
|
-
var
|
|
9781
|
+
var _this64 = this;
|
|
9699
9782
|
/* global series index d3 WebsyDesigns */
|
|
9700
9783
|
var xAxis = 'bottom';
|
|
9701
9784
|
var yAxis = 'left';
|
|
@@ -9711,14 +9794,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9711
9794
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
9712
9795
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
9713
9796
|
labels.attr('x', function (d) {
|
|
9714
|
-
return getLabelX.call(
|
|
9797
|
+
return getLabelX.call(_this64, d, series.labelPosition);
|
|
9715
9798
|
}).attr('y', function (d) {
|
|
9716
|
-
return getLabelY.call(
|
|
9799
|
+
return getLabelY.call(_this64, d, series.labelPosition);
|
|
9717
9800
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
9718
|
-
if (
|
|
9801
|
+
if (_this64.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9719
9802
|
return 'transparent';
|
|
9720
9803
|
}
|
|
9721
|
-
return
|
|
9804
|
+
return _this64.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9722
9805
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
9723
9806
|
return d.y.label || d.y.value;
|
|
9724
9807
|
}).each(function (d, i) {
|
|
@@ -9752,14 +9835,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9752
9835
|
}
|
|
9753
9836
|
});
|
|
9754
9837
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
9755
|
-
return getLabelX.call(
|
|
9838
|
+
return getLabelX.call(_this64, d, series.labelPosition);
|
|
9756
9839
|
}).attr('y', function (d) {
|
|
9757
|
-
return getLabelY.call(
|
|
9840
|
+
return getLabelY.call(_this64, d, series.labelPosition);
|
|
9758
9841
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
9759
|
-
if (
|
|
9842
|
+
if (_this64.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9760
9843
|
return 'transparent';
|
|
9761
9844
|
}
|
|
9762
|
-
return
|
|
9845
|
+
return _this64.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9763
9846
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
9764
9847
|
return d.y.label || d.y.value;
|
|
9765
9848
|
}).each(function (d, i) {
|
|
@@ -9837,32 +9920,32 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9837
9920
|
}, {
|
|
9838
9921
|
key: "renderline",
|
|
9839
9922
|
value: function renderline(series, index) {
|
|
9840
|
-
var
|
|
9923
|
+
var _this65 = this;
|
|
9841
9924
|
/* global series index d3 */
|
|
9842
9925
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
9843
9926
|
return d3.line().x(function (d) {
|
|
9844
|
-
if (
|
|
9845
|
-
return
|
|
9927
|
+
if (_this65.options.orientation === 'horizontal') {
|
|
9928
|
+
return _this65["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9846
9929
|
} else {
|
|
9847
|
-
if (
|
|
9848
|
-
return
|
|
9930
|
+
if (_this65.options.data[xAxis].scale === 'Time') {
|
|
9931
|
+
return _this65["".concat(xAxis, "Axis")](_this65.parseX(d.x.value));
|
|
9849
9932
|
} else {
|
|
9850
|
-
var xIndex =
|
|
9851
|
-
var xPos =
|
|
9852
|
-
if (
|
|
9853
|
-
xPos = xPos + (
|
|
9933
|
+
var xIndex = _this65[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9934
|
+
var xPos = _this65["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9935
|
+
if (_this65["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9936
|
+
xPos = xPos + (_this65["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9854
9937
|
}
|
|
9855
9938
|
return xPos;
|
|
9856
9939
|
}
|
|
9857
9940
|
}
|
|
9858
9941
|
}).y(function (d) {
|
|
9859
|
-
if (
|
|
9860
|
-
var adjustment =
|
|
9861
|
-
return
|
|
9942
|
+
if (_this65.options.orientation === 'horizontal') {
|
|
9943
|
+
var adjustment = _this65.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this65.options.data[xAxis].bandWidth / 2;
|
|
9944
|
+
return _this65["".concat(xAxis, "Axis")](_this65.parseX(d.x.value)) + adjustment;
|
|
9862
9945
|
} else {
|
|
9863
|
-
return
|
|
9946
|
+
return _this65["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9864
9947
|
}
|
|
9865
|
-
}).curve(d3[curveStyle ||
|
|
9948
|
+
}).curve(d3[curveStyle || _this65.options.curveStyle]);
|
|
9866
9949
|
};
|
|
9867
9950
|
var xAxis = 'bottom';
|
|
9868
9951
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9971,14 +10054,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9971
10054
|
}, {
|
|
9972
10055
|
key: "rendersymbol",
|
|
9973
10056
|
value: function rendersymbol(series, index) {
|
|
9974
|
-
var
|
|
10057
|
+
var _this66 = this;
|
|
9975
10058
|
/* global d3 series index series.key */
|
|
9976
10059
|
var drawSymbol = function drawSymbol(size) {
|
|
9977
10060
|
return d3.symbol()
|
|
9978
10061
|
// .type(d => {
|
|
9979
10062
|
// return d3.symbols[0]
|
|
9980
10063
|
// })
|
|
9981
|
-
.size(size ||
|
|
10064
|
+
.size(size || _this66.options.symbolSize);
|
|
9982
10065
|
};
|
|
9983
10066
|
var xAxis = 'bottom';
|
|
9984
10067
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -10004,27 +10087,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
10004
10087
|
// else {
|
|
10005
10088
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
10006
10089
|
// }
|
|
10007
|
-
var xIndex =
|
|
10008
|
-
var xPos =
|
|
10009
|
-
if (
|
|
10010
|
-
xPos = xPos + (
|
|
10011
|
-
}
|
|
10012
|
-
var adjustment =
|
|
10013
|
-
if (
|
|
10014
|
-
return "translate(".concat(
|
|
10090
|
+
var xIndex = _this66[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10091
|
+
var xPos = _this66["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
10092
|
+
if (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10093
|
+
xPos = xPos + (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
10094
|
+
}
|
|
10095
|
+
var adjustment = _this66.options.data[xAxis].scale === 'Time' || _this66.options.data[xAxis].scale === 'Linear' ? 0 : _this66.options.data[xAxis].bandWidth / 2;
|
|
10096
|
+
if (_this66.options.orientation === 'horizontal') {
|
|
10097
|
+
return "translate(".concat(_this66["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
10015
10098
|
} else {
|
|
10016
|
-
if (
|
|
10017
|
-
xPos =
|
|
10099
|
+
if (_this66.options.data[xAxis].scale === 'Time') {
|
|
10100
|
+
xPos = _this66["".concat(xAxis, "Axis")](_this66.parseX(d.x.value));
|
|
10018
10101
|
} else {
|
|
10019
|
-
var _xIndex =
|
|
10020
|
-
var _xPos =
|
|
10021
|
-
if (
|
|
10022
|
-
_xPos = _xPos + (
|
|
10102
|
+
var _xIndex = _this66[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10103
|
+
var _xPos = _this66["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
|
|
10104
|
+
if (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
|
|
10105
|
+
_xPos = _xPos + (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
|
|
10023
10106
|
}
|
|
10024
10107
|
// return xPos
|
|
10025
10108
|
}
|
|
10026
10109
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
10027
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
10110
|
+
return "translate(".concat(xPos, ", ").concat(_this66["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
10028
10111
|
}
|
|
10029
10112
|
});
|
|
10030
10113
|
// Enter
|
|
@@ -10039,27 +10122,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
10039
10122
|
}).attr('class', function (d) {
|
|
10040
10123
|
return "symbol symbol_".concat(series.key);
|
|
10041
10124
|
}).attr('transform', function (d) {
|
|
10042
|
-
var xIndex =
|
|
10043
|
-
var xPos =
|
|
10044
|
-
if (
|
|
10045
|
-
xPos = xPos + (
|
|
10046
|
-
}
|
|
10047
|
-
var adjustment =
|
|
10048
|
-
if (
|
|
10049
|
-
return "translate(".concat(
|
|
10125
|
+
var xIndex = _this66[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10126
|
+
var xPos = _this66["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
10127
|
+
if (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10128
|
+
xPos = xPos + (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
10129
|
+
}
|
|
10130
|
+
var adjustment = _this66.options.data[xAxis].scale === 'Time' || _this66.options.data[xAxis].scale === 'Linear' ? 0 : _this66.options.data[xAxis].bandWidth / 2;
|
|
10131
|
+
if (_this66.options.orientation === 'horizontal') {
|
|
10132
|
+
return "translate(".concat(_this66["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
10050
10133
|
} else {
|
|
10051
|
-
if (
|
|
10052
|
-
xPos =
|
|
10134
|
+
if (_this66.options.data[xAxis].scale === 'Time') {
|
|
10135
|
+
xPos = _this66["".concat(xAxis, "Axis")](_this66.parseX(d.x.value));
|
|
10053
10136
|
} else {
|
|
10054
|
-
var _xIndex2 =
|
|
10055
|
-
var _xPos2 =
|
|
10056
|
-
if (
|
|
10057
|
-
_xPos2 = _xPos2 + (
|
|
10137
|
+
var _xIndex2 = _this66[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10138
|
+
var _xPos2 = _this66["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
|
|
10139
|
+
if (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
|
|
10140
|
+
_xPos2 = _xPos2 + (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
|
|
10058
10141
|
}
|
|
10059
10142
|
// return xPos
|
|
10060
10143
|
}
|
|
10061
10144
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
10062
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
10145
|
+
return "translate(".concat(xPos, ", ").concat(_this66["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
10063
10146
|
}
|
|
10064
10147
|
});
|
|
10065
10148
|
}
|
|
@@ -10682,7 +10765,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
10682
10765
|
}, {
|
|
10683
10766
|
key: "resize",
|
|
10684
10767
|
value: function resize() {
|
|
10685
|
-
var
|
|
10768
|
+
var _this67 = this;
|
|
10686
10769
|
var el = document.getElementById(this.elementId);
|
|
10687
10770
|
if (el) {
|
|
10688
10771
|
// if (this.options.width) {
|
|
@@ -10693,7 +10776,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
10693
10776
|
// }
|
|
10694
10777
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
10695
10778
|
html += this._data.map(function (d, i) {
|
|
10696
|
-
return
|
|
10779
|
+
return _this67.getLegendItemHTML(d);
|
|
10697
10780
|
}).join('');
|
|
10698
10781
|
html += "\n <div>\n ";
|
|
10699
10782
|
el.innerHTML = html;
|
|
@@ -10774,7 +10857,7 @@ var WebsyKPI = /*#__PURE__*/function () {
|
|
|
10774
10857
|
if (this.options.icon) {
|
|
10775
10858
|
html += "\n <div class=\"websy-kpi-icon\"><img src=\"".concat(this.options.icon, "\"></div> \n ");
|
|
10776
10859
|
}
|
|
10777
|
-
html += " \n <div class=\"websy-kpi-info\">\n <div class=\"websy-kpi-label ".concat(this.options.label.classes.join(' ') || '', "\">\n
|
|
10860
|
+
html += " \n <div class=\"websy-kpi-info\">\n <div class=\"websy-kpi-label-container\">\n <div class=\"websy-kpi-label ".concat(this.options.label.classes.join(' ') || '', "\">\n ").concat((this.options.label || {}).value || '', "\n </div>\n ");
|
|
10778
10861
|
if (this.options.tooltip && this.options.tooltip.value) {
|
|
10779
10862
|
html += "\n <div class=\"websy-info ".concat(this.options.tooltip.classes.join(' ') || '', "\" data-info=\"").concat(this.options.tooltip.value, "\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><title>ionicons-v5-e</title><path d=\"M256,56C145.72,56,56,145.72,56,256s89.72,200,200,200,200-89.72,200-200S366.28,56,256,56Zm0,82a26,26,0,1,1-26,26A26,26,0,0,1,256,138Zm48,226H216a16,16,0,0,1,0-32h28V244H228a16,16,0,0,1,0-32h32a16,16,0,0,1,16,16V332h28a16,16,0,0,1,0,32Z\"/></svg>\n </div> \n ");
|
|
10780
10863
|
}
|
|
@@ -10851,7 +10934,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10851
10934
|
}, {
|
|
10852
10935
|
key: "render",
|
|
10853
10936
|
value: function render() {
|
|
10854
|
-
var
|
|
10937
|
+
var _this68 = this;
|
|
10855
10938
|
this._isRendered = false;
|
|
10856
10939
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
10857
10940
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -10859,7 +10942,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10859
10942
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
10860
10943
|
return {
|
|
10861
10944
|
value: s.label || s.key,
|
|
10862
|
-
color: s.color ||
|
|
10945
|
+
color: s.color || _this68.options.colors[i % _this68.options.colors.length]
|
|
10863
10946
|
};
|
|
10864
10947
|
});
|
|
10865
10948
|
var longestValue = legendData.map(function (s) {
|
|
@@ -10913,7 +10996,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10913
10996
|
}
|
|
10914
10997
|
if (this.polygons) {
|
|
10915
10998
|
this.polygons.forEach(function (p) {
|
|
10916
|
-
return
|
|
10999
|
+
return _this68.map.removeLayer(p);
|
|
10917
11000
|
});
|
|
10918
11001
|
}
|
|
10919
11002
|
this.polygons = [];
|
|
@@ -10967,15 +11050,15 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10967
11050
|
p.options = {};
|
|
10968
11051
|
}
|
|
10969
11052
|
if (!p.options.color) {
|
|
10970
|
-
p.options.color =
|
|
11053
|
+
p.options.color = _this68.options.colors[i % _this68.options.colors.length];
|
|
10971
11054
|
}
|
|
10972
11055
|
var pol = L.polygon(p.data.map(function (c) {
|
|
10973
11056
|
return c.map(function (d) {
|
|
10974
11057
|
return [d.Latitude, d.Longitude];
|
|
10975
11058
|
});
|
|
10976
|
-
}), p.options).addTo(
|
|
10977
|
-
|
|
10978
|
-
|
|
11059
|
+
}), p.options).addTo(_this68.map);
|
|
11060
|
+
_this68.polygons.push(pol);
|
|
11061
|
+
_this68.map.fitBounds(pol.getBounds());
|
|
10979
11062
|
});
|
|
10980
11063
|
}
|
|
10981
11064
|
// if (this.data.markers.length > 0) {
|