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