@websy/websy-designs 1.2.18 → 1.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/routes/v1/pdf.js +1 -1
- package/dist/websy-designs-es6.debug.js +32 -7
- package/dist/websy-designs-es6.js +220 -193
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +32 -7
- package/dist/websy-designs.js +220 -193
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
package/dist/websy-designs.js
CHANGED
|
@@ -1265,24 +1265,51 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1265
1265
|
}
|
|
1266
1266
|
}, {
|
|
1267
1267
|
key: "selectCustomRange",
|
|
1268
|
-
value: function selectCustomRange(
|
|
1269
|
-
var
|
|
1268
|
+
value: function selectCustomRange(rangeInput) {
|
|
1269
|
+
var _this8 = this;
|
|
1270
|
+
|
|
1270
1271
|
this.selectedRange = -1;
|
|
1271
|
-
|
|
1272
|
+
var isContinuousRange = true;
|
|
1273
|
+
|
|
1274
|
+
if (rangeInput.length === 1) {
|
|
1275
|
+
this.selectedRangeDates = _toConsumableArray(rangeInput);
|
|
1276
|
+
this.customRangeSelected = _toConsumableArray(rangeInput);
|
|
1277
|
+
} else if (rangeInput.length === 2) {
|
|
1278
|
+
this.selectedRangeDates = _toConsumableArray(rangeInput);
|
|
1279
|
+
this.customRangeSelected = _toConsumableArray(rangeInput);
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
rangeInput.forEach(function (r, i) {
|
|
1283
|
+
if (i > 0) {
|
|
1284
|
+
if (_this8.options.mode === 'date' || _this8.options.mode === 'monthyear') {
|
|
1285
|
+
if (r.getTime() / _this8.oneDay - rangeInput[i - 1] / _this8.oneDay > 1) {
|
|
1286
|
+
isContinuousRange = false;
|
|
1287
|
+
}
|
|
1288
|
+
} else if (_this8.options.mode === 'hour' || _this8.options.mode === 'year') {
|
|
1289
|
+
if (r - rangeInput[i - 1] > 1) {
|
|
1290
|
+
isContinuousRange = false;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
});
|
|
1295
|
+
|
|
1296
|
+
if (rangeInput.length > 2 && isContinuousRange === true) {
|
|
1297
|
+
this.selectedRangeDates = [rangeInput[0], rangeInput[rangeInput.length - 1]];
|
|
1298
|
+
}
|
|
1272
1299
|
|
|
1273
|
-
if (
|
|
1300
|
+
if (isContinuousRange === false) {
|
|
1274
1301
|
this.currentselection = [];
|
|
1275
1302
|
} // check if the custom range matches a configured range
|
|
1276
1303
|
|
|
1277
1304
|
|
|
1278
1305
|
for (var i = 0; i < this.options.ranges[this.options.mode].length; i++) {
|
|
1279
1306
|
if (this.options.ranges[this.options.mode][i].range.length === 1) {
|
|
1280
|
-
if (this.options.ranges[this.options.mode][i].range[0] ===
|
|
1307
|
+
if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0]) {
|
|
1281
1308
|
this.selectedRange = i;
|
|
1282
1309
|
break;
|
|
1283
1310
|
}
|
|
1284
1311
|
} else if (this.options.ranges[this.options.mode][i].range.length === 2) {
|
|
1285
|
-
if (this.options.ranges[this.options.mode][i].range[0] ===
|
|
1312
|
+
if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0] && this.options.ranges[this.options.mode][i].range[1] === rangeInput[1]) {
|
|
1286
1313
|
this.selectedRange = i;
|
|
1287
1314
|
break;
|
|
1288
1315
|
}
|
|
@@ -1316,27 +1343,27 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1316
1343
|
}, {
|
|
1317
1344
|
key: "updateRange",
|
|
1318
1345
|
value: function updateRange() {
|
|
1319
|
-
var
|
|
1346
|
+
var _this9 = this;
|
|
1320
1347
|
|
|
1321
1348
|
var range;
|
|
1322
1349
|
|
|
1323
1350
|
if (this.selectedRange === -1) {
|
|
1324
1351
|
var list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(function (d) {
|
|
1325
|
-
if (
|
|
1352
|
+
if (_this9.options.mode === 'date') {
|
|
1326
1353
|
if (!d.toLocaleDateString) {
|
|
1327
1354
|
d = new Date(d);
|
|
1328
1355
|
}
|
|
1329
1356
|
|
|
1330
1357
|
return d.toLocaleDateString();
|
|
1331
|
-
} else if (
|
|
1358
|
+
} else if (_this9.options.mode === 'year') {
|
|
1332
1359
|
return d;
|
|
1333
|
-
} else if (
|
|
1360
|
+
} else if (_this9.options.mode === 'monthyear') {
|
|
1334
1361
|
if (!d.getMonth) {
|
|
1335
1362
|
d = new Date(d);
|
|
1336
1363
|
}
|
|
1337
1364
|
|
|
1338
|
-
return "".concat(
|
|
1339
|
-
} else if (
|
|
1365
|
+
return "".concat(_this9.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
1366
|
+
} else if (_this9.options.mode === 'hour') {
|
|
1340
1367
|
return d;
|
|
1341
1368
|
}
|
|
1342
1369
|
});
|
|
@@ -1396,7 +1423,7 @@ Date.prototype.floor = function () {
|
|
|
1396
1423
|
|
|
1397
1424
|
var WebsyDropdown = /*#__PURE__*/function () {
|
|
1398
1425
|
function WebsyDropdown(elementId, options) {
|
|
1399
|
-
var
|
|
1426
|
+
var _this10 = this;
|
|
1400
1427
|
|
|
1401
1428
|
_classCallCheck(this, WebsyDropdown);
|
|
1402
1429
|
|
|
@@ -1440,10 +1467,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1440
1467
|
el.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
1441
1468
|
el.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
1442
1469
|
var headerLabel = this.selectedItems.map(function (s) {
|
|
1443
|
-
return
|
|
1470
|
+
return _this10.options.items[s].label || _this10.options.items[s].value;
|
|
1444
1471
|
}).join(this.options.multiValueDelimiter);
|
|
1445
1472
|
var headerValue = this.selectedItems.map(function (s) {
|
|
1446
|
-
return
|
|
1473
|
+
return _this10.options.items[s].value || _this10.options.items[s].label;
|
|
1447
1474
|
}).join(this.options.multiValueDelimiter);
|
|
1448
1475
|
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 ");
|
|
1449
1476
|
|
|
@@ -1726,10 +1753,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1726
1753
|
}, {
|
|
1727
1754
|
key: "renderItems",
|
|
1728
1755
|
value: function renderItems() {
|
|
1729
|
-
var
|
|
1756
|
+
var _this11 = this;
|
|
1730
1757
|
|
|
1731
1758
|
var html = this.options.items.map(function (r, i) {
|
|
1732
|
-
return "\n <li data-index='".concat(r.index, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(
|
|
1759
|
+
return "\n <li data-index='".concat(r.index, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(_this11.selectedItems.indexOf(r.index) !== -1 ? 'active' : '', "'>").concat(r.label, "</li>\n ");
|
|
1733
1760
|
}).join('');
|
|
1734
1761
|
var el = document.getElementById("".concat(this.elementId, "_items"));
|
|
1735
1762
|
|
|
@@ -1748,7 +1775,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1748
1775
|
}, {
|
|
1749
1776
|
key: "updateHeader",
|
|
1750
1777
|
value: function updateHeader(item) {
|
|
1751
|
-
var
|
|
1778
|
+
var _this12 = this;
|
|
1752
1779
|
|
|
1753
1780
|
var el = document.getElementById(this.elementId);
|
|
1754
1781
|
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
@@ -1795,17 +1822,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1795
1822
|
} else if (this.selectedItems.length > 1) {
|
|
1796
1823
|
if (this.options.showCompleteSelectedList === true) {
|
|
1797
1824
|
var selectedLabels = this.selectedItems.map(function (s) {
|
|
1798
|
-
return
|
|
1825
|
+
return _this12.options.items[s].label || _this12.options.items[s].value;
|
|
1799
1826
|
}).join(this.options.multiValueDelimiter);
|
|
1800
1827
|
var selectedValues = this.selectedItems.map(function (s) {
|
|
1801
|
-
return
|
|
1828
|
+
return _this12.options.items[s].value || _this12.options.items[s].label;
|
|
1802
1829
|
}).join(this.options.multiValueDelimiter);
|
|
1803
1830
|
labelEl.innerHTML = selectedLabels;
|
|
1804
1831
|
labelEl.setAttribute('data-info', selectedLabels);
|
|
1805
1832
|
inputEl.value = selectedValues;
|
|
1806
1833
|
} else {
|
|
1807
1834
|
var _selectedValues = this.selectedItems.map(function (s) {
|
|
1808
|
-
return
|
|
1835
|
+
return _this12.options.items[s].value || _this12.options.items[s].label;
|
|
1809
1836
|
}).join(this.options.multiValueDelimiter);
|
|
1810
1837
|
|
|
1811
1838
|
labelEl.innerHTML = "".concat(this.selectedItems.length, " selected");
|
|
@@ -1942,16 +1969,16 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1942
1969
|
}, {
|
|
1943
1970
|
key: "checkRecaptcha",
|
|
1944
1971
|
value: function checkRecaptcha() {
|
|
1945
|
-
var
|
|
1972
|
+
var _this13 = this;
|
|
1946
1973
|
|
|
1947
1974
|
return new Promise(function (resolve, reject) {
|
|
1948
|
-
if (
|
|
1975
|
+
if (_this13.options.useRecaptcha === true) {
|
|
1949
1976
|
// if (this.recaptchaValue) {
|
|
1950
1977
|
grecaptcha.ready(function () {
|
|
1951
1978
|
grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
|
|
1952
1979
|
action: 'submit'
|
|
1953
1980
|
}).then(function (token) {
|
|
1954
|
-
|
|
1981
|
+
_this13.apiService.add('google/checkrecaptcha', {
|
|
1955
1982
|
grecaptcharesponse: token
|
|
1956
1983
|
}).then(function (response) {
|
|
1957
1984
|
if (response.success && response.success === true) {
|
|
@@ -2014,14 +2041,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2014
2041
|
}, {
|
|
2015
2042
|
key: "processComponents",
|
|
2016
2043
|
value: function processComponents(components, callbackFn) {
|
|
2017
|
-
var
|
|
2044
|
+
var _this14 = this;
|
|
2018
2045
|
|
|
2019
2046
|
if (components.length === 0) {
|
|
2020
2047
|
callbackFn();
|
|
2021
2048
|
} else {
|
|
2022
2049
|
components.forEach(function (c) {
|
|
2023
2050
|
if (typeof WebsyDesigns[c.component] !== 'undefined') {
|
|
2024
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
2051
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this14.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
2025
2052
|
} else {// some user feedback here
|
|
2026
2053
|
}
|
|
2027
2054
|
});
|
|
@@ -2042,7 +2069,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2042
2069
|
}, {
|
|
2043
2070
|
key: "render",
|
|
2044
2071
|
value: function render(update, data) {
|
|
2045
|
-
var
|
|
2072
|
+
var _this15 = this;
|
|
2046
2073
|
|
|
2047
2074
|
var el = document.getElementById(this.elementId);
|
|
2048
2075
|
var componentsToProcess = [];
|
|
@@ -2052,11 +2079,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2052
2079
|
this.options.fields.forEach(function (f, i) {
|
|
2053
2080
|
if (f.component) {
|
|
2054
2081
|
componentsToProcess.push(f);
|
|
2055
|
-
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(
|
|
2082
|
+
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(_this15.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
|
|
2056
2083
|
} else if (f.type === 'longtext') {
|
|
2057
|
-
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(
|
|
2084
|
+
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(_this15.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 ");
|
|
2058
2085
|
} else {
|
|
2059
|
-
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(
|
|
2086
|
+
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(_this15.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 ");
|
|
2060
2087
|
}
|
|
2061
2088
|
});
|
|
2062
2089
|
html += "\n --><button class=\"websy-btn submit ".concat(this.options.submit.classes || '', "\">").concat(this.options.submit.text || 'Save', "</button>").concat(this.options.cancel ? '<!--' : '', "\n ");
|
|
@@ -2073,7 +2100,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2073
2100
|
|
|
2074
2101
|
el.innerHTML = html;
|
|
2075
2102
|
this.processComponents(componentsToProcess, function () {
|
|
2076
|
-
if (
|
|
2103
|
+
if (_this15.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
|
|
2077
2104
|
}
|
|
2078
2105
|
});
|
|
2079
2106
|
}
|
|
@@ -2081,7 +2108,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2081
2108
|
}, {
|
|
2082
2109
|
key: "submitForm",
|
|
2083
2110
|
value: function submitForm() {
|
|
2084
|
-
var
|
|
2111
|
+
var _this16 = this;
|
|
2085
2112
|
|
|
2086
2113
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2087
2114
|
|
|
@@ -2095,32 +2122,32 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2095
2122
|
data[key] = value;
|
|
2096
2123
|
});
|
|
2097
2124
|
|
|
2098
|
-
if (
|
|
2099
|
-
var
|
|
2125
|
+
if (_this16.options.url) {
|
|
2126
|
+
var _this16$apiService;
|
|
2100
2127
|
|
|
2101
|
-
var params = [
|
|
2128
|
+
var params = [_this16.options.url];
|
|
2102
2129
|
|
|
2103
|
-
if (
|
|
2104
|
-
params.push(
|
|
2130
|
+
if (_this16.options.mode === 'update') {
|
|
2131
|
+
params.push(_this16.options.id);
|
|
2105
2132
|
}
|
|
2106
2133
|
|
|
2107
2134
|
params.push(data);
|
|
2108
2135
|
|
|
2109
|
-
(
|
|
2110
|
-
if (
|
|
2136
|
+
(_this16$apiService = _this16.apiService)[_this16.options.mode].apply(_this16$apiService, params).then(function (result) {
|
|
2137
|
+
if (_this16.options.clearAfterSave === true) {
|
|
2111
2138
|
// this.render()
|
|
2112
2139
|
formEl.reset();
|
|
2113
2140
|
}
|
|
2114
2141
|
|
|
2115
|
-
|
|
2142
|
+
_this16.options.onSuccess.call(_this16, result);
|
|
2116
2143
|
}, function (err) {
|
|
2117
2144
|
console.log('Error submitting form data:', err);
|
|
2118
2145
|
|
|
2119
|
-
|
|
2146
|
+
_this16.options.onError.call(_this16, err);
|
|
2120
2147
|
});
|
|
2121
|
-
} else if (
|
|
2122
|
-
|
|
2123
|
-
if (
|
|
2148
|
+
} else if (_this16.options.submitFn) {
|
|
2149
|
+
_this16.options.submitFn(data, function () {
|
|
2150
|
+
if (_this16.options.clearAfterSave === true) {
|
|
2124
2151
|
// this.render()
|
|
2125
2152
|
formEl.reset();
|
|
2126
2153
|
}
|
|
@@ -2140,17 +2167,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2140
2167
|
}, {
|
|
2141
2168
|
key: "data",
|
|
2142
2169
|
set: function set(d) {
|
|
2143
|
-
var
|
|
2170
|
+
var _this17 = this;
|
|
2144
2171
|
|
|
2145
2172
|
if (!this.options.fields) {
|
|
2146
2173
|
this.options.fields = [];
|
|
2147
2174
|
}
|
|
2148
2175
|
|
|
2149
2176
|
var _loop = function _loop(key) {
|
|
2150
|
-
|
|
2177
|
+
_this17.options.fields.forEach(function (f) {
|
|
2151
2178
|
if (f.field === key) {
|
|
2152
2179
|
f.value = d[key];
|
|
2153
|
-
var el = document.getElementById("".concat(
|
|
2180
|
+
var el = document.getElementById("".concat(_this17.elementId, "_input_").concat(f.field));
|
|
2154
2181
|
el.value = f.value;
|
|
2155
2182
|
}
|
|
2156
2183
|
});
|
|
@@ -2529,7 +2556,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2529
2556
|
|
|
2530
2557
|
var Pager = /*#__PURE__*/function () {
|
|
2531
2558
|
function Pager(elementId, options) {
|
|
2532
|
-
var
|
|
2559
|
+
var _this18 = this;
|
|
2533
2560
|
|
|
2534
2561
|
_classCallCheck(this, Pager);
|
|
2535
2562
|
|
|
@@ -2582,8 +2609,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2582
2609
|
allowClear: false,
|
|
2583
2610
|
disableSearch: true,
|
|
2584
2611
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
2585
|
-
if (
|
|
2586
|
-
|
|
2612
|
+
if (_this18.options.onChangePageSize) {
|
|
2613
|
+
_this18.options.onChangePageSize(selectedItem.value);
|
|
2587
2614
|
}
|
|
2588
2615
|
}
|
|
2589
2616
|
});
|
|
@@ -2607,13 +2634,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2607
2634
|
}, {
|
|
2608
2635
|
key: "render",
|
|
2609
2636
|
value: function render() {
|
|
2610
|
-
var
|
|
2637
|
+
var _this19 = this;
|
|
2611
2638
|
|
|
2612
2639
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
2613
2640
|
|
|
2614
2641
|
if (el) {
|
|
2615
2642
|
var pages = this.options.pages.map(function (item, index) {
|
|
2616
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
2643
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this19.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
2617
2644
|
});
|
|
2618
2645
|
var startIndex = 0;
|
|
2619
2646
|
|
|
@@ -2681,58 +2708,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2681
2708
|
_createClass(WebsyPDFButton, [{
|
|
2682
2709
|
key: "handleClick",
|
|
2683
2710
|
value: function handleClick(event) {
|
|
2684
|
-
var
|
|
2711
|
+
var _this20 = this;
|
|
2685
2712
|
|
|
2686
2713
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
2687
2714
|
this.loader.show();
|
|
2688
2715
|
setTimeout(function () {
|
|
2689
|
-
if (
|
|
2690
|
-
var el = document.getElementById(
|
|
2716
|
+
if (_this20.options.targetId) {
|
|
2717
|
+
var el = document.getElementById(_this20.options.targetId);
|
|
2691
2718
|
|
|
2692
2719
|
if (el) {
|
|
2693
2720
|
var pdfData = {
|
|
2694
2721
|
options: {}
|
|
2695
2722
|
};
|
|
2696
2723
|
|
|
2697
|
-
if (
|
|
2698
|
-
pdfData.options = _extends({},
|
|
2724
|
+
if (_this20.options.pdfOptions) {
|
|
2725
|
+
pdfData.options = _extends({}, _this20.options.pdfOptions);
|
|
2699
2726
|
}
|
|
2700
2727
|
|
|
2701
|
-
if (
|
|
2702
|
-
if (
|
|
2703
|
-
var headerEl = document.getElementById(
|
|
2728
|
+
if (_this20.options.header) {
|
|
2729
|
+
if (_this20.options.header.elementId) {
|
|
2730
|
+
var headerEl = document.getElementById(_this20.options.header.elementId);
|
|
2704
2731
|
|
|
2705
2732
|
if (headerEl) {
|
|
2706
2733
|
pdfData.header = headerEl.outerHTML;
|
|
2707
2734
|
|
|
2708
|
-
if (
|
|
2709
|
-
pdfData.options.headerCSS =
|
|
2735
|
+
if (_this20.options.header.css) {
|
|
2736
|
+
pdfData.options.headerCSS = _this20.options.header.css;
|
|
2710
2737
|
}
|
|
2711
2738
|
}
|
|
2712
|
-
} else if (
|
|
2713
|
-
pdfData.header =
|
|
2739
|
+
} else if (_this20.options.header.html) {
|
|
2740
|
+
pdfData.header = _this20.options.header.html;
|
|
2714
2741
|
|
|
2715
|
-
if (
|
|
2716
|
-
pdfData.options.headerCSS =
|
|
2742
|
+
if (_this20.options.header.css) {
|
|
2743
|
+
pdfData.options.headerCSS = _this20.options.header.css;
|
|
2717
2744
|
}
|
|
2718
2745
|
} else {
|
|
2719
|
-
pdfData.header =
|
|
2746
|
+
pdfData.header = _this20.options.header;
|
|
2720
2747
|
}
|
|
2721
2748
|
}
|
|
2722
2749
|
|
|
2723
|
-
if (
|
|
2724
|
-
if (
|
|
2725
|
-
var footerEl = document.getElementById(
|
|
2750
|
+
if (_this20.options.footer) {
|
|
2751
|
+
if (_this20.options.footer.elementId) {
|
|
2752
|
+
var footerEl = document.getElementById(_this20.options.footer.elementId);
|
|
2726
2753
|
|
|
2727
2754
|
if (footerEl) {
|
|
2728
2755
|
pdfData.footer = footerEl.outerHTML;
|
|
2729
2756
|
|
|
2730
|
-
if (
|
|
2731
|
-
pdfData.options.footerCSS =
|
|
2757
|
+
if (_this20.options.footer.css) {
|
|
2758
|
+
pdfData.options.footerCSS = _this20.options.footer.css;
|
|
2732
2759
|
}
|
|
2733
2760
|
}
|
|
2734
2761
|
} else {
|
|
2735
|
-
pdfData.footer =
|
|
2762
|
+
pdfData.footer = _this20.options.footer;
|
|
2736
2763
|
}
|
|
2737
2764
|
}
|
|
2738
2765
|
|
|
@@ -2741,31 +2768,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2741
2768
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
2742
2769
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
2743
2770
|
|
|
2744
|
-
|
|
2771
|
+
_this20.service.add('', pdfData, {
|
|
2745
2772
|
responseType: 'blob'
|
|
2746
2773
|
}).then(function (response) {
|
|
2747
|
-
|
|
2774
|
+
_this20.loader.hide();
|
|
2748
2775
|
|
|
2749
2776
|
var blob = new Blob([response], {
|
|
2750
2777
|
type: 'application/pdf'
|
|
2751
2778
|
});
|
|
2752
2779
|
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 ");
|
|
2753
2780
|
|
|
2754
|
-
if (
|
|
2781
|
+
if (_this20.options.directDownload === true) {
|
|
2755
2782
|
var fileName;
|
|
2756
2783
|
|
|
2757
|
-
if (typeof
|
|
2758
|
-
fileName =
|
|
2784
|
+
if (typeof _this20.options.fileName === 'function') {
|
|
2785
|
+
fileName = _this20.options.fileName() || 'Export';
|
|
2759
2786
|
} else {
|
|
2760
|
-
fileName =
|
|
2787
|
+
fileName = _this20.options.fileName || 'Export';
|
|
2761
2788
|
}
|
|
2762
2789
|
|
|
2763
2790
|
msg += "download='".concat(fileName, ".pdf'");
|
|
2764
2791
|
}
|
|
2765
2792
|
|
|
2766
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
2793
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this20.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
2767
2794
|
|
|
2768
|
-
|
|
2795
|
+
_this20.popup.show({
|
|
2769
2796
|
message: msg,
|
|
2770
2797
|
mask: true
|
|
2771
2798
|
});
|
|
@@ -2950,7 +2977,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
2950
2977
|
|
|
2951
2978
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
2952
2979
|
function ResponsiveText(elementId, options) {
|
|
2953
|
-
var
|
|
2980
|
+
var _this21 = this;
|
|
2954
2981
|
|
|
2955
2982
|
_classCallCheck(this, ResponsiveText);
|
|
2956
2983
|
|
|
@@ -2963,7 +2990,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
2963
2990
|
this.elementId = elementId;
|
|
2964
2991
|
this.canvas = document.createElement('canvas');
|
|
2965
2992
|
window.addEventListener('resize', function () {
|
|
2966
|
-
return
|
|
2993
|
+
return _this21.render();
|
|
2967
2994
|
});
|
|
2968
2995
|
var el = document.getElementById(this.elementId);
|
|
2969
2996
|
|
|
@@ -3182,7 +3209,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3182
3209
|
|
|
3183
3210
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3184
3211
|
function WebsyResultList(elementId, options) {
|
|
3185
|
-
var
|
|
3212
|
+
var _this22 = this;
|
|
3186
3213
|
|
|
3187
3214
|
_classCallCheck(this, WebsyResultList);
|
|
3188
3215
|
|
|
@@ -3210,9 +3237,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3210
3237
|
|
|
3211
3238
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3212
3239
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3213
|
-
|
|
3240
|
+
_this22.options.template = templateString;
|
|
3214
3241
|
|
|
3215
|
-
|
|
3242
|
+
_this22.render();
|
|
3216
3243
|
});
|
|
3217
3244
|
} else {
|
|
3218
3245
|
this.render();
|
|
@@ -3231,7 +3258,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3231
3258
|
}, {
|
|
3232
3259
|
key: "buildHTML",
|
|
3233
3260
|
value: function buildHTML(d) {
|
|
3234
|
-
var
|
|
3261
|
+
var _this23 = this;
|
|
3235
3262
|
|
|
3236
3263
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3237
3264
|
var html = "";
|
|
@@ -3239,7 +3266,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3239
3266
|
if (this.options.template) {
|
|
3240
3267
|
if (d.length > 0) {
|
|
3241
3268
|
d.forEach(function (row, ix) {
|
|
3242
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(
|
|
3269
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(_this23.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3243
3270
|
|
|
3244
3271
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3245
3272
|
|
|
@@ -3359,7 +3386,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3359
3386
|
}, {
|
|
3360
3387
|
key: "handleClick",
|
|
3361
3388
|
value: function handleClick(event) {
|
|
3362
|
-
var
|
|
3389
|
+
var _this24 = this;
|
|
3363
3390
|
|
|
3364
3391
|
if (event.target.classList.contains('clickable')) {
|
|
3365
3392
|
var l = event.target.getAttribute('data-event');
|
|
@@ -3377,8 +3404,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3377
3404
|
l = l[0];
|
|
3378
3405
|
params = params.map(function (p) {
|
|
3379
3406
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
3380
|
-
if (
|
|
3381
|
-
p =
|
|
3407
|
+
if (_this24.rows[+id]) {
|
|
3408
|
+
p = _this24.rows[+id][p];
|
|
3382
3409
|
}
|
|
3383
3410
|
} else if (typeof p === 'string') {
|
|
3384
3411
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -3400,13 +3427,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3400
3427
|
}, {
|
|
3401
3428
|
key: "render",
|
|
3402
3429
|
value: function render() {
|
|
3403
|
-
var
|
|
3430
|
+
var _this25 = this;
|
|
3404
3431
|
|
|
3405
3432
|
if (this.options.entity) {
|
|
3406
3433
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3407
|
-
|
|
3434
|
+
_this25.rows = results.rows;
|
|
3408
3435
|
|
|
3409
|
-
|
|
3436
|
+
_this25.resize();
|
|
3410
3437
|
});
|
|
3411
3438
|
} else {
|
|
3412
3439
|
this.resize();
|
|
@@ -3485,14 +3512,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3485
3512
|
_createClass(WebsyRouter, [{
|
|
3486
3513
|
key: "addGroup",
|
|
3487
3514
|
value: function addGroup(group) {
|
|
3488
|
-
var
|
|
3515
|
+
var _this26 = this;
|
|
3489
3516
|
|
|
3490
3517
|
if (!this.groups[group]) {
|
|
3491
3518
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3492
3519
|
|
|
3493
3520
|
if (els) {
|
|
3494
3521
|
this.getClosestParent(els[0], function (parent) {
|
|
3495
|
-
|
|
3522
|
+
_this26.groups[group] = {
|
|
3496
3523
|
activeView: '',
|
|
3497
3524
|
views: [],
|
|
3498
3525
|
parent: parent.getAttribute('data-view')
|
|
@@ -3817,12 +3844,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3817
3844
|
}, {
|
|
3818
3845
|
key: "showComponents",
|
|
3819
3846
|
value: function showComponents(view) {
|
|
3820
|
-
var
|
|
3847
|
+
var _this27 = this;
|
|
3821
3848
|
|
|
3822
3849
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
3823
3850
|
this.options.views[view].components.forEach(function (c) {
|
|
3824
3851
|
if (typeof c.instance === 'undefined') {
|
|
3825
|
-
|
|
3852
|
+
_this27.prepComponent(c.elementId, c.options);
|
|
3826
3853
|
|
|
3827
3854
|
c.instance = new c.Component(c.elementId, c.options);
|
|
3828
3855
|
} else if (c.instance.render) {
|
|
@@ -4250,7 +4277,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4250
4277
|
|
|
4251
4278
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4252
4279
|
function WebsyTemplate(elementId, options) {
|
|
4253
|
-
var
|
|
4280
|
+
var _this28 = this;
|
|
4254
4281
|
|
|
4255
4282
|
_classCallCheck(this, WebsyTemplate);
|
|
4256
4283
|
|
|
@@ -4276,9 +4303,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4276
4303
|
|
|
4277
4304
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4278
4305
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4279
|
-
|
|
4306
|
+
_this28.options.template = templateString;
|
|
4280
4307
|
|
|
4281
|
-
|
|
4308
|
+
_this28.render();
|
|
4282
4309
|
});
|
|
4283
4310
|
} else {
|
|
4284
4311
|
this.render();
|
|
@@ -4288,7 +4315,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4288
4315
|
_createClass(WebsyTemplate, [{
|
|
4289
4316
|
key: "buildHTML",
|
|
4290
4317
|
value: function buildHTML() {
|
|
4291
|
-
var
|
|
4318
|
+
var _this29 = this;
|
|
4292
4319
|
|
|
4293
4320
|
var html = "";
|
|
4294
4321
|
|
|
@@ -4350,14 +4377,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4350
4377
|
}
|
|
4351
4378
|
|
|
4352
4379
|
if (polarity === true) {
|
|
4353
|
-
if (typeof
|
|
4380
|
+
if (typeof _this29.options.data[parts[0]] !== 'undefined' && _this29.options.data[parts[0]] === parts[1]) {
|
|
4354
4381
|
// remove the <if> tags
|
|
4355
4382
|
removeAll = false;
|
|
4356
4383
|
} else if (parts[0] === parts[1]) {
|
|
4357
4384
|
removeAll = false;
|
|
4358
4385
|
}
|
|
4359
4386
|
} else if (polarity === false) {
|
|
4360
|
-
if (typeof
|
|
4387
|
+
if (typeof _this29.options.data[parts[0]] !== 'undefined' && _this29.options.data[parts[0]] !== parts[1]) {
|
|
4361
4388
|
// remove the <if> tags
|
|
4362
4389
|
removeAll = false;
|
|
4363
4390
|
}
|
|
@@ -4644,7 +4671,7 @@ var WebsyUtils = {
|
|
|
4644
4671
|
|
|
4645
4672
|
var WebsyTable = /*#__PURE__*/function () {
|
|
4646
4673
|
function WebsyTable(elementId, options) {
|
|
4647
|
-
var
|
|
4674
|
+
var _this30 = this;
|
|
4648
4675
|
|
|
4649
4676
|
_classCallCheck(this, WebsyTable);
|
|
4650
4677
|
|
|
@@ -4682,8 +4709,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4682
4709
|
allowClear: false,
|
|
4683
4710
|
disableSearch: true,
|
|
4684
4711
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4685
|
-
if (
|
|
4686
|
-
|
|
4712
|
+
if (_this30.options.onChangePageSize) {
|
|
4713
|
+
_this30.options.onChangePageSize(selectedItem.value);
|
|
4687
4714
|
}
|
|
4688
4715
|
}
|
|
4689
4716
|
});
|
|
@@ -4704,7 +4731,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4704
4731
|
_createClass(WebsyTable, [{
|
|
4705
4732
|
key: "appendRows",
|
|
4706
4733
|
value: function appendRows(data) {
|
|
4707
|
-
var
|
|
4734
|
+
var _this31 = this;
|
|
4708
4735
|
|
|
4709
4736
|
this.hideError();
|
|
4710
4737
|
var bodyHTML = '';
|
|
@@ -4712,15 +4739,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4712
4739
|
if (data) {
|
|
4713
4740
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4714
4741
|
return '<tr>' + r.map(function (c, i) {
|
|
4715
|
-
if (
|
|
4742
|
+
if (_this31.options.columns[i].show !== false) {
|
|
4716
4743
|
var style = '';
|
|
4717
4744
|
|
|
4718
4745
|
if (c.style) {
|
|
4719
4746
|
style += c.style;
|
|
4720
4747
|
}
|
|
4721
4748
|
|
|
4722
|
-
if (
|
|
4723
|
-
style += "width: ".concat(
|
|
4749
|
+
if (_this31.options.columns[i].width) {
|
|
4750
|
+
style += "width: ".concat(_this31.options.columns[i].width, "; ");
|
|
4724
4751
|
}
|
|
4725
4752
|
|
|
4726
4753
|
if (c.backgroundColor) {
|
|
@@ -4735,18 +4762,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4735
4762
|
style += "color: ".concat(c.color, "; ");
|
|
4736
4763
|
}
|
|
4737
4764
|
|
|
4738
|
-
if (
|
|
4739
|
-
return "\n <td \n data-row-index='".concat(
|
|
4740
|
-
} else if ((
|
|
4741
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
4765
|
+
if (_this31.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
4766
|
+
return "\n <td \n data-row-index='".concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this31.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this31.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this31.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
4767
|
+
} else if ((_this31.options.columns[i].showAsNavigatorLink === true || _this31.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
4768
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this31.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this31.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this31.options.columns[i].linkText || c.value, "</td>\n ");
|
|
4742
4769
|
} else {
|
|
4743
4770
|
var info = c.value;
|
|
4744
4771
|
|
|
4745
|
-
if (
|
|
4772
|
+
if (_this31.options.columns[i].showAsImage === true) {
|
|
4746
4773
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4747
4774
|
}
|
|
4748
4775
|
|
|
4749
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
4776
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this31.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
|
|
4750
4777
|
}
|
|
4751
4778
|
}
|
|
4752
4779
|
}).join('') + '</tr>';
|
|
@@ -4918,7 +4945,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4918
4945
|
}, {
|
|
4919
4946
|
key: "render",
|
|
4920
4947
|
value: function render(data) {
|
|
4921
|
-
var
|
|
4948
|
+
var _this32 = this;
|
|
4922
4949
|
|
|
4923
4950
|
if (!this.options.columns) {
|
|
4924
4951
|
return;
|
|
@@ -4943,7 +4970,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4943
4970
|
|
|
4944
4971
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
4945
4972
|
if (c.show !== false) {
|
|
4946
|
-
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 ?
|
|
4973
|
+
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 ? _this32.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
4947
4974
|
}
|
|
4948
4975
|
}).join('') + '</tr>';
|
|
4949
4976
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -4962,7 +4989,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4962
4989
|
|
|
4963
4990
|
if (pagingEl) {
|
|
4964
4991
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
4965
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
4992
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this32.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
4966
4993
|
});
|
|
4967
4994
|
var startIndex = 0;
|
|
4968
4995
|
|
|
@@ -5030,7 +5057,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5030
5057
|
|
|
5031
5058
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5032
5059
|
function WebsyTable2(elementId, options) {
|
|
5033
|
-
var
|
|
5060
|
+
var _this33 = this;
|
|
5034
5061
|
|
|
5035
5062
|
_classCallCheck(this, WebsyTable2);
|
|
5036
5063
|
|
|
@@ -5071,8 +5098,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5071
5098
|
allowClear: false,
|
|
5072
5099
|
disableSearch: true,
|
|
5073
5100
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5074
|
-
if (
|
|
5075
|
-
|
|
5101
|
+
if (_this33.options.onChangePageSize) {
|
|
5102
|
+
_this33.options.onChangePageSize(selectedItem.value);
|
|
5076
5103
|
}
|
|
5077
5104
|
}
|
|
5078
5105
|
});
|
|
@@ -5096,7 +5123,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5096
5123
|
_createClass(WebsyTable2, [{
|
|
5097
5124
|
key: "appendRows",
|
|
5098
5125
|
value: function appendRows(data) {
|
|
5099
|
-
var
|
|
5126
|
+
var _this34 = this;
|
|
5100
5127
|
|
|
5101
5128
|
this.hideError();
|
|
5102
5129
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -5105,15 +5132,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5105
5132
|
if (data) {
|
|
5106
5133
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5107
5134
|
return '<tr>' + r.map(function (c, i) {
|
|
5108
|
-
if (
|
|
5109
|
-
var style = "height: ".concat(
|
|
5135
|
+
if (_this34.options.columns[i].show !== false) {
|
|
5136
|
+
var style = "height: ".concat(_this34.options.cellSize, "px; line-height: ").concat(_this34.options.cellSize, "px;");
|
|
5110
5137
|
|
|
5111
5138
|
if (c.style) {
|
|
5112
5139
|
style += c.style;
|
|
5113
5140
|
}
|
|
5114
5141
|
|
|
5115
|
-
if (
|
|
5116
|
-
style += "width: ".concat(
|
|
5142
|
+
if (_this34.options.columns[i].width) {
|
|
5143
|
+
style += "width: ".concat(_this34.options.columns[i].width, "; ");
|
|
5117
5144
|
}
|
|
5118
5145
|
|
|
5119
5146
|
if (c.backgroundColor) {
|
|
@@ -5128,18 +5155,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5128
5155
|
style += "color: ".concat(c.color, "; ");
|
|
5129
5156
|
}
|
|
5130
5157
|
|
|
5131
|
-
if (
|
|
5132
|
-
return "\n <td \n data-row-index='".concat(
|
|
5133
|
-
} else if ((
|
|
5134
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5158
|
+
if (_this34.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5159
|
+
return "\n <td \n data-row-index='".concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this34.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this34.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this34.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5160
|
+
} else if ((_this34.options.columns[i].showAsNavigatorLink === true || _this34.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5161
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this34.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this34.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this34.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5135
5162
|
} else {
|
|
5136
5163
|
var info = c.value;
|
|
5137
5164
|
|
|
5138
|
-
if (
|
|
5165
|
+
if (_this34.options.columns[i].showAsImage === true) {
|
|
5139
5166
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5140
5167
|
}
|
|
5141
5168
|
|
|
5142
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5169
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this34.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
|
|
5143
5170
|
}
|
|
5144
5171
|
}
|
|
5145
5172
|
}).join('') + '</tr>';
|
|
@@ -5397,7 +5424,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5397
5424
|
}, {
|
|
5398
5425
|
key: "render",
|
|
5399
5426
|
value: function render(data) {
|
|
5400
|
-
var
|
|
5427
|
+
var _this35 = this;
|
|
5401
5428
|
|
|
5402
5429
|
if (!this.options.columns) {
|
|
5403
5430
|
return;
|
|
@@ -5433,7 +5460,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5433
5460
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5434
5461
|
}
|
|
5435
5462
|
|
|
5436
|
-
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 ?
|
|
5463
|
+
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 ? _this35.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5437
5464
|
}
|
|
5438
5465
|
}).join('') + '</tr>';
|
|
5439
5466
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5444,7 +5471,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5444
5471
|
var dropdownHTML = "";
|
|
5445
5472
|
this.options.columns.forEach(function (c, i) {
|
|
5446
5473
|
if (c.searchable && c.searchField) {
|
|
5447
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5474
|
+
dropdownHTML += "\n <div id=\"".concat(_this35.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
5448
5475
|
}
|
|
5449
5476
|
});
|
|
5450
5477
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5466,7 +5493,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5466
5493
|
|
|
5467
5494
|
if (pagingEl) {
|
|
5468
5495
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5469
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5496
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this35.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5470
5497
|
});
|
|
5471
5498
|
var startIndex = 0;
|
|
5472
5499
|
|
|
@@ -5553,7 +5580,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5553
5580
|
}, {
|
|
5554
5581
|
key: "getColumnParameters",
|
|
5555
5582
|
value: function getColumnParameters(values) {
|
|
5556
|
-
var
|
|
5583
|
+
var _this36 = this;
|
|
5557
5584
|
|
|
5558
5585
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
5559
5586
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -5561,10 +5588,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5561
5588
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
5562
5589
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5563
5590
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
5564
|
-
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 ?
|
|
5591
|
+
return "\n <th>\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField\" \n >\n ".concat(c.value || 'nbsp;', "\n </div>\n </div> \n ").concat(c.searchable === true ? _this36.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5565
5592
|
}).join('') + '</tr>';
|
|
5566
5593
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
5567
|
-
return "\n <td \n style='height: ".concat(
|
|
5594
|
+
return "\n <td \n style='height: ".concat(_this36.options.cellSize, "px; line-height: ").concat(_this36.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
5568
5595
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
5569
5596
|
|
|
5570
5597
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -5614,7 +5641,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5614
5641
|
|
|
5615
5642
|
var WebsyChart = /*#__PURE__*/function () {
|
|
5616
5643
|
function WebsyChart(elementId, options) {
|
|
5617
|
-
var
|
|
5644
|
+
var _this37 = this;
|
|
5618
5645
|
|
|
5619
5646
|
_classCallCheck(this, WebsyChart);
|
|
5620
5647
|
|
|
@@ -5663,22 +5690,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5663
5690
|
this.invertOverride = function (input, input2) {
|
|
5664
5691
|
var xAxis = 'bottomAxis';
|
|
5665
5692
|
|
|
5666
|
-
if (
|
|
5693
|
+
if (_this37.options.orientation === 'horizontal') {
|
|
5667
5694
|
xAxis = 'leftAxis';
|
|
5668
5695
|
}
|
|
5669
5696
|
|
|
5670
|
-
var width =
|
|
5697
|
+
var width = _this37[xAxis].step();
|
|
5671
5698
|
|
|
5672
5699
|
var output;
|
|
5673
5700
|
|
|
5674
|
-
var domain = _toConsumableArray(
|
|
5701
|
+
var domain = _toConsumableArray(_this37[xAxis].domain());
|
|
5675
5702
|
|
|
5676
|
-
if (
|
|
5703
|
+
if (_this37.options.orientation === 'horizontal') {
|
|
5677
5704
|
domain = domain.reverse();
|
|
5678
5705
|
}
|
|
5679
5706
|
|
|
5680
5707
|
for (var j = 0; j < domain.length; j++) {
|
|
5681
|
-
var breakA =
|
|
5708
|
+
var breakA = _this37[xAxis](domain[j]) - width / 2;
|
|
5682
5709
|
var breakB = breakA + width;
|
|
5683
5710
|
|
|
5684
5711
|
if (input > breakA && input <= breakB) {
|
|
@@ -5778,10 +5805,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5778
5805
|
}, {
|
|
5779
5806
|
key: "handleEventMouseMove",
|
|
5780
5807
|
value: function handleEventMouseMove(event, d) {
|
|
5781
|
-
var
|
|
5808
|
+
var _this38 = this;
|
|
5782
5809
|
|
|
5783
5810
|
var bisectDate = d3.bisector(function (d) {
|
|
5784
|
-
return
|
|
5811
|
+
return _this38.parseX(d.x.value);
|
|
5785
5812
|
}).left;
|
|
5786
5813
|
|
|
5787
5814
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -5820,8 +5847,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5820
5847
|
}
|
|
5821
5848
|
|
|
5822
5849
|
this.options.data.series.forEach(function (s) {
|
|
5823
|
-
if (
|
|
5824
|
-
xPoint =
|
|
5850
|
+
if (_this38.options.data[xData].scale !== 'Time') {
|
|
5851
|
+
xPoint = _this38[xAxis](_this38.parseX(xLabel));
|
|
5825
5852
|
s.data.forEach(function (d) {
|
|
5826
5853
|
if (d.x.value === xLabel) {
|
|
5827
5854
|
if (!tooltipTitle) {
|
|
@@ -5840,13 +5867,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5840
5867
|
var pointA = s.data[index - 1];
|
|
5841
5868
|
var pointB = s.data[index];
|
|
5842
5869
|
|
|
5843
|
-
if (
|
|
5870
|
+
if (_this38.options.orientation === 'horizontal') {
|
|
5844
5871
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
5845
5872
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
5846
5873
|
}
|
|
5847
5874
|
|
|
5848
5875
|
if (pointA && !pointB) {
|
|
5849
|
-
xPoint =
|
|
5876
|
+
xPoint = _this38[xAxis](_this38.parseX(pointA.x.value));
|
|
5850
5877
|
tooltipTitle = pointA.x.value;
|
|
5851
5878
|
|
|
5852
5879
|
if (!pointA.y.color) {
|
|
@@ -5856,12 +5883,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5856
5883
|
tooltipData.push(pointA.y);
|
|
5857
5884
|
|
|
5858
5885
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
5859
|
-
tooltipTitle = d3.timeFormat(
|
|
5886
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
5860
5887
|
}
|
|
5861
5888
|
}
|
|
5862
5889
|
|
|
5863
5890
|
if (pointB && !pointA) {
|
|
5864
|
-
xPoint =
|
|
5891
|
+
xPoint = _this38[xAxis](_this38.parseX(pointB.x.value));
|
|
5865
5892
|
tooltipTitle = pointB.x.value;
|
|
5866
5893
|
|
|
5867
5894
|
if (!pointB.y.color) {
|
|
@@ -5871,14 +5898,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5871
5898
|
tooltipData.push(pointB.y);
|
|
5872
5899
|
|
|
5873
5900
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5874
|
-
tooltipTitle = d3.timeFormat(
|
|
5901
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5875
5902
|
}
|
|
5876
5903
|
}
|
|
5877
5904
|
|
|
5878
5905
|
if (pointA && pointB) {
|
|
5879
|
-
var d0 =
|
|
5906
|
+
var d0 = _this38[xAxis](_this38.parseX(pointA.x.value));
|
|
5880
5907
|
|
|
5881
|
-
var d1 =
|
|
5908
|
+
var d1 = _this38[xAxis](_this38.parseX(pointB.x.value));
|
|
5882
5909
|
|
|
5883
5910
|
var mid = Math.abs(d0 - d1) / 2;
|
|
5884
5911
|
|
|
@@ -5887,7 +5914,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5887
5914
|
tooltipTitle = pointB.x.value;
|
|
5888
5915
|
|
|
5889
5916
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5890
|
-
tooltipTitle = d3.timeFormat(
|
|
5917
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5891
5918
|
}
|
|
5892
5919
|
|
|
5893
5920
|
if (!pointB.y.color) {
|
|
@@ -5900,7 +5927,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5900
5927
|
tooltipTitle = pointA.x.value;
|
|
5901
5928
|
|
|
5902
5929
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5903
|
-
tooltipTitle = d3.timeFormat(
|
|
5930
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5904
5931
|
}
|
|
5905
5932
|
|
|
5906
5933
|
if (!pointA.y.color) {
|
|
@@ -6005,7 +6032,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6005
6032
|
}, {
|
|
6006
6033
|
key: "render",
|
|
6007
6034
|
value: function render(options) {
|
|
6008
|
-
var
|
|
6035
|
+
var _this39 = this;
|
|
6009
6036
|
|
|
6010
6037
|
/* global d3 options WebsyUtils */
|
|
6011
6038
|
if (typeof options !== 'undefined') {
|
|
@@ -6074,7 +6101,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6074
6101
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
6075
6102
|
return {
|
|
6076
6103
|
value: s.label || s.key,
|
|
6077
|
-
color: s.color ||
|
|
6104
|
+
color: s.color || _this39.options.colors[i % _this39.options.colors.length]
|
|
6078
6105
|
};
|
|
6079
6106
|
});
|
|
6080
6107
|
|
|
@@ -6326,7 +6353,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6326
6353
|
|
|
6327
6354
|
if (this.options.data.bottom.formatter) {
|
|
6328
6355
|
bAxisFunc.tickFormat(function (d) {
|
|
6329
|
-
return
|
|
6356
|
+
return _this39.options.data.bottom.formatter(d);
|
|
6330
6357
|
});
|
|
6331
6358
|
}
|
|
6332
6359
|
|
|
@@ -6352,8 +6379,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6352
6379
|
|
|
6353
6380
|
if (this.options.margin.axisLeft > 0) {
|
|
6354
6381
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
6355
|
-
if (
|
|
6356
|
-
d =
|
|
6382
|
+
if (_this39.options.data.left.formatter) {
|
|
6383
|
+
d = _this39.options.data.left.formatter(d);
|
|
6357
6384
|
}
|
|
6358
6385
|
|
|
6359
6386
|
return d;
|
|
@@ -6390,8 +6417,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6390
6417
|
|
|
6391
6418
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
6392
6419
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
6393
|
-
if (
|
|
6394
|
-
d =
|
|
6420
|
+
if (_this39.options.data.right.formatter) {
|
|
6421
|
+
d = _this39.options.data.right.formatter(d);
|
|
6395
6422
|
}
|
|
6396
6423
|
|
|
6397
6424
|
return d;
|
|
@@ -6417,16 +6444,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6417
6444
|
|
|
6418
6445
|
this.options.data.series.forEach(function (series, index) {
|
|
6419
6446
|
if (!series.key) {
|
|
6420
|
-
series.key =
|
|
6447
|
+
series.key = _this39.createIdentity();
|
|
6421
6448
|
}
|
|
6422
6449
|
|
|
6423
6450
|
if (!series.color) {
|
|
6424
|
-
series.color =
|
|
6451
|
+
series.color = _this39.options.colors[index % _this39.options.colors.length];
|
|
6425
6452
|
}
|
|
6426
6453
|
|
|
6427
|
-
|
|
6454
|
+
_this39["render".concat(series.type || 'bar')](series, index);
|
|
6428
6455
|
|
|
6429
|
-
|
|
6456
|
+
_this39.renderLabels(series, index);
|
|
6430
6457
|
});
|
|
6431
6458
|
}
|
|
6432
6459
|
}
|
|
@@ -6434,17 +6461,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6434
6461
|
}, {
|
|
6435
6462
|
key: "renderarea",
|
|
6436
6463
|
value: function renderarea(series, index) {
|
|
6437
|
-
var
|
|
6464
|
+
var _this40 = this;
|
|
6438
6465
|
|
|
6439
6466
|
/* global d3 series index */
|
|
6440
6467
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
6441
6468
|
return d3.area().x(function (d) {
|
|
6442
|
-
return
|
|
6469
|
+
return _this40[xAxis](_this40.parseX(d.x.value));
|
|
6443
6470
|
}).y0(function (d) {
|
|
6444
|
-
return
|
|
6471
|
+
return _this40[yAxis](0);
|
|
6445
6472
|
}).y1(function (d) {
|
|
6446
|
-
return
|
|
6447
|
-
}).curve(d3[curveStyle ||
|
|
6473
|
+
return _this40[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6474
|
+
}).curve(d3[curveStyle || _this40.options.curveStyle]);
|
|
6448
6475
|
};
|
|
6449
6476
|
|
|
6450
6477
|
var xAxis = 'bottomAxis';
|
|
@@ -6619,15 +6646,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6619
6646
|
}, {
|
|
6620
6647
|
key: "renderline",
|
|
6621
6648
|
value: function renderline(series, index) {
|
|
6622
|
-
var
|
|
6649
|
+
var _this41 = this;
|
|
6623
6650
|
|
|
6624
6651
|
/* global series index d3 */
|
|
6625
6652
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
6626
6653
|
return d3.line().x(function (d) {
|
|
6627
|
-
return
|
|
6654
|
+
return _this41[xAxis](_this41.parseX(d.x.value));
|
|
6628
6655
|
}).y(function (d) {
|
|
6629
|
-
return
|
|
6630
|
-
}).curve(d3[curveStyle ||
|
|
6656
|
+
return _this41[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6657
|
+
}).curve(d3[curveStyle || _this41.options.curveStyle]);
|
|
6631
6658
|
};
|
|
6632
6659
|
|
|
6633
6660
|
var xAxis = 'bottomAxis';
|
|
@@ -6665,14 +6692,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6665
6692
|
}, {
|
|
6666
6693
|
key: "rendersymbol",
|
|
6667
6694
|
value: function rendersymbol(series, index) {
|
|
6668
|
-
var
|
|
6695
|
+
var _this42 = this;
|
|
6669
6696
|
|
|
6670
6697
|
/* global d3 series index series.key */
|
|
6671
6698
|
var drawSymbol = function drawSymbol(size) {
|
|
6672
6699
|
return d3.symbol() // .type(d => {
|
|
6673
6700
|
// return d3.symbols[0]
|
|
6674
6701
|
// })
|
|
6675
|
-
.size(size ||
|
|
6702
|
+
.size(size || _this42.options.symbolSize);
|
|
6676
6703
|
};
|
|
6677
6704
|
|
|
6678
6705
|
var xAxis = 'bottomAxis';
|
|
@@ -6690,7 +6717,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6690
6717
|
symbols.attr('d', function (d) {
|
|
6691
6718
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
6692
6719
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
6693
|
-
return "translate(".concat(
|
|
6720
|
+
return "translate(".concat(_this42[xAxis](_this42.parseX(d.x.value)), ", ").concat(_this42[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
6694
6721
|
}); // Enter
|
|
6695
6722
|
|
|
6696
6723
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -6699,7 +6726,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6699
6726
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
6700
6727
|
return "symbol symbol_".concat(series.key);
|
|
6701
6728
|
}).attr('transform', function (d) {
|
|
6702
|
-
return "translate(".concat(
|
|
6729
|
+
return "translate(".concat(_this42[xAxis](_this42.parseX(d.x.value)), ", ").concat(_this42[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
6703
6730
|
});
|
|
6704
6731
|
}
|
|
6705
6732
|
}, {
|
|
@@ -6854,7 +6881,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6854
6881
|
}, {
|
|
6855
6882
|
key: "resize",
|
|
6856
6883
|
value: function resize() {
|
|
6857
|
-
var
|
|
6884
|
+
var _this43 = this;
|
|
6858
6885
|
|
|
6859
6886
|
var el = document.getElementById(this.elementId);
|
|
6860
6887
|
|
|
@@ -6867,7 +6894,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6867
6894
|
// }
|
|
6868
6895
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
6869
6896
|
html += this._data.map(function (d, i) {
|
|
6870
|
-
return
|
|
6897
|
+
return _this43.getLegendItemHTML(d);
|
|
6871
6898
|
}).join('');
|
|
6872
6899
|
html += "\n <div>\n ";
|
|
6873
6900
|
el.innerHTML = html;
|
|
@@ -7039,7 +7066,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7039
7066
|
}, {
|
|
7040
7067
|
key: "render",
|
|
7041
7068
|
value: function render() {
|
|
7042
|
-
var
|
|
7069
|
+
var _this44 = this;
|
|
7043
7070
|
|
|
7044
7071
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
7045
7072
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -7048,7 +7075,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7048
7075
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
7049
7076
|
return {
|
|
7050
7077
|
value: s.label || s.key,
|
|
7051
|
-
color: s.color ||
|
|
7078
|
+
color: s.color || _this44.options.colors[i % _this44.options.colors.length]
|
|
7052
7079
|
};
|
|
7053
7080
|
});
|
|
7054
7081
|
var longestValue = legendData.map(function (s) {
|
|
@@ -7112,7 +7139,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7112
7139
|
|
|
7113
7140
|
if (this.polygons) {
|
|
7114
7141
|
this.polygons.forEach(function (p) {
|
|
7115
|
-
return
|
|
7142
|
+
return _this44.map.removeLayer(p);
|
|
7116
7143
|
});
|
|
7117
7144
|
}
|
|
7118
7145
|
|
|
@@ -7170,18 +7197,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7170
7197
|
}
|
|
7171
7198
|
|
|
7172
7199
|
if (!p.options.color) {
|
|
7173
|
-
p.options.color =
|
|
7200
|
+
p.options.color = _this44.options.colors[i % _this44.options.colors.length];
|
|
7174
7201
|
}
|
|
7175
7202
|
|
|
7176
7203
|
var pol = L.polygon(p.data.map(function (c) {
|
|
7177
7204
|
return c.map(function (d) {
|
|
7178
7205
|
return [d.Latitude, d.Longitude];
|
|
7179
7206
|
});
|
|
7180
|
-
}), p.options).addTo(
|
|
7207
|
+
}), p.options).addTo(_this44.map);
|
|
7181
7208
|
|
|
7182
|
-
|
|
7209
|
+
_this44.polygons.push(pol);
|
|
7183
7210
|
|
|
7184
|
-
|
|
7211
|
+
_this44.map.fitBounds(pol.getBounds());
|
|
7185
7212
|
});
|
|
7186
7213
|
} // if (this.data.markers.length > 0) {
|
|
7187
7214
|
// el.classList.remove('hidden')
|