@websy/websy-designs 1.2.17 → 1.2.19
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 +31 -6
- package/dist/websy-designs-es6.js +222 -193
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +31 -6
- package/dist/websy-designs.js +222 -193
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -437,7 +437,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
437
437
|
}
|
|
438
438
|
} else {
|
|
439
439
|
if (this.options.mode === 'hour') {
|
|
440
|
-
var _hoursOut = this.
|
|
440
|
+
var _hoursOut = this.currentselection.map(function (h) {
|
|
441
441
|
return _this2.options.hours[h];
|
|
442
442
|
});
|
|
443
443
|
|
|
@@ -1053,19 +1053,47 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1053
1053
|
}
|
|
1054
1054
|
}, {
|
|
1055
1055
|
key: "selectCustomRange",
|
|
1056
|
-
value: function selectCustomRange(
|
|
1056
|
+
value: function selectCustomRange(rangeInput) {
|
|
1057
|
+
var _this6 = this;
|
|
1058
|
+
|
|
1057
1059
|
this.selectedRange = -1;
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
+
var isContinuousRange = true;
|
|
1061
|
+
|
|
1062
|
+
if (rangeInput.length === 1) {
|
|
1063
|
+
this.selectedRangeDates = _toConsumableArray(rangeInput);
|
|
1064
|
+
this.customRangeSelected = _toConsumableArray(rangeInput);
|
|
1065
|
+
} else if (rangeInput.length === 2) {
|
|
1066
|
+
this.selectedRangeDates = _toConsumableArray(rangeInput);
|
|
1067
|
+
this.customRangeSelected = _toConsumableArray(rangeInput);
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
rangeInput.forEach(function (r, i) {
|
|
1071
|
+
if (i > 0) {
|
|
1072
|
+
if (_this6.options.mode === 'date' || _this6.options.mode === 'monthyear') {
|
|
1073
|
+
if (r.getTime() / _this6.oneDay - rangeInput[i - 1] / _this6.oneDay > 1) {
|
|
1074
|
+
isContinuousRange = false;
|
|
1075
|
+
}
|
|
1076
|
+
} else if (_this6.options.mode === 'hour' || _this6.options.mode === 'year') {
|
|
1077
|
+
if (r - rangeInput[i - 1] > 1) {
|
|
1078
|
+
isContinuousRange = false;
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
});
|
|
1083
|
+
|
|
1084
|
+
if (rangeInput.length > 2 && isContinuousRange === true) {
|
|
1085
|
+
this.selectedRangeDates = [rangeInput[0], rangeInput[rangeInput.length - 1]];
|
|
1086
|
+
} // check if the custom range matches a configured range
|
|
1087
|
+
|
|
1060
1088
|
|
|
1061
1089
|
for (var i = 0; i < this.options.ranges[this.options.mode].length; i++) {
|
|
1062
1090
|
if (this.options.ranges[this.options.mode][i].range.length === 1) {
|
|
1063
|
-
if (this.options.ranges[this.options.mode][i].range[0] ===
|
|
1091
|
+
if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0]) {
|
|
1064
1092
|
this.selectedRange = i;
|
|
1065
1093
|
break;
|
|
1066
1094
|
}
|
|
1067
1095
|
} else if (this.options.ranges[this.options.mode][i].range.length === 2) {
|
|
1068
|
-
if (this.options.ranges[this.options.mode][i].range[0] ===
|
|
1096
|
+
if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0] && this.options.ranges[this.options.mode][i].range[1] === rangeInput[1]) {
|
|
1069
1097
|
this.selectedRange = i;
|
|
1070
1098
|
break;
|
|
1071
1099
|
}
|
|
@@ -1099,27 +1127,27 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1099
1127
|
}, {
|
|
1100
1128
|
key: "updateRange",
|
|
1101
1129
|
value: function updateRange() {
|
|
1102
|
-
var
|
|
1130
|
+
var _this7 = this;
|
|
1103
1131
|
|
|
1104
1132
|
var range;
|
|
1105
1133
|
|
|
1106
1134
|
if (this.selectedRange === -1) {
|
|
1107
1135
|
var list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(function (d) {
|
|
1108
|
-
if (
|
|
1136
|
+
if (_this7.options.mode === 'date') {
|
|
1109
1137
|
if (!d.toLocaleDateString) {
|
|
1110
1138
|
d = new Date(d);
|
|
1111
1139
|
}
|
|
1112
1140
|
|
|
1113
1141
|
return d.toLocaleDateString();
|
|
1114
|
-
} else if (
|
|
1142
|
+
} else if (_this7.options.mode === 'year') {
|
|
1115
1143
|
return d;
|
|
1116
|
-
} else if (
|
|
1144
|
+
} else if (_this7.options.mode === 'monthyear') {
|
|
1117
1145
|
if (!d.getMonth) {
|
|
1118
1146
|
d = new Date(d);
|
|
1119
1147
|
}
|
|
1120
1148
|
|
|
1121
|
-
return "".concat(
|
|
1122
|
-
} else if (
|
|
1149
|
+
return "".concat(_this7.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
1150
|
+
} else if (_this7.options.mode === 'hour') {
|
|
1123
1151
|
return d;
|
|
1124
1152
|
}
|
|
1125
1153
|
});
|
|
@@ -1130,6 +1158,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1130
1158
|
end = " - ".concat(list[list.length - 1]);
|
|
1131
1159
|
|
|
1132
1160
|
if (this.options.mode === 'hour') {
|
|
1161
|
+
start = this.options.hours[start].text;
|
|
1133
1162
|
end = "".concat(this.customRangeSelected === true ? ' - ' : '').concat(this.options.hours[list[list.length - 1]].text);
|
|
1134
1163
|
}
|
|
1135
1164
|
} else {
|
|
@@ -1178,7 +1207,7 @@ Date.prototype.floor = function () {
|
|
|
1178
1207
|
|
|
1179
1208
|
var WebsyDropdown = /*#__PURE__*/function () {
|
|
1180
1209
|
function WebsyDropdown(elementId, options) {
|
|
1181
|
-
var
|
|
1210
|
+
var _this8 = this;
|
|
1182
1211
|
|
|
1183
1212
|
_classCallCheck(this, WebsyDropdown);
|
|
1184
1213
|
|
|
@@ -1222,10 +1251,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1222
1251
|
el.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
1223
1252
|
el.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
1224
1253
|
var headerLabel = this.selectedItems.map(function (s) {
|
|
1225
|
-
return
|
|
1254
|
+
return _this8.options.items[s].label || _this8.options.items[s].value;
|
|
1226
1255
|
}).join(this.options.multiValueDelimiter);
|
|
1227
1256
|
var headerValue = this.selectedItems.map(function (s) {
|
|
1228
|
-
return
|
|
1257
|
+
return _this8.options.items[s].value || _this8.options.items[s].label;
|
|
1229
1258
|
}).join(this.options.multiValueDelimiter);
|
|
1230
1259
|
var html = "\n <div id='".concat(this.elementId, "_container' class='websy-dropdown-container ").concat(this.options.disabled ? 'disabled' : '', " ").concat(this.options.disableSearch !== true ? 'with-search' : '', " ").concat(this.options.style, " ").concat(this.options.customActions.length > 0 ? 'with-actions' : '', "'>\n <div id='").concat(this.elementId, "_header' class='websy-dropdown-header ").concat(this.selectedItems.length === 1 ? 'one-selected' : '', " ").concat(this.options.allowClear === true ? 'allow-clear' : '', "'>\n <svg class='search' width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>\n <span id='").concat(this.elementId, "_headerLabel' class='websy-dropdown-header-label'>").concat(this.options.label, "</span>\n <span data-info='").concat(headerLabel, "' class='websy-dropdown-header-value' id='").concat(this.elementId, "_selectedItems'>").concat(headerLabel, "</span>\n <input class='dropdown-input' id='").concat(this.elementId, "_input' name='").concat(this.options.field || this.options.label, "' value='").concat(headerValue, "'>\n <svg class='arrow' xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M23.677 18.52c.914 1.523-.183 3.472-1.967 3.472h-19.414c-1.784 0-2.881-1.949-1.967-3.472l9.709-16.18c.891-1.483 3.041-1.48 3.93 0l9.709 16.18z\"/></svg> \n ");
|
|
1231
1260
|
|
|
@@ -1508,10 +1537,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1508
1537
|
}, {
|
|
1509
1538
|
key: "renderItems",
|
|
1510
1539
|
value: function renderItems() {
|
|
1511
|
-
var
|
|
1540
|
+
var _this9 = this;
|
|
1512
1541
|
|
|
1513
1542
|
var html = this.options.items.map(function (r, i) {
|
|
1514
|
-
return "\n <li data-index='".concat(r.index, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(
|
|
1543
|
+
return "\n <li data-index='".concat(r.index, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(_this9.selectedItems.indexOf(r.index) !== -1 ? 'active' : '', "'>").concat(r.label, "</li>\n ");
|
|
1515
1544
|
}).join('');
|
|
1516
1545
|
var el = document.getElementById("".concat(this.elementId, "_items"));
|
|
1517
1546
|
|
|
@@ -1530,7 +1559,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1530
1559
|
}, {
|
|
1531
1560
|
key: "updateHeader",
|
|
1532
1561
|
value: function updateHeader(item) {
|
|
1533
|
-
var
|
|
1562
|
+
var _this10 = this;
|
|
1534
1563
|
|
|
1535
1564
|
var el = document.getElementById(this.elementId);
|
|
1536
1565
|
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
@@ -1577,17 +1606,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1577
1606
|
} else if (this.selectedItems.length > 1) {
|
|
1578
1607
|
if (this.options.showCompleteSelectedList === true) {
|
|
1579
1608
|
var selectedLabels = this.selectedItems.map(function (s) {
|
|
1580
|
-
return
|
|
1609
|
+
return _this10.options.items[s].label || _this10.options.items[s].value;
|
|
1581
1610
|
}).join(this.options.multiValueDelimiter);
|
|
1582
1611
|
var selectedValues = this.selectedItems.map(function (s) {
|
|
1583
|
-
return
|
|
1612
|
+
return _this10.options.items[s].value || _this10.options.items[s].label;
|
|
1584
1613
|
}).join(this.options.multiValueDelimiter);
|
|
1585
1614
|
labelEl.innerHTML = selectedLabels;
|
|
1586
1615
|
labelEl.setAttribute('data-info', selectedLabels);
|
|
1587
1616
|
inputEl.value = selectedValues;
|
|
1588
1617
|
} else {
|
|
1589
1618
|
var _selectedValues = this.selectedItems.map(function (s) {
|
|
1590
|
-
return
|
|
1619
|
+
return _this10.options.items[s].value || _this10.options.items[s].label;
|
|
1591
1620
|
}).join(this.options.multiValueDelimiter);
|
|
1592
1621
|
|
|
1593
1622
|
labelEl.innerHTML = "".concat(this.selectedItems.length, " selected");
|
|
@@ -1724,16 +1753,16 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1724
1753
|
}, {
|
|
1725
1754
|
key: "checkRecaptcha",
|
|
1726
1755
|
value: function checkRecaptcha() {
|
|
1727
|
-
var
|
|
1756
|
+
var _this11 = this;
|
|
1728
1757
|
|
|
1729
1758
|
return new Promise(function (resolve, reject) {
|
|
1730
|
-
if (
|
|
1759
|
+
if (_this11.options.useRecaptcha === true) {
|
|
1731
1760
|
// if (this.recaptchaValue) {
|
|
1732
1761
|
grecaptcha.ready(function () {
|
|
1733
1762
|
grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
|
|
1734
1763
|
action: 'submit'
|
|
1735
1764
|
}).then(function (token) {
|
|
1736
|
-
|
|
1765
|
+
_this11.apiService.add('google/checkrecaptcha', {
|
|
1737
1766
|
grecaptcharesponse: token
|
|
1738
1767
|
}).then(function (response) {
|
|
1739
1768
|
if (response.success && response.success === true) {
|
|
@@ -1796,14 +1825,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1796
1825
|
}, {
|
|
1797
1826
|
key: "processComponents",
|
|
1798
1827
|
value: function processComponents(components, callbackFn) {
|
|
1799
|
-
var
|
|
1828
|
+
var _this12 = this;
|
|
1800
1829
|
|
|
1801
1830
|
if (components.length === 0) {
|
|
1802
1831
|
callbackFn();
|
|
1803
1832
|
} else {
|
|
1804
1833
|
components.forEach(function (c) {
|
|
1805
1834
|
if (typeof WebsyDesigns[c.component] !== 'undefined') {
|
|
1806
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
1835
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this12.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
1807
1836
|
} else {// some user feedback here
|
|
1808
1837
|
}
|
|
1809
1838
|
});
|
|
@@ -1824,7 +1853,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1824
1853
|
}, {
|
|
1825
1854
|
key: "render",
|
|
1826
1855
|
value: function render(update, data) {
|
|
1827
|
-
var
|
|
1856
|
+
var _this13 = this;
|
|
1828
1857
|
|
|
1829
1858
|
var el = document.getElementById(this.elementId);
|
|
1830
1859
|
var componentsToProcess = [];
|
|
@@ -1834,11 +1863,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1834
1863
|
this.options.fields.forEach(function (f, i) {
|
|
1835
1864
|
if (f.component) {
|
|
1836
1865
|
componentsToProcess.push(f);
|
|
1837
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(
|
|
1866
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(_this13.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
|
|
1838
1867
|
} else if (f.type === 'longtext') {
|
|
1839
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(
|
|
1868
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(_this13.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n ></textarea>\n </div><!--\n ");
|
|
1840
1869
|
} else {
|
|
1841
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(
|
|
1870
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(_this13.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n </div><!--\n ");
|
|
1842
1871
|
}
|
|
1843
1872
|
});
|
|
1844
1873
|
html += "\n --><button class=\"websy-btn submit ".concat(this.options.submit.classes || '', "\">").concat(this.options.submit.text || 'Save', "</button>").concat(this.options.cancel ? '<!--' : '', "\n ");
|
|
@@ -1855,7 +1884,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1855
1884
|
|
|
1856
1885
|
el.innerHTML = html;
|
|
1857
1886
|
this.processComponents(componentsToProcess, function () {
|
|
1858
|
-
if (
|
|
1887
|
+
if (_this13.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
|
|
1859
1888
|
}
|
|
1860
1889
|
});
|
|
1861
1890
|
}
|
|
@@ -1863,7 +1892,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1863
1892
|
}, {
|
|
1864
1893
|
key: "submitForm",
|
|
1865
1894
|
value: function submitForm() {
|
|
1866
|
-
var
|
|
1895
|
+
var _this14 = this;
|
|
1867
1896
|
|
|
1868
1897
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
1869
1898
|
|
|
@@ -1877,32 +1906,32 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1877
1906
|
data[key] = value;
|
|
1878
1907
|
});
|
|
1879
1908
|
|
|
1880
|
-
if (
|
|
1881
|
-
var
|
|
1909
|
+
if (_this14.options.url) {
|
|
1910
|
+
var _this14$apiService;
|
|
1882
1911
|
|
|
1883
|
-
var params = [
|
|
1912
|
+
var params = [_this14.options.url];
|
|
1884
1913
|
|
|
1885
|
-
if (
|
|
1886
|
-
params.push(
|
|
1914
|
+
if (_this14.options.mode === 'update') {
|
|
1915
|
+
params.push(_this14.options.id);
|
|
1887
1916
|
}
|
|
1888
1917
|
|
|
1889
1918
|
params.push(data);
|
|
1890
1919
|
|
|
1891
|
-
(
|
|
1892
|
-
if (
|
|
1920
|
+
(_this14$apiService = _this14.apiService)[_this14.options.mode].apply(_this14$apiService, params).then(function (result) {
|
|
1921
|
+
if (_this14.options.clearAfterSave === true) {
|
|
1893
1922
|
// this.render()
|
|
1894
1923
|
formEl.reset();
|
|
1895
1924
|
}
|
|
1896
1925
|
|
|
1897
|
-
|
|
1926
|
+
_this14.options.onSuccess.call(_this14, result);
|
|
1898
1927
|
}, function (err) {
|
|
1899
1928
|
console.log('Error submitting form data:', err);
|
|
1900
1929
|
|
|
1901
|
-
|
|
1930
|
+
_this14.options.onError.call(_this14, err);
|
|
1902
1931
|
});
|
|
1903
|
-
} else if (
|
|
1904
|
-
|
|
1905
|
-
if (
|
|
1932
|
+
} else if (_this14.options.submitFn) {
|
|
1933
|
+
_this14.options.submitFn(data, function () {
|
|
1934
|
+
if (_this14.options.clearAfterSave === true) {
|
|
1906
1935
|
// this.render()
|
|
1907
1936
|
formEl.reset();
|
|
1908
1937
|
}
|
|
@@ -1922,17 +1951,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1922
1951
|
}, {
|
|
1923
1952
|
key: "data",
|
|
1924
1953
|
set: function set(d) {
|
|
1925
|
-
var
|
|
1954
|
+
var _this15 = this;
|
|
1926
1955
|
|
|
1927
1956
|
if (!this.options.fields) {
|
|
1928
1957
|
this.options.fields = [];
|
|
1929
1958
|
}
|
|
1930
1959
|
|
|
1931
1960
|
var _loop = function _loop(key) {
|
|
1932
|
-
|
|
1961
|
+
_this15.options.fields.forEach(function (f) {
|
|
1933
1962
|
if (f.field === key) {
|
|
1934
1963
|
f.value = d[key];
|
|
1935
|
-
var el = document.getElementById("".concat(
|
|
1964
|
+
var el = document.getElementById("".concat(_this15.elementId, "_input_").concat(f.field));
|
|
1936
1965
|
el.value = f.value;
|
|
1937
1966
|
}
|
|
1938
1967
|
});
|
|
@@ -2244,7 +2273,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2244
2273
|
|
|
2245
2274
|
var Pager = /*#__PURE__*/function () {
|
|
2246
2275
|
function Pager(elementId, options) {
|
|
2247
|
-
var
|
|
2276
|
+
var _this16 = this;
|
|
2248
2277
|
|
|
2249
2278
|
_classCallCheck(this, Pager);
|
|
2250
2279
|
|
|
@@ -2297,8 +2326,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2297
2326
|
allowClear: false,
|
|
2298
2327
|
disableSearch: true,
|
|
2299
2328
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
2300
|
-
if (
|
|
2301
|
-
|
|
2329
|
+
if (_this16.options.onChangePageSize) {
|
|
2330
|
+
_this16.options.onChangePageSize(selectedItem.value);
|
|
2302
2331
|
}
|
|
2303
2332
|
}
|
|
2304
2333
|
});
|
|
@@ -2322,13 +2351,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2322
2351
|
}, {
|
|
2323
2352
|
key: "render",
|
|
2324
2353
|
value: function render() {
|
|
2325
|
-
var
|
|
2354
|
+
var _this17 = this;
|
|
2326
2355
|
|
|
2327
2356
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
2328
2357
|
|
|
2329
2358
|
if (el) {
|
|
2330
2359
|
var pages = this.options.pages.map(function (item, index) {
|
|
2331
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
2360
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this17.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
2332
2361
|
});
|
|
2333
2362
|
var startIndex = 0;
|
|
2334
2363
|
|
|
@@ -2396,58 +2425,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2396
2425
|
_createClass(WebsyPDFButton, [{
|
|
2397
2426
|
key: "handleClick",
|
|
2398
2427
|
value: function handleClick(event) {
|
|
2399
|
-
var
|
|
2428
|
+
var _this18 = this;
|
|
2400
2429
|
|
|
2401
2430
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
2402
2431
|
this.loader.show();
|
|
2403
2432
|
setTimeout(function () {
|
|
2404
|
-
if (
|
|
2405
|
-
var el = document.getElementById(
|
|
2433
|
+
if (_this18.options.targetId) {
|
|
2434
|
+
var el = document.getElementById(_this18.options.targetId);
|
|
2406
2435
|
|
|
2407
2436
|
if (el) {
|
|
2408
2437
|
var pdfData = {
|
|
2409
2438
|
options: {}
|
|
2410
2439
|
};
|
|
2411
2440
|
|
|
2412
|
-
if (
|
|
2413
|
-
pdfData.options = _extends({},
|
|
2441
|
+
if (_this18.options.pdfOptions) {
|
|
2442
|
+
pdfData.options = _extends({}, _this18.options.pdfOptions);
|
|
2414
2443
|
}
|
|
2415
2444
|
|
|
2416
|
-
if (
|
|
2417
|
-
if (
|
|
2418
|
-
var headerEl = document.getElementById(
|
|
2445
|
+
if (_this18.options.header) {
|
|
2446
|
+
if (_this18.options.header.elementId) {
|
|
2447
|
+
var headerEl = document.getElementById(_this18.options.header.elementId);
|
|
2419
2448
|
|
|
2420
2449
|
if (headerEl) {
|
|
2421
2450
|
pdfData.header = headerEl.outerHTML;
|
|
2422
2451
|
|
|
2423
|
-
if (
|
|
2424
|
-
pdfData.options.headerCSS =
|
|
2452
|
+
if (_this18.options.header.css) {
|
|
2453
|
+
pdfData.options.headerCSS = _this18.options.header.css;
|
|
2425
2454
|
}
|
|
2426
2455
|
}
|
|
2427
|
-
} else if (
|
|
2428
|
-
pdfData.header =
|
|
2456
|
+
} else if (_this18.options.header.html) {
|
|
2457
|
+
pdfData.header = _this18.options.header.html;
|
|
2429
2458
|
|
|
2430
|
-
if (
|
|
2431
|
-
pdfData.options.headerCSS =
|
|
2459
|
+
if (_this18.options.header.css) {
|
|
2460
|
+
pdfData.options.headerCSS = _this18.options.header.css;
|
|
2432
2461
|
}
|
|
2433
2462
|
} else {
|
|
2434
|
-
pdfData.header =
|
|
2463
|
+
pdfData.header = _this18.options.header;
|
|
2435
2464
|
}
|
|
2436
2465
|
}
|
|
2437
2466
|
|
|
2438
|
-
if (
|
|
2439
|
-
if (
|
|
2440
|
-
var footerEl = document.getElementById(
|
|
2467
|
+
if (_this18.options.footer) {
|
|
2468
|
+
if (_this18.options.footer.elementId) {
|
|
2469
|
+
var footerEl = document.getElementById(_this18.options.footer.elementId);
|
|
2441
2470
|
|
|
2442
2471
|
if (footerEl) {
|
|
2443
2472
|
pdfData.footer = footerEl.outerHTML;
|
|
2444
2473
|
|
|
2445
|
-
if (
|
|
2446
|
-
pdfData.options.footerCSS =
|
|
2474
|
+
if (_this18.options.footer.css) {
|
|
2475
|
+
pdfData.options.footerCSS = _this18.options.footer.css;
|
|
2447
2476
|
}
|
|
2448
2477
|
}
|
|
2449
2478
|
} else {
|
|
2450
|
-
pdfData.footer =
|
|
2479
|
+
pdfData.footer = _this18.options.footer;
|
|
2451
2480
|
}
|
|
2452
2481
|
}
|
|
2453
2482
|
|
|
@@ -2456,31 +2485,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2456
2485
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
2457
2486
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
2458
2487
|
|
|
2459
|
-
|
|
2488
|
+
_this18.service.add('', pdfData, {
|
|
2460
2489
|
responseType: 'blob'
|
|
2461
2490
|
}).then(function (response) {
|
|
2462
|
-
|
|
2491
|
+
_this18.loader.hide();
|
|
2463
2492
|
|
|
2464
2493
|
var blob = new Blob([response], {
|
|
2465
2494
|
type: 'application/pdf'
|
|
2466
2495
|
});
|
|
2467
2496
|
var msg = "\n <div class='text-center websy-pdf-download'>\n <div>Your file is ready to download</div>\n <a href='".concat(URL.createObjectURL(blob), "' target='_blank'\n ");
|
|
2468
2497
|
|
|
2469
|
-
if (
|
|
2498
|
+
if (_this18.options.directDownload === true) {
|
|
2470
2499
|
var fileName;
|
|
2471
2500
|
|
|
2472
|
-
if (typeof
|
|
2473
|
-
fileName =
|
|
2501
|
+
if (typeof _this18.options.fileName === 'function') {
|
|
2502
|
+
fileName = _this18.options.fileName() || 'Export';
|
|
2474
2503
|
} else {
|
|
2475
|
-
fileName =
|
|
2504
|
+
fileName = _this18.options.fileName || 'Export';
|
|
2476
2505
|
}
|
|
2477
2506
|
|
|
2478
2507
|
msg += "download='".concat(fileName, ".pdf'");
|
|
2479
2508
|
}
|
|
2480
2509
|
|
|
2481
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
2510
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this18.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
2482
2511
|
|
|
2483
|
-
|
|
2512
|
+
_this18.popup.show({
|
|
2484
2513
|
message: msg,
|
|
2485
2514
|
mask: true
|
|
2486
2515
|
});
|
|
@@ -2665,7 +2694,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
2665
2694
|
|
|
2666
2695
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
2667
2696
|
function ResponsiveText(elementId, options) {
|
|
2668
|
-
var
|
|
2697
|
+
var _this19 = this;
|
|
2669
2698
|
|
|
2670
2699
|
_classCallCheck(this, ResponsiveText);
|
|
2671
2700
|
|
|
@@ -2678,7 +2707,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
2678
2707
|
this.elementId = elementId;
|
|
2679
2708
|
this.canvas = document.createElement('canvas');
|
|
2680
2709
|
window.addEventListener('resize', function () {
|
|
2681
|
-
return
|
|
2710
|
+
return _this19.render();
|
|
2682
2711
|
});
|
|
2683
2712
|
var el = document.getElementById(this.elementId);
|
|
2684
2713
|
|
|
@@ -2897,7 +2926,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
2897
2926
|
|
|
2898
2927
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
2899
2928
|
function WebsyResultList(elementId, options) {
|
|
2900
|
-
var
|
|
2929
|
+
var _this20 = this;
|
|
2901
2930
|
|
|
2902
2931
|
_classCallCheck(this, WebsyResultList);
|
|
2903
2932
|
|
|
@@ -2925,9 +2954,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2925
2954
|
|
|
2926
2955
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
2927
2956
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
2928
|
-
|
|
2957
|
+
_this20.options.template = templateString;
|
|
2929
2958
|
|
|
2930
|
-
|
|
2959
|
+
_this20.render();
|
|
2931
2960
|
});
|
|
2932
2961
|
} else {
|
|
2933
2962
|
this.render();
|
|
@@ -2946,7 +2975,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2946
2975
|
}, {
|
|
2947
2976
|
key: "buildHTML",
|
|
2948
2977
|
value: function buildHTML(d) {
|
|
2949
|
-
var
|
|
2978
|
+
var _this21 = this;
|
|
2950
2979
|
|
|
2951
2980
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
2952
2981
|
var html = "";
|
|
@@ -2954,7 +2983,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2954
2983
|
if (this.options.template) {
|
|
2955
2984
|
if (d.length > 0) {
|
|
2956
2985
|
d.forEach(function (row, ix) {
|
|
2957
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(
|
|
2986
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(_this21.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
2958
2987
|
|
|
2959
2988
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
2960
2989
|
|
|
@@ -3074,7 +3103,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3074
3103
|
}, {
|
|
3075
3104
|
key: "handleClick",
|
|
3076
3105
|
value: function handleClick(event) {
|
|
3077
|
-
var
|
|
3106
|
+
var _this22 = this;
|
|
3078
3107
|
|
|
3079
3108
|
if (event.target.classList.contains('clickable')) {
|
|
3080
3109
|
var l = event.target.getAttribute('data-event');
|
|
@@ -3092,8 +3121,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3092
3121
|
l = l[0];
|
|
3093
3122
|
params = params.map(function (p) {
|
|
3094
3123
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
3095
|
-
if (
|
|
3096
|
-
p =
|
|
3124
|
+
if (_this22.rows[+id]) {
|
|
3125
|
+
p = _this22.rows[+id][p];
|
|
3097
3126
|
}
|
|
3098
3127
|
} else if (typeof p === 'string') {
|
|
3099
3128
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -3115,13 +3144,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3115
3144
|
}, {
|
|
3116
3145
|
key: "render",
|
|
3117
3146
|
value: function render() {
|
|
3118
|
-
var
|
|
3147
|
+
var _this23 = this;
|
|
3119
3148
|
|
|
3120
3149
|
if (this.options.entity) {
|
|
3121
3150
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3122
|
-
|
|
3151
|
+
_this23.rows = results.rows;
|
|
3123
3152
|
|
|
3124
|
-
|
|
3153
|
+
_this23.resize();
|
|
3125
3154
|
});
|
|
3126
3155
|
} else {
|
|
3127
3156
|
this.resize();
|
|
@@ -3200,14 +3229,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3200
3229
|
_createClass(WebsyRouter, [{
|
|
3201
3230
|
key: "addGroup",
|
|
3202
3231
|
value: function addGroup(group) {
|
|
3203
|
-
var
|
|
3232
|
+
var _this24 = this;
|
|
3204
3233
|
|
|
3205
3234
|
if (!this.groups[group]) {
|
|
3206
3235
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3207
3236
|
|
|
3208
3237
|
if (els) {
|
|
3209
3238
|
this.getClosestParent(els[0], function (parent) {
|
|
3210
|
-
|
|
3239
|
+
_this24.groups[group] = {
|
|
3211
3240
|
activeView: '',
|
|
3212
3241
|
views: [],
|
|
3213
3242
|
parent: parent.getAttribute('data-view')
|
|
@@ -3532,12 +3561,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3532
3561
|
}, {
|
|
3533
3562
|
key: "showComponents",
|
|
3534
3563
|
value: function showComponents(view) {
|
|
3535
|
-
var
|
|
3564
|
+
var _this25 = this;
|
|
3536
3565
|
|
|
3537
3566
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
3538
3567
|
this.options.views[view].components.forEach(function (c) {
|
|
3539
3568
|
if (typeof c.instance === 'undefined') {
|
|
3540
|
-
|
|
3569
|
+
_this25.prepComponent(c.elementId, c.options);
|
|
3541
3570
|
|
|
3542
3571
|
c.instance = new c.Component(c.elementId, c.options);
|
|
3543
3572
|
} else if (c.instance.render) {
|
|
@@ -3906,7 +3935,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
3906
3935
|
|
|
3907
3936
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
3908
3937
|
function WebsyTemplate(elementId, options) {
|
|
3909
|
-
var
|
|
3938
|
+
var _this26 = this;
|
|
3910
3939
|
|
|
3911
3940
|
_classCallCheck(this, WebsyTemplate);
|
|
3912
3941
|
|
|
@@ -3932,9 +3961,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3932
3961
|
|
|
3933
3962
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3934
3963
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3935
|
-
|
|
3964
|
+
_this26.options.template = templateString;
|
|
3936
3965
|
|
|
3937
|
-
|
|
3966
|
+
_this26.render();
|
|
3938
3967
|
});
|
|
3939
3968
|
} else {
|
|
3940
3969
|
this.render();
|
|
@@ -3944,7 +3973,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3944
3973
|
_createClass(WebsyTemplate, [{
|
|
3945
3974
|
key: "buildHTML",
|
|
3946
3975
|
value: function buildHTML() {
|
|
3947
|
-
var
|
|
3976
|
+
var _this27 = this;
|
|
3948
3977
|
|
|
3949
3978
|
var html = "";
|
|
3950
3979
|
|
|
@@ -4006,14 +4035,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4006
4035
|
}
|
|
4007
4036
|
|
|
4008
4037
|
if (polarity === true) {
|
|
4009
|
-
if (typeof
|
|
4038
|
+
if (typeof _this27.options.data[parts[0]] !== 'undefined' && _this27.options.data[parts[0]] === parts[1]) {
|
|
4010
4039
|
// remove the <if> tags
|
|
4011
4040
|
removeAll = false;
|
|
4012
4041
|
} else if (parts[0] === parts[1]) {
|
|
4013
4042
|
removeAll = false;
|
|
4014
4043
|
}
|
|
4015
4044
|
} else if (polarity === false) {
|
|
4016
|
-
if (typeof
|
|
4045
|
+
if (typeof _this27.options.data[parts[0]] !== 'undefined' && _this27.options.data[parts[0]] !== parts[1]) {
|
|
4017
4046
|
// remove the <if> tags
|
|
4018
4047
|
removeAll = false;
|
|
4019
4048
|
}
|
|
@@ -4300,7 +4329,7 @@ var WebsyUtils = {
|
|
|
4300
4329
|
|
|
4301
4330
|
var WebsyTable = /*#__PURE__*/function () {
|
|
4302
4331
|
function WebsyTable(elementId, options) {
|
|
4303
|
-
var
|
|
4332
|
+
var _this28 = this;
|
|
4304
4333
|
|
|
4305
4334
|
_classCallCheck(this, WebsyTable);
|
|
4306
4335
|
|
|
@@ -4338,8 +4367,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4338
4367
|
allowClear: false,
|
|
4339
4368
|
disableSearch: true,
|
|
4340
4369
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4341
|
-
if (
|
|
4342
|
-
|
|
4370
|
+
if (_this28.options.onChangePageSize) {
|
|
4371
|
+
_this28.options.onChangePageSize(selectedItem.value);
|
|
4343
4372
|
}
|
|
4344
4373
|
}
|
|
4345
4374
|
});
|
|
@@ -4360,7 +4389,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4360
4389
|
_createClass(WebsyTable, [{
|
|
4361
4390
|
key: "appendRows",
|
|
4362
4391
|
value: function appendRows(data) {
|
|
4363
|
-
var
|
|
4392
|
+
var _this29 = this;
|
|
4364
4393
|
|
|
4365
4394
|
this.hideError();
|
|
4366
4395
|
var bodyHTML = '';
|
|
@@ -4368,15 +4397,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4368
4397
|
if (data) {
|
|
4369
4398
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4370
4399
|
return '<tr>' + r.map(function (c, i) {
|
|
4371
|
-
if (
|
|
4400
|
+
if (_this29.options.columns[i].show !== false) {
|
|
4372
4401
|
var style = '';
|
|
4373
4402
|
|
|
4374
4403
|
if (c.style) {
|
|
4375
4404
|
style += c.style;
|
|
4376
4405
|
}
|
|
4377
4406
|
|
|
4378
|
-
if (
|
|
4379
|
-
style += "width: ".concat(
|
|
4407
|
+
if (_this29.options.columns[i].width) {
|
|
4408
|
+
style += "width: ".concat(_this29.options.columns[i].width, "; ");
|
|
4380
4409
|
}
|
|
4381
4410
|
|
|
4382
4411
|
if (c.backgroundColor) {
|
|
@@ -4391,18 +4420,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4391
4420
|
style += "color: ".concat(c.color, "; ");
|
|
4392
4421
|
}
|
|
4393
4422
|
|
|
4394
|
-
if (
|
|
4395
|
-
return "\n <td \n data-row-index='".concat(
|
|
4396
|
-
} else if ((
|
|
4397
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
4423
|
+
if (_this29.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
4424
|
+
return "\n <td \n data-row-index='".concat(_this29.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this29.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(_this29.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this29.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
4425
|
+
} else if ((_this29.options.columns[i].showAsNavigatorLink === true || _this29.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
4426
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this29.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this29.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this29.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this29.options.columns[i].linkText || c.value, "</td>\n ");
|
|
4398
4427
|
} else {
|
|
4399
4428
|
var info = c.value;
|
|
4400
4429
|
|
|
4401
|
-
if (
|
|
4430
|
+
if (_this29.options.columns[i].showAsImage === true) {
|
|
4402
4431
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4403
4432
|
}
|
|
4404
4433
|
|
|
4405
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
4434
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this29.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this29.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 ");
|
|
4406
4435
|
}
|
|
4407
4436
|
}
|
|
4408
4437
|
}).join('') + '</tr>';
|
|
@@ -4574,7 +4603,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4574
4603
|
}, {
|
|
4575
4604
|
key: "render",
|
|
4576
4605
|
value: function render(data) {
|
|
4577
|
-
var
|
|
4606
|
+
var _this30 = this;
|
|
4578
4607
|
|
|
4579
4608
|
if (!this.options.columns) {
|
|
4580
4609
|
return;
|
|
@@ -4599,7 +4628,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4599
4628
|
|
|
4600
4629
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
4601
4630
|
if (c.show !== false) {
|
|
4602
|
-
return "\n <th ".concat(c.width ? 'style="width: ' + (c.width || 'auto') + ';"' : '', ">\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 ?
|
|
4631
|
+
return "\n <th ".concat(c.width ? 'style="width: ' + (c.width || 'auto') + ';"' : '', ">\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 ? _this30.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
4603
4632
|
}
|
|
4604
4633
|
}).join('') + '</tr>';
|
|
4605
4634
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -4618,7 +4647,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4618
4647
|
|
|
4619
4648
|
if (pagingEl) {
|
|
4620
4649
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
4621
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
4650
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this30.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
4622
4651
|
});
|
|
4623
4652
|
var startIndex = 0;
|
|
4624
4653
|
|
|
@@ -4686,7 +4715,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4686
4715
|
|
|
4687
4716
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
4688
4717
|
function WebsyTable2(elementId, options) {
|
|
4689
|
-
var
|
|
4718
|
+
var _this31 = this;
|
|
4690
4719
|
|
|
4691
4720
|
_classCallCheck(this, WebsyTable2);
|
|
4692
4721
|
|
|
@@ -4727,8 +4756,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4727
4756
|
allowClear: false,
|
|
4728
4757
|
disableSearch: true,
|
|
4729
4758
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4730
|
-
if (
|
|
4731
|
-
|
|
4759
|
+
if (_this31.options.onChangePageSize) {
|
|
4760
|
+
_this31.options.onChangePageSize(selectedItem.value);
|
|
4732
4761
|
}
|
|
4733
4762
|
}
|
|
4734
4763
|
});
|
|
@@ -4752,7 +4781,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4752
4781
|
_createClass(WebsyTable2, [{
|
|
4753
4782
|
key: "appendRows",
|
|
4754
4783
|
value: function appendRows(data) {
|
|
4755
|
-
var
|
|
4784
|
+
var _this32 = this;
|
|
4756
4785
|
|
|
4757
4786
|
this.hideError();
|
|
4758
4787
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -4761,15 +4790,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4761
4790
|
if (data) {
|
|
4762
4791
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4763
4792
|
return '<tr>' + r.map(function (c, i) {
|
|
4764
|
-
if (
|
|
4765
|
-
var style = "height: ".concat(
|
|
4793
|
+
if (_this32.options.columns[i].show !== false) {
|
|
4794
|
+
var style = "height: ".concat(_this32.options.cellSize, "px; line-height: ").concat(_this32.options.cellSize, "px;");
|
|
4766
4795
|
|
|
4767
4796
|
if (c.style) {
|
|
4768
4797
|
style += c.style;
|
|
4769
4798
|
}
|
|
4770
4799
|
|
|
4771
|
-
if (
|
|
4772
|
-
style += "width: ".concat(
|
|
4800
|
+
if (_this32.options.columns[i].width) {
|
|
4801
|
+
style += "width: ".concat(_this32.options.columns[i].width, "; ");
|
|
4773
4802
|
}
|
|
4774
4803
|
|
|
4775
4804
|
if (c.backgroundColor) {
|
|
@@ -4784,18 +4813,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4784
4813
|
style += "color: ".concat(c.color, "; ");
|
|
4785
4814
|
}
|
|
4786
4815
|
|
|
4787
|
-
if (
|
|
4788
|
-
return "\n <td \n data-row-index='".concat(
|
|
4789
|
-
} else if ((
|
|
4790
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
4816
|
+
if (_this32.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
4817
|
+
return "\n <td \n data-row-index='".concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this32.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(_this32.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this32.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
4818
|
+
} else if ((_this32.options.columns[i].showAsNavigatorLink === true || _this32.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
4819
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this32.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this32.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this32.options.columns[i].linkText || c.value, "</td>\n ");
|
|
4791
4820
|
} else {
|
|
4792
4821
|
var info = c.value;
|
|
4793
4822
|
|
|
4794
|
-
if (
|
|
4823
|
+
if (_this32.options.columns[i].showAsImage === true) {
|
|
4795
4824
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4796
4825
|
}
|
|
4797
4826
|
|
|
4798
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
4827
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this32.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 ");
|
|
4799
4828
|
}
|
|
4800
4829
|
}
|
|
4801
4830
|
}).join('') + '</tr>';
|
|
@@ -5053,7 +5082,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5053
5082
|
}, {
|
|
5054
5083
|
key: "render",
|
|
5055
5084
|
value: function render(data) {
|
|
5056
|
-
var
|
|
5085
|
+
var _this33 = this;
|
|
5057
5086
|
|
|
5058
5087
|
if (!this.options.columns) {
|
|
5059
5088
|
return;
|
|
@@ -5089,7 +5118,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5089
5118
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5090
5119
|
}
|
|
5091
5120
|
|
|
5092
|
-
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 ?
|
|
5121
|
+
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 ? _this33.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5093
5122
|
}
|
|
5094
5123
|
}).join('') + '</tr>';
|
|
5095
5124
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5100,7 +5129,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5100
5129
|
var dropdownHTML = "";
|
|
5101
5130
|
this.options.columns.forEach(function (c, i) {
|
|
5102
5131
|
if (c.searchable && c.searchField) {
|
|
5103
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5132
|
+
dropdownHTML += "\n <div id=\"".concat(_this33.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
5104
5133
|
}
|
|
5105
5134
|
});
|
|
5106
5135
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5122,7 +5151,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5122
5151
|
|
|
5123
5152
|
if (pagingEl) {
|
|
5124
5153
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5125
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5154
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this33.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5126
5155
|
});
|
|
5127
5156
|
var startIndex = 0;
|
|
5128
5157
|
|
|
@@ -5209,7 +5238,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5209
5238
|
}, {
|
|
5210
5239
|
key: "getColumnParameters",
|
|
5211
5240
|
value: function getColumnParameters(values) {
|
|
5212
|
-
var
|
|
5241
|
+
var _this34 = this;
|
|
5213
5242
|
|
|
5214
5243
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
5215
5244
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -5217,10 +5246,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5217
5246
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
5218
5247
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5219
5248
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
5220
|
-
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 ?
|
|
5249
|
+
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 ? _this34.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5221
5250
|
}).join('') + '</tr>';
|
|
5222
5251
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
5223
|
-
return "\n <td \n style='height: ".concat(
|
|
5252
|
+
return "\n <td \n style='height: ".concat(_this34.options.cellSize, "px; line-height: ").concat(_this34.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
5224
5253
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
5225
5254
|
|
|
5226
5255
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -5270,7 +5299,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5270
5299
|
|
|
5271
5300
|
var WebsyChart = /*#__PURE__*/function () {
|
|
5272
5301
|
function WebsyChart(elementId, options) {
|
|
5273
|
-
var
|
|
5302
|
+
var _this35 = this;
|
|
5274
5303
|
|
|
5275
5304
|
_classCallCheck(this, WebsyChart);
|
|
5276
5305
|
|
|
@@ -5319,22 +5348,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5319
5348
|
this.invertOverride = function (input, input2) {
|
|
5320
5349
|
var xAxis = 'bottomAxis';
|
|
5321
5350
|
|
|
5322
|
-
if (
|
|
5351
|
+
if (_this35.options.orientation === 'horizontal') {
|
|
5323
5352
|
xAxis = 'leftAxis';
|
|
5324
5353
|
}
|
|
5325
5354
|
|
|
5326
|
-
var width =
|
|
5355
|
+
var width = _this35[xAxis].step();
|
|
5327
5356
|
|
|
5328
5357
|
var output;
|
|
5329
5358
|
|
|
5330
|
-
var domain = _toConsumableArray(
|
|
5359
|
+
var domain = _toConsumableArray(_this35[xAxis].domain());
|
|
5331
5360
|
|
|
5332
|
-
if (
|
|
5361
|
+
if (_this35.options.orientation === 'horizontal') {
|
|
5333
5362
|
domain = domain.reverse();
|
|
5334
5363
|
}
|
|
5335
5364
|
|
|
5336
5365
|
for (var j = 0; j < domain.length; j++) {
|
|
5337
|
-
var breakA =
|
|
5366
|
+
var breakA = _this35[xAxis](domain[j]) - width / 2;
|
|
5338
5367
|
var breakB = breakA + width;
|
|
5339
5368
|
|
|
5340
5369
|
if (input > breakA && input <= breakB) {
|
|
@@ -5434,10 +5463,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5434
5463
|
}, {
|
|
5435
5464
|
key: "handleEventMouseMove",
|
|
5436
5465
|
value: function handleEventMouseMove(event, d) {
|
|
5437
|
-
var
|
|
5466
|
+
var _this36 = this;
|
|
5438
5467
|
|
|
5439
5468
|
var bisectDate = d3.bisector(function (d) {
|
|
5440
|
-
return
|
|
5469
|
+
return _this36.parseX(d.x.value);
|
|
5441
5470
|
}).left;
|
|
5442
5471
|
|
|
5443
5472
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -5476,8 +5505,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5476
5505
|
}
|
|
5477
5506
|
|
|
5478
5507
|
this.options.data.series.forEach(function (s) {
|
|
5479
|
-
if (
|
|
5480
|
-
xPoint =
|
|
5508
|
+
if (_this36.options.data[xData].scale !== 'Time') {
|
|
5509
|
+
xPoint = _this36[xAxis](_this36.parseX(xLabel));
|
|
5481
5510
|
s.data.forEach(function (d) {
|
|
5482
5511
|
if (d.x.value === xLabel) {
|
|
5483
5512
|
if (!tooltipTitle) {
|
|
@@ -5496,13 +5525,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5496
5525
|
var pointA = s.data[index - 1];
|
|
5497
5526
|
var pointB = s.data[index];
|
|
5498
5527
|
|
|
5499
|
-
if (
|
|
5528
|
+
if (_this36.options.orientation === 'horizontal') {
|
|
5500
5529
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
5501
5530
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
5502
5531
|
}
|
|
5503
5532
|
|
|
5504
5533
|
if (pointA && !pointB) {
|
|
5505
|
-
xPoint =
|
|
5534
|
+
xPoint = _this36[xAxis](_this36.parseX(pointA.x.value));
|
|
5506
5535
|
tooltipTitle = pointA.x.value;
|
|
5507
5536
|
|
|
5508
5537
|
if (!pointA.y.color) {
|
|
@@ -5512,12 +5541,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5512
5541
|
tooltipData.push(pointA.y);
|
|
5513
5542
|
|
|
5514
5543
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
5515
|
-
tooltipTitle = d3.timeFormat(
|
|
5544
|
+
tooltipTitle = d3.timeFormat(_this36.options.dateFormat || _this36.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
5516
5545
|
}
|
|
5517
5546
|
}
|
|
5518
5547
|
|
|
5519
5548
|
if (pointB && !pointA) {
|
|
5520
|
-
xPoint =
|
|
5549
|
+
xPoint = _this36[xAxis](_this36.parseX(pointB.x.value));
|
|
5521
5550
|
tooltipTitle = pointB.x.value;
|
|
5522
5551
|
|
|
5523
5552
|
if (!pointB.y.color) {
|
|
@@ -5527,14 +5556,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5527
5556
|
tooltipData.push(pointB.y);
|
|
5528
5557
|
|
|
5529
5558
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5530
|
-
tooltipTitle = d3.timeFormat(
|
|
5559
|
+
tooltipTitle = d3.timeFormat(_this36.options.dateFormat || _this36.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5531
5560
|
}
|
|
5532
5561
|
}
|
|
5533
5562
|
|
|
5534
5563
|
if (pointA && pointB) {
|
|
5535
|
-
var d0 =
|
|
5564
|
+
var d0 = _this36[xAxis](_this36.parseX(pointA.x.value));
|
|
5536
5565
|
|
|
5537
|
-
var d1 =
|
|
5566
|
+
var d1 = _this36[xAxis](_this36.parseX(pointB.x.value));
|
|
5538
5567
|
|
|
5539
5568
|
var mid = Math.abs(d0 - d1) / 2;
|
|
5540
5569
|
|
|
@@ -5543,7 +5572,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5543
5572
|
tooltipTitle = pointB.x.value;
|
|
5544
5573
|
|
|
5545
5574
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5546
|
-
tooltipTitle = d3.timeFormat(
|
|
5575
|
+
tooltipTitle = d3.timeFormat(_this36.options.dateFormat || _this36.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5547
5576
|
}
|
|
5548
5577
|
|
|
5549
5578
|
if (!pointB.y.color) {
|
|
@@ -5556,7 +5585,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5556
5585
|
tooltipTitle = pointA.x.value;
|
|
5557
5586
|
|
|
5558
5587
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5559
|
-
tooltipTitle = d3.timeFormat(
|
|
5588
|
+
tooltipTitle = d3.timeFormat(_this36.options.dateFormat || _this36.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5560
5589
|
}
|
|
5561
5590
|
|
|
5562
5591
|
if (!pointA.y.color) {
|
|
@@ -5661,7 +5690,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5661
5690
|
}, {
|
|
5662
5691
|
key: "render",
|
|
5663
5692
|
value: function render(options) {
|
|
5664
|
-
var
|
|
5693
|
+
var _this37 = this;
|
|
5665
5694
|
|
|
5666
5695
|
/* global d3 options WebsyUtils */
|
|
5667
5696
|
if (typeof options !== 'undefined') {
|
|
@@ -5730,7 +5759,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5730
5759
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
5731
5760
|
return {
|
|
5732
5761
|
value: s.label || s.key,
|
|
5733
|
-
color: s.color ||
|
|
5762
|
+
color: s.color || _this37.options.colors[i % _this37.options.colors.length]
|
|
5734
5763
|
};
|
|
5735
5764
|
});
|
|
5736
5765
|
|
|
@@ -5982,7 +6011,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5982
6011
|
|
|
5983
6012
|
if (this.options.data.bottom.formatter) {
|
|
5984
6013
|
bAxisFunc.tickFormat(function (d) {
|
|
5985
|
-
return
|
|
6014
|
+
return _this37.options.data.bottom.formatter(d);
|
|
5986
6015
|
});
|
|
5987
6016
|
}
|
|
5988
6017
|
|
|
@@ -6008,8 +6037,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6008
6037
|
|
|
6009
6038
|
if (this.options.margin.axisLeft > 0) {
|
|
6010
6039
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
6011
|
-
if (
|
|
6012
|
-
d =
|
|
6040
|
+
if (_this37.options.data.left.formatter) {
|
|
6041
|
+
d = _this37.options.data.left.formatter(d);
|
|
6013
6042
|
}
|
|
6014
6043
|
|
|
6015
6044
|
return d;
|
|
@@ -6046,8 +6075,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6046
6075
|
|
|
6047
6076
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
6048
6077
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
6049
|
-
if (
|
|
6050
|
-
d =
|
|
6078
|
+
if (_this37.options.data.right.formatter) {
|
|
6079
|
+
d = _this37.options.data.right.formatter(d);
|
|
6051
6080
|
}
|
|
6052
6081
|
|
|
6053
6082
|
return d;
|
|
@@ -6073,16 +6102,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6073
6102
|
|
|
6074
6103
|
this.options.data.series.forEach(function (series, index) {
|
|
6075
6104
|
if (!series.key) {
|
|
6076
|
-
series.key =
|
|
6105
|
+
series.key = _this37.createIdentity();
|
|
6077
6106
|
}
|
|
6078
6107
|
|
|
6079
6108
|
if (!series.color) {
|
|
6080
|
-
series.color =
|
|
6109
|
+
series.color = _this37.options.colors[index % _this37.options.colors.length];
|
|
6081
6110
|
}
|
|
6082
6111
|
|
|
6083
|
-
|
|
6112
|
+
_this37["render".concat(series.type || 'bar')](series, index);
|
|
6084
6113
|
|
|
6085
|
-
|
|
6114
|
+
_this37.renderLabels(series, index);
|
|
6086
6115
|
});
|
|
6087
6116
|
}
|
|
6088
6117
|
}
|
|
@@ -6090,17 +6119,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6090
6119
|
}, {
|
|
6091
6120
|
key: "renderarea",
|
|
6092
6121
|
value: function renderarea(series, index) {
|
|
6093
|
-
var
|
|
6122
|
+
var _this38 = this;
|
|
6094
6123
|
|
|
6095
6124
|
/* global d3 series index */
|
|
6096
6125
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
6097
6126
|
return d3.area().x(function (d) {
|
|
6098
|
-
return
|
|
6127
|
+
return _this38[xAxis](_this38.parseX(d.x.value));
|
|
6099
6128
|
}).y0(function (d) {
|
|
6100
|
-
return
|
|
6129
|
+
return _this38[yAxis](0);
|
|
6101
6130
|
}).y1(function (d) {
|
|
6102
|
-
return
|
|
6103
|
-
}).curve(d3[curveStyle ||
|
|
6131
|
+
return _this38[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6132
|
+
}).curve(d3[curveStyle || _this38.options.curveStyle]);
|
|
6104
6133
|
};
|
|
6105
6134
|
|
|
6106
6135
|
var xAxis = 'bottomAxis';
|
|
@@ -6275,15 +6304,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6275
6304
|
}, {
|
|
6276
6305
|
key: "renderline",
|
|
6277
6306
|
value: function renderline(series, index) {
|
|
6278
|
-
var
|
|
6307
|
+
var _this39 = this;
|
|
6279
6308
|
|
|
6280
6309
|
/* global series index d3 */
|
|
6281
6310
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
6282
6311
|
return d3.line().x(function (d) {
|
|
6283
|
-
return
|
|
6312
|
+
return _this39[xAxis](_this39.parseX(d.x.value));
|
|
6284
6313
|
}).y(function (d) {
|
|
6285
|
-
return
|
|
6286
|
-
}).curve(d3[curveStyle ||
|
|
6314
|
+
return _this39[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6315
|
+
}).curve(d3[curveStyle || _this39.options.curveStyle]);
|
|
6287
6316
|
};
|
|
6288
6317
|
|
|
6289
6318
|
var xAxis = 'bottomAxis';
|
|
@@ -6321,14 +6350,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6321
6350
|
}, {
|
|
6322
6351
|
key: "rendersymbol",
|
|
6323
6352
|
value: function rendersymbol(series, index) {
|
|
6324
|
-
var
|
|
6353
|
+
var _this40 = this;
|
|
6325
6354
|
|
|
6326
6355
|
/* global d3 series index series.key */
|
|
6327
6356
|
var drawSymbol = function drawSymbol(size) {
|
|
6328
6357
|
return d3.symbol() // .type(d => {
|
|
6329
6358
|
// return d3.symbols[0]
|
|
6330
6359
|
// })
|
|
6331
|
-
.size(size ||
|
|
6360
|
+
.size(size || _this40.options.symbolSize);
|
|
6332
6361
|
};
|
|
6333
6362
|
|
|
6334
6363
|
var xAxis = 'bottomAxis';
|
|
@@ -6346,7 +6375,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6346
6375
|
symbols.attr('d', function (d) {
|
|
6347
6376
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
6348
6377
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
6349
|
-
return "translate(".concat(
|
|
6378
|
+
return "translate(".concat(_this40[xAxis](_this40.parseX(d.x.value)), ", ").concat(_this40[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
6350
6379
|
}); // Enter
|
|
6351
6380
|
|
|
6352
6381
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -6355,7 +6384,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6355
6384
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
6356
6385
|
return "symbol symbol_".concat(series.key);
|
|
6357
6386
|
}).attr('transform', function (d) {
|
|
6358
|
-
return "translate(".concat(
|
|
6387
|
+
return "translate(".concat(_this40[xAxis](_this40.parseX(d.x.value)), ", ").concat(_this40[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
6359
6388
|
});
|
|
6360
6389
|
}
|
|
6361
6390
|
}, {
|
|
@@ -6510,7 +6539,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6510
6539
|
}, {
|
|
6511
6540
|
key: "resize",
|
|
6512
6541
|
value: function resize() {
|
|
6513
|
-
var
|
|
6542
|
+
var _this41 = this;
|
|
6514
6543
|
|
|
6515
6544
|
var el = document.getElementById(this.elementId);
|
|
6516
6545
|
|
|
@@ -6523,7 +6552,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6523
6552
|
// }
|
|
6524
6553
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
6525
6554
|
html += this._data.map(function (d, i) {
|
|
6526
|
-
return
|
|
6555
|
+
return _this41.getLegendItemHTML(d);
|
|
6527
6556
|
}).join('');
|
|
6528
6557
|
html += "\n <div>\n ";
|
|
6529
6558
|
el.innerHTML = html;
|
|
@@ -6695,7 +6724,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6695
6724
|
}, {
|
|
6696
6725
|
key: "render",
|
|
6697
6726
|
value: function render() {
|
|
6698
|
-
var
|
|
6727
|
+
var _this42 = this;
|
|
6699
6728
|
|
|
6700
6729
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
6701
6730
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -6704,7 +6733,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6704
6733
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
6705
6734
|
return {
|
|
6706
6735
|
value: s.label || s.key,
|
|
6707
|
-
color: s.color ||
|
|
6736
|
+
color: s.color || _this42.options.colors[i % _this42.options.colors.length]
|
|
6708
6737
|
};
|
|
6709
6738
|
});
|
|
6710
6739
|
var longestValue = legendData.map(function (s) {
|
|
@@ -6768,7 +6797,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6768
6797
|
|
|
6769
6798
|
if (this.polygons) {
|
|
6770
6799
|
this.polygons.forEach(function (p) {
|
|
6771
|
-
return
|
|
6800
|
+
return _this42.map.removeLayer(p);
|
|
6772
6801
|
});
|
|
6773
6802
|
}
|
|
6774
6803
|
|
|
@@ -6826,18 +6855,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6826
6855
|
}
|
|
6827
6856
|
|
|
6828
6857
|
if (!p.options.color) {
|
|
6829
|
-
p.options.color =
|
|
6858
|
+
p.options.color = _this42.options.colors[i % _this42.options.colors.length];
|
|
6830
6859
|
}
|
|
6831
6860
|
|
|
6832
6861
|
var pol = L.polygon(p.data.map(function (c) {
|
|
6833
6862
|
return c.map(function (d) {
|
|
6834
6863
|
return [d.Latitude, d.Longitude];
|
|
6835
6864
|
});
|
|
6836
|
-
}), p.options).addTo(
|
|
6865
|
+
}), p.options).addTo(_this42.map);
|
|
6837
6866
|
|
|
6838
|
-
|
|
6867
|
+
_this42.polygons.push(pol);
|
|
6839
6868
|
|
|
6840
|
-
|
|
6869
|
+
_this42.map.fitBounds(pol.getBounds());
|
|
6841
6870
|
});
|
|
6842
6871
|
} // if (this.data.markers.length > 0) {
|
|
6843
6872
|
// el.classList.remove('hidden')
|