@websy/websy-designs 1.2.18 → 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 +29 -7
- package/dist/websy-designs-es6.js +217 -194
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +29 -7
- package/dist/websy-designs.js +217 -194
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -1053,24 +1053,47 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1053
1053
|
}
|
|
1054
1054
|
}, {
|
|
1055
1055
|
key: "selectCustomRange",
|
|
1056
|
-
value: function selectCustomRange(
|
|
1057
|
-
var
|
|
1056
|
+
value: function selectCustomRange(rangeInput) {
|
|
1057
|
+
var _this6 = this;
|
|
1058
|
+
|
|
1058
1059
|
this.selectedRange = -1;
|
|
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
|
+
}
|
|
1060
1069
|
|
|
1061
|
-
|
|
1062
|
-
|
|
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]];
|
|
1063
1086
|
} // check if the custom range matches a configured range
|
|
1064
1087
|
|
|
1065
1088
|
|
|
1066
1089
|
for (var i = 0; i < this.options.ranges[this.options.mode].length; i++) {
|
|
1067
1090
|
if (this.options.ranges[this.options.mode][i].range.length === 1) {
|
|
1068
|
-
if (this.options.ranges[this.options.mode][i].range[0] ===
|
|
1091
|
+
if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0]) {
|
|
1069
1092
|
this.selectedRange = i;
|
|
1070
1093
|
break;
|
|
1071
1094
|
}
|
|
1072
1095
|
} else if (this.options.ranges[this.options.mode][i].range.length === 2) {
|
|
1073
|
-
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]) {
|
|
1074
1097
|
this.selectedRange = i;
|
|
1075
1098
|
break;
|
|
1076
1099
|
}
|
|
@@ -1104,27 +1127,27 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1104
1127
|
}, {
|
|
1105
1128
|
key: "updateRange",
|
|
1106
1129
|
value: function updateRange() {
|
|
1107
|
-
var
|
|
1130
|
+
var _this7 = this;
|
|
1108
1131
|
|
|
1109
1132
|
var range;
|
|
1110
1133
|
|
|
1111
1134
|
if (this.selectedRange === -1) {
|
|
1112
1135
|
var list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(function (d) {
|
|
1113
|
-
if (
|
|
1136
|
+
if (_this7.options.mode === 'date') {
|
|
1114
1137
|
if (!d.toLocaleDateString) {
|
|
1115
1138
|
d = new Date(d);
|
|
1116
1139
|
}
|
|
1117
1140
|
|
|
1118
1141
|
return d.toLocaleDateString();
|
|
1119
|
-
} else if (
|
|
1142
|
+
} else if (_this7.options.mode === 'year') {
|
|
1120
1143
|
return d;
|
|
1121
|
-
} else if (
|
|
1144
|
+
} else if (_this7.options.mode === 'monthyear') {
|
|
1122
1145
|
if (!d.getMonth) {
|
|
1123
1146
|
d = new Date(d);
|
|
1124
1147
|
}
|
|
1125
1148
|
|
|
1126
|
-
return "".concat(
|
|
1127
|
-
} else if (
|
|
1149
|
+
return "".concat(_this7.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
1150
|
+
} else if (_this7.options.mode === 'hour') {
|
|
1128
1151
|
return d;
|
|
1129
1152
|
}
|
|
1130
1153
|
});
|
|
@@ -1184,7 +1207,7 @@ Date.prototype.floor = function () {
|
|
|
1184
1207
|
|
|
1185
1208
|
var WebsyDropdown = /*#__PURE__*/function () {
|
|
1186
1209
|
function WebsyDropdown(elementId, options) {
|
|
1187
|
-
var
|
|
1210
|
+
var _this8 = this;
|
|
1188
1211
|
|
|
1189
1212
|
_classCallCheck(this, WebsyDropdown);
|
|
1190
1213
|
|
|
@@ -1228,10 +1251,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1228
1251
|
el.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
1229
1252
|
el.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
1230
1253
|
var headerLabel = this.selectedItems.map(function (s) {
|
|
1231
|
-
return
|
|
1254
|
+
return _this8.options.items[s].label || _this8.options.items[s].value;
|
|
1232
1255
|
}).join(this.options.multiValueDelimiter);
|
|
1233
1256
|
var headerValue = this.selectedItems.map(function (s) {
|
|
1234
|
-
return
|
|
1257
|
+
return _this8.options.items[s].value || _this8.options.items[s].label;
|
|
1235
1258
|
}).join(this.options.multiValueDelimiter);
|
|
1236
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 ");
|
|
1237
1260
|
|
|
@@ -1514,10 +1537,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1514
1537
|
}, {
|
|
1515
1538
|
key: "renderItems",
|
|
1516
1539
|
value: function renderItems() {
|
|
1517
|
-
var
|
|
1540
|
+
var _this9 = this;
|
|
1518
1541
|
|
|
1519
1542
|
var html = this.options.items.map(function (r, i) {
|
|
1520
|
-
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 ");
|
|
1521
1544
|
}).join('');
|
|
1522
1545
|
var el = document.getElementById("".concat(this.elementId, "_items"));
|
|
1523
1546
|
|
|
@@ -1536,7 +1559,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1536
1559
|
}, {
|
|
1537
1560
|
key: "updateHeader",
|
|
1538
1561
|
value: function updateHeader(item) {
|
|
1539
|
-
var
|
|
1562
|
+
var _this10 = this;
|
|
1540
1563
|
|
|
1541
1564
|
var el = document.getElementById(this.elementId);
|
|
1542
1565
|
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
@@ -1583,17 +1606,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1583
1606
|
} else if (this.selectedItems.length > 1) {
|
|
1584
1607
|
if (this.options.showCompleteSelectedList === true) {
|
|
1585
1608
|
var selectedLabels = this.selectedItems.map(function (s) {
|
|
1586
|
-
return
|
|
1609
|
+
return _this10.options.items[s].label || _this10.options.items[s].value;
|
|
1587
1610
|
}).join(this.options.multiValueDelimiter);
|
|
1588
1611
|
var selectedValues = this.selectedItems.map(function (s) {
|
|
1589
|
-
return
|
|
1612
|
+
return _this10.options.items[s].value || _this10.options.items[s].label;
|
|
1590
1613
|
}).join(this.options.multiValueDelimiter);
|
|
1591
1614
|
labelEl.innerHTML = selectedLabels;
|
|
1592
1615
|
labelEl.setAttribute('data-info', selectedLabels);
|
|
1593
1616
|
inputEl.value = selectedValues;
|
|
1594
1617
|
} else {
|
|
1595
1618
|
var _selectedValues = this.selectedItems.map(function (s) {
|
|
1596
|
-
return
|
|
1619
|
+
return _this10.options.items[s].value || _this10.options.items[s].label;
|
|
1597
1620
|
}).join(this.options.multiValueDelimiter);
|
|
1598
1621
|
|
|
1599
1622
|
labelEl.innerHTML = "".concat(this.selectedItems.length, " selected");
|
|
@@ -1730,16 +1753,16 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1730
1753
|
}, {
|
|
1731
1754
|
key: "checkRecaptcha",
|
|
1732
1755
|
value: function checkRecaptcha() {
|
|
1733
|
-
var
|
|
1756
|
+
var _this11 = this;
|
|
1734
1757
|
|
|
1735
1758
|
return new Promise(function (resolve, reject) {
|
|
1736
|
-
if (
|
|
1759
|
+
if (_this11.options.useRecaptcha === true) {
|
|
1737
1760
|
// if (this.recaptchaValue) {
|
|
1738
1761
|
grecaptcha.ready(function () {
|
|
1739
1762
|
grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
|
|
1740
1763
|
action: 'submit'
|
|
1741
1764
|
}).then(function (token) {
|
|
1742
|
-
|
|
1765
|
+
_this11.apiService.add('google/checkrecaptcha', {
|
|
1743
1766
|
grecaptcharesponse: token
|
|
1744
1767
|
}).then(function (response) {
|
|
1745
1768
|
if (response.success && response.success === true) {
|
|
@@ -1802,14 +1825,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1802
1825
|
}, {
|
|
1803
1826
|
key: "processComponents",
|
|
1804
1827
|
value: function processComponents(components, callbackFn) {
|
|
1805
|
-
var
|
|
1828
|
+
var _this12 = this;
|
|
1806
1829
|
|
|
1807
1830
|
if (components.length === 0) {
|
|
1808
1831
|
callbackFn();
|
|
1809
1832
|
} else {
|
|
1810
1833
|
components.forEach(function (c) {
|
|
1811
1834
|
if (typeof WebsyDesigns[c.component] !== 'undefined') {
|
|
1812
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
1835
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this12.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
1813
1836
|
} else {// some user feedback here
|
|
1814
1837
|
}
|
|
1815
1838
|
});
|
|
@@ -1830,7 +1853,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1830
1853
|
}, {
|
|
1831
1854
|
key: "render",
|
|
1832
1855
|
value: function render(update, data) {
|
|
1833
|
-
var
|
|
1856
|
+
var _this13 = this;
|
|
1834
1857
|
|
|
1835
1858
|
var el = document.getElementById(this.elementId);
|
|
1836
1859
|
var componentsToProcess = [];
|
|
@@ -1840,11 +1863,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1840
1863
|
this.options.fields.forEach(function (f, i) {
|
|
1841
1864
|
if (f.component) {
|
|
1842
1865
|
componentsToProcess.push(f);
|
|
1843
|
-
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 ");
|
|
1844
1867
|
} else if (f.type === 'longtext') {
|
|
1845
|
-
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 ");
|
|
1846
1869
|
} else {
|
|
1847
|
-
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 ");
|
|
1848
1871
|
}
|
|
1849
1872
|
});
|
|
1850
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 ");
|
|
@@ -1861,7 +1884,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1861
1884
|
|
|
1862
1885
|
el.innerHTML = html;
|
|
1863
1886
|
this.processComponents(componentsToProcess, function () {
|
|
1864
|
-
if (
|
|
1887
|
+
if (_this13.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
|
|
1865
1888
|
}
|
|
1866
1889
|
});
|
|
1867
1890
|
}
|
|
@@ -1869,7 +1892,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1869
1892
|
}, {
|
|
1870
1893
|
key: "submitForm",
|
|
1871
1894
|
value: function submitForm() {
|
|
1872
|
-
var
|
|
1895
|
+
var _this14 = this;
|
|
1873
1896
|
|
|
1874
1897
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
1875
1898
|
|
|
@@ -1883,32 +1906,32 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1883
1906
|
data[key] = value;
|
|
1884
1907
|
});
|
|
1885
1908
|
|
|
1886
|
-
if (
|
|
1887
|
-
var
|
|
1909
|
+
if (_this14.options.url) {
|
|
1910
|
+
var _this14$apiService;
|
|
1888
1911
|
|
|
1889
|
-
var params = [
|
|
1912
|
+
var params = [_this14.options.url];
|
|
1890
1913
|
|
|
1891
|
-
if (
|
|
1892
|
-
params.push(
|
|
1914
|
+
if (_this14.options.mode === 'update') {
|
|
1915
|
+
params.push(_this14.options.id);
|
|
1893
1916
|
}
|
|
1894
1917
|
|
|
1895
1918
|
params.push(data);
|
|
1896
1919
|
|
|
1897
|
-
(
|
|
1898
|
-
if (
|
|
1920
|
+
(_this14$apiService = _this14.apiService)[_this14.options.mode].apply(_this14$apiService, params).then(function (result) {
|
|
1921
|
+
if (_this14.options.clearAfterSave === true) {
|
|
1899
1922
|
// this.render()
|
|
1900
1923
|
formEl.reset();
|
|
1901
1924
|
}
|
|
1902
1925
|
|
|
1903
|
-
|
|
1926
|
+
_this14.options.onSuccess.call(_this14, result);
|
|
1904
1927
|
}, function (err) {
|
|
1905
1928
|
console.log('Error submitting form data:', err);
|
|
1906
1929
|
|
|
1907
|
-
|
|
1930
|
+
_this14.options.onError.call(_this14, err);
|
|
1908
1931
|
});
|
|
1909
|
-
} else if (
|
|
1910
|
-
|
|
1911
|
-
if (
|
|
1932
|
+
} else if (_this14.options.submitFn) {
|
|
1933
|
+
_this14.options.submitFn(data, function () {
|
|
1934
|
+
if (_this14.options.clearAfterSave === true) {
|
|
1912
1935
|
// this.render()
|
|
1913
1936
|
formEl.reset();
|
|
1914
1937
|
}
|
|
@@ -1928,17 +1951,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1928
1951
|
}, {
|
|
1929
1952
|
key: "data",
|
|
1930
1953
|
set: function set(d) {
|
|
1931
|
-
var
|
|
1954
|
+
var _this15 = this;
|
|
1932
1955
|
|
|
1933
1956
|
if (!this.options.fields) {
|
|
1934
1957
|
this.options.fields = [];
|
|
1935
1958
|
}
|
|
1936
1959
|
|
|
1937
1960
|
var _loop = function _loop(key) {
|
|
1938
|
-
|
|
1961
|
+
_this15.options.fields.forEach(function (f) {
|
|
1939
1962
|
if (f.field === key) {
|
|
1940
1963
|
f.value = d[key];
|
|
1941
|
-
var el = document.getElementById("".concat(
|
|
1964
|
+
var el = document.getElementById("".concat(_this15.elementId, "_input_").concat(f.field));
|
|
1942
1965
|
el.value = f.value;
|
|
1943
1966
|
}
|
|
1944
1967
|
});
|
|
@@ -2250,7 +2273,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2250
2273
|
|
|
2251
2274
|
var Pager = /*#__PURE__*/function () {
|
|
2252
2275
|
function Pager(elementId, options) {
|
|
2253
|
-
var
|
|
2276
|
+
var _this16 = this;
|
|
2254
2277
|
|
|
2255
2278
|
_classCallCheck(this, Pager);
|
|
2256
2279
|
|
|
@@ -2303,8 +2326,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2303
2326
|
allowClear: false,
|
|
2304
2327
|
disableSearch: true,
|
|
2305
2328
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
2306
|
-
if (
|
|
2307
|
-
|
|
2329
|
+
if (_this16.options.onChangePageSize) {
|
|
2330
|
+
_this16.options.onChangePageSize(selectedItem.value);
|
|
2308
2331
|
}
|
|
2309
2332
|
}
|
|
2310
2333
|
});
|
|
@@ -2328,13 +2351,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2328
2351
|
}, {
|
|
2329
2352
|
key: "render",
|
|
2330
2353
|
value: function render() {
|
|
2331
|
-
var
|
|
2354
|
+
var _this17 = this;
|
|
2332
2355
|
|
|
2333
2356
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
2334
2357
|
|
|
2335
2358
|
if (el) {
|
|
2336
2359
|
var pages = this.options.pages.map(function (item, index) {
|
|
2337
|
-
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>");
|
|
2338
2361
|
});
|
|
2339
2362
|
var startIndex = 0;
|
|
2340
2363
|
|
|
@@ -2402,58 +2425,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2402
2425
|
_createClass(WebsyPDFButton, [{
|
|
2403
2426
|
key: "handleClick",
|
|
2404
2427
|
value: function handleClick(event) {
|
|
2405
|
-
var
|
|
2428
|
+
var _this18 = this;
|
|
2406
2429
|
|
|
2407
2430
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
2408
2431
|
this.loader.show();
|
|
2409
2432
|
setTimeout(function () {
|
|
2410
|
-
if (
|
|
2411
|
-
var el = document.getElementById(
|
|
2433
|
+
if (_this18.options.targetId) {
|
|
2434
|
+
var el = document.getElementById(_this18.options.targetId);
|
|
2412
2435
|
|
|
2413
2436
|
if (el) {
|
|
2414
2437
|
var pdfData = {
|
|
2415
2438
|
options: {}
|
|
2416
2439
|
};
|
|
2417
2440
|
|
|
2418
|
-
if (
|
|
2419
|
-
pdfData.options = _extends({},
|
|
2441
|
+
if (_this18.options.pdfOptions) {
|
|
2442
|
+
pdfData.options = _extends({}, _this18.options.pdfOptions);
|
|
2420
2443
|
}
|
|
2421
2444
|
|
|
2422
|
-
if (
|
|
2423
|
-
if (
|
|
2424
|
-
var headerEl = document.getElementById(
|
|
2445
|
+
if (_this18.options.header) {
|
|
2446
|
+
if (_this18.options.header.elementId) {
|
|
2447
|
+
var headerEl = document.getElementById(_this18.options.header.elementId);
|
|
2425
2448
|
|
|
2426
2449
|
if (headerEl) {
|
|
2427
2450
|
pdfData.header = headerEl.outerHTML;
|
|
2428
2451
|
|
|
2429
|
-
if (
|
|
2430
|
-
pdfData.options.headerCSS =
|
|
2452
|
+
if (_this18.options.header.css) {
|
|
2453
|
+
pdfData.options.headerCSS = _this18.options.header.css;
|
|
2431
2454
|
}
|
|
2432
2455
|
}
|
|
2433
|
-
} else if (
|
|
2434
|
-
pdfData.header =
|
|
2456
|
+
} else if (_this18.options.header.html) {
|
|
2457
|
+
pdfData.header = _this18.options.header.html;
|
|
2435
2458
|
|
|
2436
|
-
if (
|
|
2437
|
-
pdfData.options.headerCSS =
|
|
2459
|
+
if (_this18.options.header.css) {
|
|
2460
|
+
pdfData.options.headerCSS = _this18.options.header.css;
|
|
2438
2461
|
}
|
|
2439
2462
|
} else {
|
|
2440
|
-
pdfData.header =
|
|
2463
|
+
pdfData.header = _this18.options.header;
|
|
2441
2464
|
}
|
|
2442
2465
|
}
|
|
2443
2466
|
|
|
2444
|
-
if (
|
|
2445
|
-
if (
|
|
2446
|
-
var footerEl = document.getElementById(
|
|
2467
|
+
if (_this18.options.footer) {
|
|
2468
|
+
if (_this18.options.footer.elementId) {
|
|
2469
|
+
var footerEl = document.getElementById(_this18.options.footer.elementId);
|
|
2447
2470
|
|
|
2448
2471
|
if (footerEl) {
|
|
2449
2472
|
pdfData.footer = footerEl.outerHTML;
|
|
2450
2473
|
|
|
2451
|
-
if (
|
|
2452
|
-
pdfData.options.footerCSS =
|
|
2474
|
+
if (_this18.options.footer.css) {
|
|
2475
|
+
pdfData.options.footerCSS = _this18.options.footer.css;
|
|
2453
2476
|
}
|
|
2454
2477
|
}
|
|
2455
2478
|
} else {
|
|
2456
|
-
pdfData.footer =
|
|
2479
|
+
pdfData.footer = _this18.options.footer;
|
|
2457
2480
|
}
|
|
2458
2481
|
}
|
|
2459
2482
|
|
|
@@ -2462,31 +2485,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2462
2485
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
2463
2486
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
2464
2487
|
|
|
2465
|
-
|
|
2488
|
+
_this18.service.add('', pdfData, {
|
|
2466
2489
|
responseType: 'blob'
|
|
2467
2490
|
}).then(function (response) {
|
|
2468
|
-
|
|
2491
|
+
_this18.loader.hide();
|
|
2469
2492
|
|
|
2470
2493
|
var blob = new Blob([response], {
|
|
2471
2494
|
type: 'application/pdf'
|
|
2472
2495
|
});
|
|
2473
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 ");
|
|
2474
2497
|
|
|
2475
|
-
if (
|
|
2498
|
+
if (_this18.options.directDownload === true) {
|
|
2476
2499
|
var fileName;
|
|
2477
2500
|
|
|
2478
|
-
if (typeof
|
|
2479
|
-
fileName =
|
|
2501
|
+
if (typeof _this18.options.fileName === 'function') {
|
|
2502
|
+
fileName = _this18.options.fileName() || 'Export';
|
|
2480
2503
|
} else {
|
|
2481
|
-
fileName =
|
|
2504
|
+
fileName = _this18.options.fileName || 'Export';
|
|
2482
2505
|
}
|
|
2483
2506
|
|
|
2484
2507
|
msg += "download='".concat(fileName, ".pdf'");
|
|
2485
2508
|
}
|
|
2486
2509
|
|
|
2487
|
-
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 ");
|
|
2488
2511
|
|
|
2489
|
-
|
|
2512
|
+
_this18.popup.show({
|
|
2490
2513
|
message: msg,
|
|
2491
2514
|
mask: true
|
|
2492
2515
|
});
|
|
@@ -2671,7 +2694,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
2671
2694
|
|
|
2672
2695
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
2673
2696
|
function ResponsiveText(elementId, options) {
|
|
2674
|
-
var
|
|
2697
|
+
var _this19 = this;
|
|
2675
2698
|
|
|
2676
2699
|
_classCallCheck(this, ResponsiveText);
|
|
2677
2700
|
|
|
@@ -2684,7 +2707,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
2684
2707
|
this.elementId = elementId;
|
|
2685
2708
|
this.canvas = document.createElement('canvas');
|
|
2686
2709
|
window.addEventListener('resize', function () {
|
|
2687
|
-
return
|
|
2710
|
+
return _this19.render();
|
|
2688
2711
|
});
|
|
2689
2712
|
var el = document.getElementById(this.elementId);
|
|
2690
2713
|
|
|
@@ -2903,7 +2926,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
2903
2926
|
|
|
2904
2927
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
2905
2928
|
function WebsyResultList(elementId, options) {
|
|
2906
|
-
var
|
|
2929
|
+
var _this20 = this;
|
|
2907
2930
|
|
|
2908
2931
|
_classCallCheck(this, WebsyResultList);
|
|
2909
2932
|
|
|
@@ -2931,9 +2954,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2931
2954
|
|
|
2932
2955
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
2933
2956
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
2934
|
-
|
|
2957
|
+
_this20.options.template = templateString;
|
|
2935
2958
|
|
|
2936
|
-
|
|
2959
|
+
_this20.render();
|
|
2937
2960
|
});
|
|
2938
2961
|
} else {
|
|
2939
2962
|
this.render();
|
|
@@ -2952,7 +2975,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2952
2975
|
}, {
|
|
2953
2976
|
key: "buildHTML",
|
|
2954
2977
|
value: function buildHTML(d) {
|
|
2955
|
-
var
|
|
2978
|
+
var _this21 = this;
|
|
2956
2979
|
|
|
2957
2980
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
2958
2981
|
var html = "";
|
|
@@ -2960,7 +2983,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2960
2983
|
if (this.options.template) {
|
|
2961
2984
|
if (d.length > 0) {
|
|
2962
2985
|
d.forEach(function (row, ix) {
|
|
2963
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(
|
|
2986
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(_this21.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
2964
2987
|
|
|
2965
2988
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
2966
2989
|
|
|
@@ -3080,7 +3103,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3080
3103
|
}, {
|
|
3081
3104
|
key: "handleClick",
|
|
3082
3105
|
value: function handleClick(event) {
|
|
3083
|
-
var
|
|
3106
|
+
var _this22 = this;
|
|
3084
3107
|
|
|
3085
3108
|
if (event.target.classList.contains('clickable')) {
|
|
3086
3109
|
var l = event.target.getAttribute('data-event');
|
|
@@ -3098,8 +3121,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3098
3121
|
l = l[0];
|
|
3099
3122
|
params = params.map(function (p) {
|
|
3100
3123
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
3101
|
-
if (
|
|
3102
|
-
p =
|
|
3124
|
+
if (_this22.rows[+id]) {
|
|
3125
|
+
p = _this22.rows[+id][p];
|
|
3103
3126
|
}
|
|
3104
3127
|
} else if (typeof p === 'string') {
|
|
3105
3128
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -3121,13 +3144,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3121
3144
|
}, {
|
|
3122
3145
|
key: "render",
|
|
3123
3146
|
value: function render() {
|
|
3124
|
-
var
|
|
3147
|
+
var _this23 = this;
|
|
3125
3148
|
|
|
3126
3149
|
if (this.options.entity) {
|
|
3127
3150
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3128
|
-
|
|
3151
|
+
_this23.rows = results.rows;
|
|
3129
3152
|
|
|
3130
|
-
|
|
3153
|
+
_this23.resize();
|
|
3131
3154
|
});
|
|
3132
3155
|
} else {
|
|
3133
3156
|
this.resize();
|
|
@@ -3206,14 +3229,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3206
3229
|
_createClass(WebsyRouter, [{
|
|
3207
3230
|
key: "addGroup",
|
|
3208
3231
|
value: function addGroup(group) {
|
|
3209
|
-
var
|
|
3232
|
+
var _this24 = this;
|
|
3210
3233
|
|
|
3211
3234
|
if (!this.groups[group]) {
|
|
3212
3235
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3213
3236
|
|
|
3214
3237
|
if (els) {
|
|
3215
3238
|
this.getClosestParent(els[0], function (parent) {
|
|
3216
|
-
|
|
3239
|
+
_this24.groups[group] = {
|
|
3217
3240
|
activeView: '',
|
|
3218
3241
|
views: [],
|
|
3219
3242
|
parent: parent.getAttribute('data-view')
|
|
@@ -3538,12 +3561,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3538
3561
|
}, {
|
|
3539
3562
|
key: "showComponents",
|
|
3540
3563
|
value: function showComponents(view) {
|
|
3541
|
-
var
|
|
3564
|
+
var _this25 = this;
|
|
3542
3565
|
|
|
3543
3566
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
3544
3567
|
this.options.views[view].components.forEach(function (c) {
|
|
3545
3568
|
if (typeof c.instance === 'undefined') {
|
|
3546
|
-
|
|
3569
|
+
_this25.prepComponent(c.elementId, c.options);
|
|
3547
3570
|
|
|
3548
3571
|
c.instance = new c.Component(c.elementId, c.options);
|
|
3549
3572
|
} else if (c.instance.render) {
|
|
@@ -3912,7 +3935,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
3912
3935
|
|
|
3913
3936
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
3914
3937
|
function WebsyTemplate(elementId, options) {
|
|
3915
|
-
var
|
|
3938
|
+
var _this26 = this;
|
|
3916
3939
|
|
|
3917
3940
|
_classCallCheck(this, WebsyTemplate);
|
|
3918
3941
|
|
|
@@ -3938,9 +3961,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3938
3961
|
|
|
3939
3962
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3940
3963
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3941
|
-
|
|
3964
|
+
_this26.options.template = templateString;
|
|
3942
3965
|
|
|
3943
|
-
|
|
3966
|
+
_this26.render();
|
|
3944
3967
|
});
|
|
3945
3968
|
} else {
|
|
3946
3969
|
this.render();
|
|
@@ -3950,7 +3973,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3950
3973
|
_createClass(WebsyTemplate, [{
|
|
3951
3974
|
key: "buildHTML",
|
|
3952
3975
|
value: function buildHTML() {
|
|
3953
|
-
var
|
|
3976
|
+
var _this27 = this;
|
|
3954
3977
|
|
|
3955
3978
|
var html = "";
|
|
3956
3979
|
|
|
@@ -4012,14 +4035,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4012
4035
|
}
|
|
4013
4036
|
|
|
4014
4037
|
if (polarity === true) {
|
|
4015
|
-
if (typeof
|
|
4038
|
+
if (typeof _this27.options.data[parts[0]] !== 'undefined' && _this27.options.data[parts[0]] === parts[1]) {
|
|
4016
4039
|
// remove the <if> tags
|
|
4017
4040
|
removeAll = false;
|
|
4018
4041
|
} else if (parts[0] === parts[1]) {
|
|
4019
4042
|
removeAll = false;
|
|
4020
4043
|
}
|
|
4021
4044
|
} else if (polarity === false) {
|
|
4022
|
-
if (typeof
|
|
4045
|
+
if (typeof _this27.options.data[parts[0]] !== 'undefined' && _this27.options.data[parts[0]] !== parts[1]) {
|
|
4023
4046
|
// remove the <if> tags
|
|
4024
4047
|
removeAll = false;
|
|
4025
4048
|
}
|
|
@@ -4306,7 +4329,7 @@ var WebsyUtils = {
|
|
|
4306
4329
|
|
|
4307
4330
|
var WebsyTable = /*#__PURE__*/function () {
|
|
4308
4331
|
function WebsyTable(elementId, options) {
|
|
4309
|
-
var
|
|
4332
|
+
var _this28 = this;
|
|
4310
4333
|
|
|
4311
4334
|
_classCallCheck(this, WebsyTable);
|
|
4312
4335
|
|
|
@@ -4344,8 +4367,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4344
4367
|
allowClear: false,
|
|
4345
4368
|
disableSearch: true,
|
|
4346
4369
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4347
|
-
if (
|
|
4348
|
-
|
|
4370
|
+
if (_this28.options.onChangePageSize) {
|
|
4371
|
+
_this28.options.onChangePageSize(selectedItem.value);
|
|
4349
4372
|
}
|
|
4350
4373
|
}
|
|
4351
4374
|
});
|
|
@@ -4366,7 +4389,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4366
4389
|
_createClass(WebsyTable, [{
|
|
4367
4390
|
key: "appendRows",
|
|
4368
4391
|
value: function appendRows(data) {
|
|
4369
|
-
var
|
|
4392
|
+
var _this29 = this;
|
|
4370
4393
|
|
|
4371
4394
|
this.hideError();
|
|
4372
4395
|
var bodyHTML = '';
|
|
@@ -4374,15 +4397,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4374
4397
|
if (data) {
|
|
4375
4398
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4376
4399
|
return '<tr>' + r.map(function (c, i) {
|
|
4377
|
-
if (
|
|
4400
|
+
if (_this29.options.columns[i].show !== false) {
|
|
4378
4401
|
var style = '';
|
|
4379
4402
|
|
|
4380
4403
|
if (c.style) {
|
|
4381
4404
|
style += c.style;
|
|
4382
4405
|
}
|
|
4383
4406
|
|
|
4384
|
-
if (
|
|
4385
|
-
style += "width: ".concat(
|
|
4407
|
+
if (_this29.options.columns[i].width) {
|
|
4408
|
+
style += "width: ".concat(_this29.options.columns[i].width, "; ");
|
|
4386
4409
|
}
|
|
4387
4410
|
|
|
4388
4411
|
if (c.backgroundColor) {
|
|
@@ -4397,18 +4420,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4397
4420
|
style += "color: ".concat(c.color, "; ");
|
|
4398
4421
|
}
|
|
4399
4422
|
|
|
4400
|
-
if (
|
|
4401
|
-
return "\n <td \n data-row-index='".concat(
|
|
4402
|
-
} else if ((
|
|
4403
|
-
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 ");
|
|
4404
4427
|
} else {
|
|
4405
4428
|
var info = c.value;
|
|
4406
4429
|
|
|
4407
|
-
if (
|
|
4430
|
+
if (_this29.options.columns[i].showAsImage === true) {
|
|
4408
4431
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4409
4432
|
}
|
|
4410
4433
|
|
|
4411
|
-
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 ");
|
|
4412
4435
|
}
|
|
4413
4436
|
}
|
|
4414
4437
|
}).join('') + '</tr>';
|
|
@@ -4580,7 +4603,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4580
4603
|
}, {
|
|
4581
4604
|
key: "render",
|
|
4582
4605
|
value: function render(data) {
|
|
4583
|
-
var
|
|
4606
|
+
var _this30 = this;
|
|
4584
4607
|
|
|
4585
4608
|
if (!this.options.columns) {
|
|
4586
4609
|
return;
|
|
@@ -4605,7 +4628,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4605
4628
|
|
|
4606
4629
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
4607
4630
|
if (c.show !== false) {
|
|
4608
|
-
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 ");
|
|
4609
4632
|
}
|
|
4610
4633
|
}).join('') + '</tr>';
|
|
4611
4634
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -4624,7 +4647,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4624
4647
|
|
|
4625
4648
|
if (pagingEl) {
|
|
4626
4649
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
4627
|
-
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>");
|
|
4628
4651
|
});
|
|
4629
4652
|
var startIndex = 0;
|
|
4630
4653
|
|
|
@@ -4692,7 +4715,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4692
4715
|
|
|
4693
4716
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
4694
4717
|
function WebsyTable2(elementId, options) {
|
|
4695
|
-
var
|
|
4718
|
+
var _this31 = this;
|
|
4696
4719
|
|
|
4697
4720
|
_classCallCheck(this, WebsyTable2);
|
|
4698
4721
|
|
|
@@ -4733,8 +4756,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4733
4756
|
allowClear: false,
|
|
4734
4757
|
disableSearch: true,
|
|
4735
4758
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4736
|
-
if (
|
|
4737
|
-
|
|
4759
|
+
if (_this31.options.onChangePageSize) {
|
|
4760
|
+
_this31.options.onChangePageSize(selectedItem.value);
|
|
4738
4761
|
}
|
|
4739
4762
|
}
|
|
4740
4763
|
});
|
|
@@ -4758,7 +4781,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4758
4781
|
_createClass(WebsyTable2, [{
|
|
4759
4782
|
key: "appendRows",
|
|
4760
4783
|
value: function appendRows(data) {
|
|
4761
|
-
var
|
|
4784
|
+
var _this32 = this;
|
|
4762
4785
|
|
|
4763
4786
|
this.hideError();
|
|
4764
4787
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -4767,15 +4790,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4767
4790
|
if (data) {
|
|
4768
4791
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4769
4792
|
return '<tr>' + r.map(function (c, i) {
|
|
4770
|
-
if (
|
|
4771
|
-
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;");
|
|
4772
4795
|
|
|
4773
4796
|
if (c.style) {
|
|
4774
4797
|
style += c.style;
|
|
4775
4798
|
}
|
|
4776
4799
|
|
|
4777
|
-
if (
|
|
4778
|
-
style += "width: ".concat(
|
|
4800
|
+
if (_this32.options.columns[i].width) {
|
|
4801
|
+
style += "width: ".concat(_this32.options.columns[i].width, "; ");
|
|
4779
4802
|
}
|
|
4780
4803
|
|
|
4781
4804
|
if (c.backgroundColor) {
|
|
@@ -4790,18 +4813,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4790
4813
|
style += "color: ".concat(c.color, "; ");
|
|
4791
4814
|
}
|
|
4792
4815
|
|
|
4793
|
-
if (
|
|
4794
|
-
return "\n <td \n data-row-index='".concat(
|
|
4795
|
-
} else if ((
|
|
4796
|
-
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 ");
|
|
4797
4820
|
} else {
|
|
4798
4821
|
var info = c.value;
|
|
4799
4822
|
|
|
4800
|
-
if (
|
|
4823
|
+
if (_this32.options.columns[i].showAsImage === true) {
|
|
4801
4824
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4802
4825
|
}
|
|
4803
4826
|
|
|
4804
|
-
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 ");
|
|
4805
4828
|
}
|
|
4806
4829
|
}
|
|
4807
4830
|
}).join('') + '</tr>';
|
|
@@ -5059,7 +5082,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5059
5082
|
}, {
|
|
5060
5083
|
key: "render",
|
|
5061
5084
|
value: function render(data) {
|
|
5062
|
-
var
|
|
5085
|
+
var _this33 = this;
|
|
5063
5086
|
|
|
5064
5087
|
if (!this.options.columns) {
|
|
5065
5088
|
return;
|
|
@@ -5095,7 +5118,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5095
5118
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5096
5119
|
}
|
|
5097
5120
|
|
|
5098
|
-
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 ");
|
|
5099
5122
|
}
|
|
5100
5123
|
}).join('') + '</tr>';
|
|
5101
5124
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5106,7 +5129,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5106
5129
|
var dropdownHTML = "";
|
|
5107
5130
|
this.options.columns.forEach(function (c, i) {
|
|
5108
5131
|
if (c.searchable && c.searchField) {
|
|
5109
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5132
|
+
dropdownHTML += "\n <div id=\"".concat(_this33.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
5110
5133
|
}
|
|
5111
5134
|
});
|
|
5112
5135
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5128,7 +5151,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5128
5151
|
|
|
5129
5152
|
if (pagingEl) {
|
|
5130
5153
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5131
|
-
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>");
|
|
5132
5155
|
});
|
|
5133
5156
|
var startIndex = 0;
|
|
5134
5157
|
|
|
@@ -5215,7 +5238,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5215
5238
|
}, {
|
|
5216
5239
|
key: "getColumnParameters",
|
|
5217
5240
|
value: function getColumnParameters(values) {
|
|
5218
|
-
var
|
|
5241
|
+
var _this34 = this;
|
|
5219
5242
|
|
|
5220
5243
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
5221
5244
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -5223,10 +5246,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5223
5246
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
5224
5247
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5225
5248
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
5226
|
-
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 ");
|
|
5227
5250
|
}).join('') + '</tr>';
|
|
5228
5251
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
5229
|
-
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 ");
|
|
5230
5253
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
5231
5254
|
|
|
5232
5255
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -5276,7 +5299,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5276
5299
|
|
|
5277
5300
|
var WebsyChart = /*#__PURE__*/function () {
|
|
5278
5301
|
function WebsyChart(elementId, options) {
|
|
5279
|
-
var
|
|
5302
|
+
var _this35 = this;
|
|
5280
5303
|
|
|
5281
5304
|
_classCallCheck(this, WebsyChart);
|
|
5282
5305
|
|
|
@@ -5325,22 +5348,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5325
5348
|
this.invertOverride = function (input, input2) {
|
|
5326
5349
|
var xAxis = 'bottomAxis';
|
|
5327
5350
|
|
|
5328
|
-
if (
|
|
5351
|
+
if (_this35.options.orientation === 'horizontal') {
|
|
5329
5352
|
xAxis = 'leftAxis';
|
|
5330
5353
|
}
|
|
5331
5354
|
|
|
5332
|
-
var width =
|
|
5355
|
+
var width = _this35[xAxis].step();
|
|
5333
5356
|
|
|
5334
5357
|
var output;
|
|
5335
5358
|
|
|
5336
|
-
var domain = _toConsumableArray(
|
|
5359
|
+
var domain = _toConsumableArray(_this35[xAxis].domain());
|
|
5337
5360
|
|
|
5338
|
-
if (
|
|
5361
|
+
if (_this35.options.orientation === 'horizontal') {
|
|
5339
5362
|
domain = domain.reverse();
|
|
5340
5363
|
}
|
|
5341
5364
|
|
|
5342
5365
|
for (var j = 0; j < domain.length; j++) {
|
|
5343
|
-
var breakA =
|
|
5366
|
+
var breakA = _this35[xAxis](domain[j]) - width / 2;
|
|
5344
5367
|
var breakB = breakA + width;
|
|
5345
5368
|
|
|
5346
5369
|
if (input > breakA && input <= breakB) {
|
|
@@ -5440,10 +5463,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5440
5463
|
}, {
|
|
5441
5464
|
key: "handleEventMouseMove",
|
|
5442
5465
|
value: function handleEventMouseMove(event, d) {
|
|
5443
|
-
var
|
|
5466
|
+
var _this36 = this;
|
|
5444
5467
|
|
|
5445
5468
|
var bisectDate = d3.bisector(function (d) {
|
|
5446
|
-
return
|
|
5469
|
+
return _this36.parseX(d.x.value);
|
|
5447
5470
|
}).left;
|
|
5448
5471
|
|
|
5449
5472
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -5482,8 +5505,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5482
5505
|
}
|
|
5483
5506
|
|
|
5484
5507
|
this.options.data.series.forEach(function (s) {
|
|
5485
|
-
if (
|
|
5486
|
-
xPoint =
|
|
5508
|
+
if (_this36.options.data[xData].scale !== 'Time') {
|
|
5509
|
+
xPoint = _this36[xAxis](_this36.parseX(xLabel));
|
|
5487
5510
|
s.data.forEach(function (d) {
|
|
5488
5511
|
if (d.x.value === xLabel) {
|
|
5489
5512
|
if (!tooltipTitle) {
|
|
@@ -5502,13 +5525,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5502
5525
|
var pointA = s.data[index - 1];
|
|
5503
5526
|
var pointB = s.data[index];
|
|
5504
5527
|
|
|
5505
|
-
if (
|
|
5528
|
+
if (_this36.options.orientation === 'horizontal') {
|
|
5506
5529
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
5507
5530
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
5508
5531
|
}
|
|
5509
5532
|
|
|
5510
5533
|
if (pointA && !pointB) {
|
|
5511
|
-
xPoint =
|
|
5534
|
+
xPoint = _this36[xAxis](_this36.parseX(pointA.x.value));
|
|
5512
5535
|
tooltipTitle = pointA.x.value;
|
|
5513
5536
|
|
|
5514
5537
|
if (!pointA.y.color) {
|
|
@@ -5518,12 +5541,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5518
5541
|
tooltipData.push(pointA.y);
|
|
5519
5542
|
|
|
5520
5543
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
5521
|
-
tooltipTitle = d3.timeFormat(
|
|
5544
|
+
tooltipTitle = d3.timeFormat(_this36.options.dateFormat || _this36.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
5522
5545
|
}
|
|
5523
5546
|
}
|
|
5524
5547
|
|
|
5525
5548
|
if (pointB && !pointA) {
|
|
5526
|
-
xPoint =
|
|
5549
|
+
xPoint = _this36[xAxis](_this36.parseX(pointB.x.value));
|
|
5527
5550
|
tooltipTitle = pointB.x.value;
|
|
5528
5551
|
|
|
5529
5552
|
if (!pointB.y.color) {
|
|
@@ -5533,14 +5556,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5533
5556
|
tooltipData.push(pointB.y);
|
|
5534
5557
|
|
|
5535
5558
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5536
|
-
tooltipTitle = d3.timeFormat(
|
|
5559
|
+
tooltipTitle = d3.timeFormat(_this36.options.dateFormat || _this36.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5537
5560
|
}
|
|
5538
5561
|
}
|
|
5539
5562
|
|
|
5540
5563
|
if (pointA && pointB) {
|
|
5541
|
-
var d0 =
|
|
5564
|
+
var d0 = _this36[xAxis](_this36.parseX(pointA.x.value));
|
|
5542
5565
|
|
|
5543
|
-
var d1 =
|
|
5566
|
+
var d1 = _this36[xAxis](_this36.parseX(pointB.x.value));
|
|
5544
5567
|
|
|
5545
5568
|
var mid = Math.abs(d0 - d1) / 2;
|
|
5546
5569
|
|
|
@@ -5549,7 +5572,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5549
5572
|
tooltipTitle = pointB.x.value;
|
|
5550
5573
|
|
|
5551
5574
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5552
|
-
tooltipTitle = d3.timeFormat(
|
|
5575
|
+
tooltipTitle = d3.timeFormat(_this36.options.dateFormat || _this36.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5553
5576
|
}
|
|
5554
5577
|
|
|
5555
5578
|
if (!pointB.y.color) {
|
|
@@ -5562,7 +5585,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5562
5585
|
tooltipTitle = pointA.x.value;
|
|
5563
5586
|
|
|
5564
5587
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5565
|
-
tooltipTitle = d3.timeFormat(
|
|
5588
|
+
tooltipTitle = d3.timeFormat(_this36.options.dateFormat || _this36.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5566
5589
|
}
|
|
5567
5590
|
|
|
5568
5591
|
if (!pointA.y.color) {
|
|
@@ -5667,7 +5690,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5667
5690
|
}, {
|
|
5668
5691
|
key: "render",
|
|
5669
5692
|
value: function render(options) {
|
|
5670
|
-
var
|
|
5693
|
+
var _this37 = this;
|
|
5671
5694
|
|
|
5672
5695
|
/* global d3 options WebsyUtils */
|
|
5673
5696
|
if (typeof options !== 'undefined') {
|
|
@@ -5736,7 +5759,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5736
5759
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
5737
5760
|
return {
|
|
5738
5761
|
value: s.label || s.key,
|
|
5739
|
-
color: s.color ||
|
|
5762
|
+
color: s.color || _this37.options.colors[i % _this37.options.colors.length]
|
|
5740
5763
|
};
|
|
5741
5764
|
});
|
|
5742
5765
|
|
|
@@ -5988,7 +6011,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5988
6011
|
|
|
5989
6012
|
if (this.options.data.bottom.formatter) {
|
|
5990
6013
|
bAxisFunc.tickFormat(function (d) {
|
|
5991
|
-
return
|
|
6014
|
+
return _this37.options.data.bottom.formatter(d);
|
|
5992
6015
|
});
|
|
5993
6016
|
}
|
|
5994
6017
|
|
|
@@ -6014,8 +6037,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6014
6037
|
|
|
6015
6038
|
if (this.options.margin.axisLeft > 0) {
|
|
6016
6039
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
6017
|
-
if (
|
|
6018
|
-
d =
|
|
6040
|
+
if (_this37.options.data.left.formatter) {
|
|
6041
|
+
d = _this37.options.data.left.formatter(d);
|
|
6019
6042
|
}
|
|
6020
6043
|
|
|
6021
6044
|
return d;
|
|
@@ -6052,8 +6075,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6052
6075
|
|
|
6053
6076
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
6054
6077
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
6055
|
-
if (
|
|
6056
|
-
d =
|
|
6078
|
+
if (_this37.options.data.right.formatter) {
|
|
6079
|
+
d = _this37.options.data.right.formatter(d);
|
|
6057
6080
|
}
|
|
6058
6081
|
|
|
6059
6082
|
return d;
|
|
@@ -6079,16 +6102,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6079
6102
|
|
|
6080
6103
|
this.options.data.series.forEach(function (series, index) {
|
|
6081
6104
|
if (!series.key) {
|
|
6082
|
-
series.key =
|
|
6105
|
+
series.key = _this37.createIdentity();
|
|
6083
6106
|
}
|
|
6084
6107
|
|
|
6085
6108
|
if (!series.color) {
|
|
6086
|
-
series.color =
|
|
6109
|
+
series.color = _this37.options.colors[index % _this37.options.colors.length];
|
|
6087
6110
|
}
|
|
6088
6111
|
|
|
6089
|
-
|
|
6112
|
+
_this37["render".concat(series.type || 'bar')](series, index);
|
|
6090
6113
|
|
|
6091
|
-
|
|
6114
|
+
_this37.renderLabels(series, index);
|
|
6092
6115
|
});
|
|
6093
6116
|
}
|
|
6094
6117
|
}
|
|
@@ -6096,17 +6119,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6096
6119
|
}, {
|
|
6097
6120
|
key: "renderarea",
|
|
6098
6121
|
value: function renderarea(series, index) {
|
|
6099
|
-
var
|
|
6122
|
+
var _this38 = this;
|
|
6100
6123
|
|
|
6101
6124
|
/* global d3 series index */
|
|
6102
6125
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
6103
6126
|
return d3.area().x(function (d) {
|
|
6104
|
-
return
|
|
6127
|
+
return _this38[xAxis](_this38.parseX(d.x.value));
|
|
6105
6128
|
}).y0(function (d) {
|
|
6106
|
-
return
|
|
6129
|
+
return _this38[yAxis](0);
|
|
6107
6130
|
}).y1(function (d) {
|
|
6108
|
-
return
|
|
6109
|
-
}).curve(d3[curveStyle ||
|
|
6131
|
+
return _this38[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6132
|
+
}).curve(d3[curveStyle || _this38.options.curveStyle]);
|
|
6110
6133
|
};
|
|
6111
6134
|
|
|
6112
6135
|
var xAxis = 'bottomAxis';
|
|
@@ -6281,15 +6304,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6281
6304
|
}, {
|
|
6282
6305
|
key: "renderline",
|
|
6283
6306
|
value: function renderline(series, index) {
|
|
6284
|
-
var
|
|
6307
|
+
var _this39 = this;
|
|
6285
6308
|
|
|
6286
6309
|
/* global series index d3 */
|
|
6287
6310
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
6288
6311
|
return d3.line().x(function (d) {
|
|
6289
|
-
return
|
|
6312
|
+
return _this39[xAxis](_this39.parseX(d.x.value));
|
|
6290
6313
|
}).y(function (d) {
|
|
6291
|
-
return
|
|
6292
|
-
}).curve(d3[curveStyle ||
|
|
6314
|
+
return _this39[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6315
|
+
}).curve(d3[curveStyle || _this39.options.curveStyle]);
|
|
6293
6316
|
};
|
|
6294
6317
|
|
|
6295
6318
|
var xAxis = 'bottomAxis';
|
|
@@ -6327,14 +6350,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6327
6350
|
}, {
|
|
6328
6351
|
key: "rendersymbol",
|
|
6329
6352
|
value: function rendersymbol(series, index) {
|
|
6330
|
-
var
|
|
6353
|
+
var _this40 = this;
|
|
6331
6354
|
|
|
6332
6355
|
/* global d3 series index series.key */
|
|
6333
6356
|
var drawSymbol = function drawSymbol(size) {
|
|
6334
6357
|
return d3.symbol() // .type(d => {
|
|
6335
6358
|
// return d3.symbols[0]
|
|
6336
6359
|
// })
|
|
6337
|
-
.size(size ||
|
|
6360
|
+
.size(size || _this40.options.symbolSize);
|
|
6338
6361
|
};
|
|
6339
6362
|
|
|
6340
6363
|
var xAxis = 'bottomAxis';
|
|
@@ -6352,7 +6375,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6352
6375
|
symbols.attr('d', function (d) {
|
|
6353
6376
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
6354
6377
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
6355
|
-
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), ")");
|
|
6356
6379
|
}); // Enter
|
|
6357
6380
|
|
|
6358
6381
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -6361,7 +6384,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6361
6384
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
6362
6385
|
return "symbol symbol_".concat(series.key);
|
|
6363
6386
|
}).attr('transform', function (d) {
|
|
6364
|
-
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), ")");
|
|
6365
6388
|
});
|
|
6366
6389
|
}
|
|
6367
6390
|
}, {
|
|
@@ -6516,7 +6539,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6516
6539
|
}, {
|
|
6517
6540
|
key: "resize",
|
|
6518
6541
|
value: function resize() {
|
|
6519
|
-
var
|
|
6542
|
+
var _this41 = this;
|
|
6520
6543
|
|
|
6521
6544
|
var el = document.getElementById(this.elementId);
|
|
6522
6545
|
|
|
@@ -6529,7 +6552,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6529
6552
|
// }
|
|
6530
6553
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
6531
6554
|
html += this._data.map(function (d, i) {
|
|
6532
|
-
return
|
|
6555
|
+
return _this41.getLegendItemHTML(d);
|
|
6533
6556
|
}).join('');
|
|
6534
6557
|
html += "\n <div>\n ";
|
|
6535
6558
|
el.innerHTML = html;
|
|
@@ -6701,7 +6724,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6701
6724
|
}, {
|
|
6702
6725
|
key: "render",
|
|
6703
6726
|
value: function render() {
|
|
6704
|
-
var
|
|
6727
|
+
var _this42 = this;
|
|
6705
6728
|
|
|
6706
6729
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
6707
6730
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -6710,7 +6733,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6710
6733
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
6711
6734
|
return {
|
|
6712
6735
|
value: s.label || s.key,
|
|
6713
|
-
color: s.color ||
|
|
6736
|
+
color: s.color || _this42.options.colors[i % _this42.options.colors.length]
|
|
6714
6737
|
};
|
|
6715
6738
|
});
|
|
6716
6739
|
var longestValue = legendData.map(function (s) {
|
|
@@ -6774,7 +6797,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6774
6797
|
|
|
6775
6798
|
if (this.polygons) {
|
|
6776
6799
|
this.polygons.forEach(function (p) {
|
|
6777
|
-
return
|
|
6800
|
+
return _this42.map.removeLayer(p);
|
|
6778
6801
|
});
|
|
6779
6802
|
}
|
|
6780
6803
|
|
|
@@ -6832,18 +6855,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6832
6855
|
}
|
|
6833
6856
|
|
|
6834
6857
|
if (!p.options.color) {
|
|
6835
|
-
p.options.color =
|
|
6858
|
+
p.options.color = _this42.options.colors[i % _this42.options.colors.length];
|
|
6836
6859
|
}
|
|
6837
6860
|
|
|
6838
6861
|
var pol = L.polygon(p.data.map(function (c) {
|
|
6839
6862
|
return c.map(function (d) {
|
|
6840
6863
|
return [d.Latitude, d.Longitude];
|
|
6841
6864
|
});
|
|
6842
|
-
}), p.options).addTo(
|
|
6865
|
+
}), p.options).addTo(_this42.map);
|
|
6843
6866
|
|
|
6844
|
-
|
|
6867
|
+
_this42.polygons.push(pol);
|
|
6845
6868
|
|
|
6846
|
-
|
|
6869
|
+
_this42.map.fitBounds(pol.getBounds());
|
|
6847
6870
|
});
|
|
6848
6871
|
} // if (this.data.markers.length > 0) {
|
|
6849
6872
|
// el.classList.remove('hidden')
|