@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
package/dist/websy-designs.js
CHANGED
|
@@ -1265,24 +1265,47 @@ 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
|
+
}
|
|
1272
1281
|
|
|
1273
|
-
|
|
1274
|
-
|
|
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]];
|
|
1275
1298
|
} // check if the custom range matches a configured range
|
|
1276
1299
|
|
|
1277
1300
|
|
|
1278
1301
|
for (var i = 0; i < this.options.ranges[this.options.mode].length; i++) {
|
|
1279
1302
|
if (this.options.ranges[this.options.mode][i].range.length === 1) {
|
|
1280
|
-
if (this.options.ranges[this.options.mode][i].range[0] ===
|
|
1303
|
+
if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0]) {
|
|
1281
1304
|
this.selectedRange = i;
|
|
1282
1305
|
break;
|
|
1283
1306
|
}
|
|
1284
1307
|
} else if (this.options.ranges[this.options.mode][i].range.length === 2) {
|
|
1285
|
-
if (this.options.ranges[this.options.mode][i].range[0] ===
|
|
1308
|
+
if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0] && this.options.ranges[this.options.mode][i].range[1] === rangeInput[1]) {
|
|
1286
1309
|
this.selectedRange = i;
|
|
1287
1310
|
break;
|
|
1288
1311
|
}
|
|
@@ -1316,27 +1339,27 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1316
1339
|
}, {
|
|
1317
1340
|
key: "updateRange",
|
|
1318
1341
|
value: function updateRange() {
|
|
1319
|
-
var
|
|
1342
|
+
var _this9 = this;
|
|
1320
1343
|
|
|
1321
1344
|
var range;
|
|
1322
1345
|
|
|
1323
1346
|
if (this.selectedRange === -1) {
|
|
1324
1347
|
var list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(function (d) {
|
|
1325
|
-
if (
|
|
1348
|
+
if (_this9.options.mode === 'date') {
|
|
1326
1349
|
if (!d.toLocaleDateString) {
|
|
1327
1350
|
d = new Date(d);
|
|
1328
1351
|
}
|
|
1329
1352
|
|
|
1330
1353
|
return d.toLocaleDateString();
|
|
1331
|
-
} else if (
|
|
1354
|
+
} else if (_this9.options.mode === 'year') {
|
|
1332
1355
|
return d;
|
|
1333
|
-
} else if (
|
|
1356
|
+
} else if (_this9.options.mode === 'monthyear') {
|
|
1334
1357
|
if (!d.getMonth) {
|
|
1335
1358
|
d = new Date(d);
|
|
1336
1359
|
}
|
|
1337
1360
|
|
|
1338
|
-
return "".concat(
|
|
1339
|
-
} else if (
|
|
1361
|
+
return "".concat(_this9.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
1362
|
+
} else if (_this9.options.mode === 'hour') {
|
|
1340
1363
|
return d;
|
|
1341
1364
|
}
|
|
1342
1365
|
});
|
|
@@ -1396,7 +1419,7 @@ Date.prototype.floor = function () {
|
|
|
1396
1419
|
|
|
1397
1420
|
var WebsyDropdown = /*#__PURE__*/function () {
|
|
1398
1421
|
function WebsyDropdown(elementId, options) {
|
|
1399
|
-
var
|
|
1422
|
+
var _this10 = this;
|
|
1400
1423
|
|
|
1401
1424
|
_classCallCheck(this, WebsyDropdown);
|
|
1402
1425
|
|
|
@@ -1440,10 +1463,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1440
1463
|
el.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
1441
1464
|
el.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
1442
1465
|
var headerLabel = this.selectedItems.map(function (s) {
|
|
1443
|
-
return
|
|
1466
|
+
return _this10.options.items[s].label || _this10.options.items[s].value;
|
|
1444
1467
|
}).join(this.options.multiValueDelimiter);
|
|
1445
1468
|
var headerValue = this.selectedItems.map(function (s) {
|
|
1446
|
-
return
|
|
1469
|
+
return _this10.options.items[s].value || _this10.options.items[s].label;
|
|
1447
1470
|
}).join(this.options.multiValueDelimiter);
|
|
1448
1471
|
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
1472
|
|
|
@@ -1726,10 +1749,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1726
1749
|
}, {
|
|
1727
1750
|
key: "renderItems",
|
|
1728
1751
|
value: function renderItems() {
|
|
1729
|
-
var
|
|
1752
|
+
var _this11 = this;
|
|
1730
1753
|
|
|
1731
1754
|
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(
|
|
1755
|
+
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
1756
|
}).join('');
|
|
1734
1757
|
var el = document.getElementById("".concat(this.elementId, "_items"));
|
|
1735
1758
|
|
|
@@ -1748,7 +1771,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1748
1771
|
}, {
|
|
1749
1772
|
key: "updateHeader",
|
|
1750
1773
|
value: function updateHeader(item) {
|
|
1751
|
-
var
|
|
1774
|
+
var _this12 = this;
|
|
1752
1775
|
|
|
1753
1776
|
var el = document.getElementById(this.elementId);
|
|
1754
1777
|
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
@@ -1795,17 +1818,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1795
1818
|
} else if (this.selectedItems.length > 1) {
|
|
1796
1819
|
if (this.options.showCompleteSelectedList === true) {
|
|
1797
1820
|
var selectedLabels = this.selectedItems.map(function (s) {
|
|
1798
|
-
return
|
|
1821
|
+
return _this12.options.items[s].label || _this12.options.items[s].value;
|
|
1799
1822
|
}).join(this.options.multiValueDelimiter);
|
|
1800
1823
|
var selectedValues = this.selectedItems.map(function (s) {
|
|
1801
|
-
return
|
|
1824
|
+
return _this12.options.items[s].value || _this12.options.items[s].label;
|
|
1802
1825
|
}).join(this.options.multiValueDelimiter);
|
|
1803
1826
|
labelEl.innerHTML = selectedLabels;
|
|
1804
1827
|
labelEl.setAttribute('data-info', selectedLabels);
|
|
1805
1828
|
inputEl.value = selectedValues;
|
|
1806
1829
|
} else {
|
|
1807
1830
|
var _selectedValues = this.selectedItems.map(function (s) {
|
|
1808
|
-
return
|
|
1831
|
+
return _this12.options.items[s].value || _this12.options.items[s].label;
|
|
1809
1832
|
}).join(this.options.multiValueDelimiter);
|
|
1810
1833
|
|
|
1811
1834
|
labelEl.innerHTML = "".concat(this.selectedItems.length, " selected");
|
|
@@ -1942,16 +1965,16 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1942
1965
|
}, {
|
|
1943
1966
|
key: "checkRecaptcha",
|
|
1944
1967
|
value: function checkRecaptcha() {
|
|
1945
|
-
var
|
|
1968
|
+
var _this13 = this;
|
|
1946
1969
|
|
|
1947
1970
|
return new Promise(function (resolve, reject) {
|
|
1948
|
-
if (
|
|
1971
|
+
if (_this13.options.useRecaptcha === true) {
|
|
1949
1972
|
// if (this.recaptchaValue) {
|
|
1950
1973
|
grecaptcha.ready(function () {
|
|
1951
1974
|
grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
|
|
1952
1975
|
action: 'submit'
|
|
1953
1976
|
}).then(function (token) {
|
|
1954
|
-
|
|
1977
|
+
_this13.apiService.add('google/checkrecaptcha', {
|
|
1955
1978
|
grecaptcharesponse: token
|
|
1956
1979
|
}).then(function (response) {
|
|
1957
1980
|
if (response.success && response.success === true) {
|
|
@@ -2014,14 +2037,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2014
2037
|
}, {
|
|
2015
2038
|
key: "processComponents",
|
|
2016
2039
|
value: function processComponents(components, callbackFn) {
|
|
2017
|
-
var
|
|
2040
|
+
var _this14 = this;
|
|
2018
2041
|
|
|
2019
2042
|
if (components.length === 0) {
|
|
2020
2043
|
callbackFn();
|
|
2021
2044
|
} else {
|
|
2022
2045
|
components.forEach(function (c) {
|
|
2023
2046
|
if (typeof WebsyDesigns[c.component] !== 'undefined') {
|
|
2024
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
2047
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this14.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
2025
2048
|
} else {// some user feedback here
|
|
2026
2049
|
}
|
|
2027
2050
|
});
|
|
@@ -2042,7 +2065,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2042
2065
|
}, {
|
|
2043
2066
|
key: "render",
|
|
2044
2067
|
value: function render(update, data) {
|
|
2045
|
-
var
|
|
2068
|
+
var _this15 = this;
|
|
2046
2069
|
|
|
2047
2070
|
var el = document.getElementById(this.elementId);
|
|
2048
2071
|
var componentsToProcess = [];
|
|
@@ -2052,11 +2075,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2052
2075
|
this.options.fields.forEach(function (f, i) {
|
|
2053
2076
|
if (f.component) {
|
|
2054
2077
|
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(
|
|
2078
|
+
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
2079
|
} 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(
|
|
2080
|
+
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
2081
|
} 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(
|
|
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 <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
2083
|
}
|
|
2061
2084
|
});
|
|
2062
2085
|
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 +2096,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2073
2096
|
|
|
2074
2097
|
el.innerHTML = html;
|
|
2075
2098
|
this.processComponents(componentsToProcess, function () {
|
|
2076
|
-
if (
|
|
2099
|
+
if (_this15.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
|
|
2077
2100
|
}
|
|
2078
2101
|
});
|
|
2079
2102
|
}
|
|
@@ -2081,7 +2104,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2081
2104
|
}, {
|
|
2082
2105
|
key: "submitForm",
|
|
2083
2106
|
value: function submitForm() {
|
|
2084
|
-
var
|
|
2107
|
+
var _this16 = this;
|
|
2085
2108
|
|
|
2086
2109
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2087
2110
|
|
|
@@ -2095,32 +2118,32 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2095
2118
|
data[key] = value;
|
|
2096
2119
|
});
|
|
2097
2120
|
|
|
2098
|
-
if (
|
|
2099
|
-
var
|
|
2121
|
+
if (_this16.options.url) {
|
|
2122
|
+
var _this16$apiService;
|
|
2100
2123
|
|
|
2101
|
-
var params = [
|
|
2124
|
+
var params = [_this16.options.url];
|
|
2102
2125
|
|
|
2103
|
-
if (
|
|
2104
|
-
params.push(
|
|
2126
|
+
if (_this16.options.mode === 'update') {
|
|
2127
|
+
params.push(_this16.options.id);
|
|
2105
2128
|
}
|
|
2106
2129
|
|
|
2107
2130
|
params.push(data);
|
|
2108
2131
|
|
|
2109
|
-
(
|
|
2110
|
-
if (
|
|
2132
|
+
(_this16$apiService = _this16.apiService)[_this16.options.mode].apply(_this16$apiService, params).then(function (result) {
|
|
2133
|
+
if (_this16.options.clearAfterSave === true) {
|
|
2111
2134
|
// this.render()
|
|
2112
2135
|
formEl.reset();
|
|
2113
2136
|
}
|
|
2114
2137
|
|
|
2115
|
-
|
|
2138
|
+
_this16.options.onSuccess.call(_this16, result);
|
|
2116
2139
|
}, function (err) {
|
|
2117
2140
|
console.log('Error submitting form data:', err);
|
|
2118
2141
|
|
|
2119
|
-
|
|
2142
|
+
_this16.options.onError.call(_this16, err);
|
|
2120
2143
|
});
|
|
2121
|
-
} else if (
|
|
2122
|
-
|
|
2123
|
-
if (
|
|
2144
|
+
} else if (_this16.options.submitFn) {
|
|
2145
|
+
_this16.options.submitFn(data, function () {
|
|
2146
|
+
if (_this16.options.clearAfterSave === true) {
|
|
2124
2147
|
// this.render()
|
|
2125
2148
|
formEl.reset();
|
|
2126
2149
|
}
|
|
@@ -2140,17 +2163,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2140
2163
|
}, {
|
|
2141
2164
|
key: "data",
|
|
2142
2165
|
set: function set(d) {
|
|
2143
|
-
var
|
|
2166
|
+
var _this17 = this;
|
|
2144
2167
|
|
|
2145
2168
|
if (!this.options.fields) {
|
|
2146
2169
|
this.options.fields = [];
|
|
2147
2170
|
}
|
|
2148
2171
|
|
|
2149
2172
|
var _loop = function _loop(key) {
|
|
2150
|
-
|
|
2173
|
+
_this17.options.fields.forEach(function (f) {
|
|
2151
2174
|
if (f.field === key) {
|
|
2152
2175
|
f.value = d[key];
|
|
2153
|
-
var el = document.getElementById("".concat(
|
|
2176
|
+
var el = document.getElementById("".concat(_this17.elementId, "_input_").concat(f.field));
|
|
2154
2177
|
el.value = f.value;
|
|
2155
2178
|
}
|
|
2156
2179
|
});
|
|
@@ -2529,7 +2552,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2529
2552
|
|
|
2530
2553
|
var Pager = /*#__PURE__*/function () {
|
|
2531
2554
|
function Pager(elementId, options) {
|
|
2532
|
-
var
|
|
2555
|
+
var _this18 = this;
|
|
2533
2556
|
|
|
2534
2557
|
_classCallCheck(this, Pager);
|
|
2535
2558
|
|
|
@@ -2582,8 +2605,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2582
2605
|
allowClear: false,
|
|
2583
2606
|
disableSearch: true,
|
|
2584
2607
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
2585
|
-
if (
|
|
2586
|
-
|
|
2608
|
+
if (_this18.options.onChangePageSize) {
|
|
2609
|
+
_this18.options.onChangePageSize(selectedItem.value);
|
|
2587
2610
|
}
|
|
2588
2611
|
}
|
|
2589
2612
|
});
|
|
@@ -2607,13 +2630,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2607
2630
|
}, {
|
|
2608
2631
|
key: "render",
|
|
2609
2632
|
value: function render() {
|
|
2610
|
-
var
|
|
2633
|
+
var _this19 = this;
|
|
2611
2634
|
|
|
2612
2635
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
2613
2636
|
|
|
2614
2637
|
if (el) {
|
|
2615
2638
|
var pages = this.options.pages.map(function (item, index) {
|
|
2616
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
2639
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this19.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
2617
2640
|
});
|
|
2618
2641
|
var startIndex = 0;
|
|
2619
2642
|
|
|
@@ -2681,58 +2704,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2681
2704
|
_createClass(WebsyPDFButton, [{
|
|
2682
2705
|
key: "handleClick",
|
|
2683
2706
|
value: function handleClick(event) {
|
|
2684
|
-
var
|
|
2707
|
+
var _this20 = this;
|
|
2685
2708
|
|
|
2686
2709
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
2687
2710
|
this.loader.show();
|
|
2688
2711
|
setTimeout(function () {
|
|
2689
|
-
if (
|
|
2690
|
-
var el = document.getElementById(
|
|
2712
|
+
if (_this20.options.targetId) {
|
|
2713
|
+
var el = document.getElementById(_this20.options.targetId);
|
|
2691
2714
|
|
|
2692
2715
|
if (el) {
|
|
2693
2716
|
var pdfData = {
|
|
2694
2717
|
options: {}
|
|
2695
2718
|
};
|
|
2696
2719
|
|
|
2697
|
-
if (
|
|
2698
|
-
pdfData.options = _extends({},
|
|
2720
|
+
if (_this20.options.pdfOptions) {
|
|
2721
|
+
pdfData.options = _extends({}, _this20.options.pdfOptions);
|
|
2699
2722
|
}
|
|
2700
2723
|
|
|
2701
|
-
if (
|
|
2702
|
-
if (
|
|
2703
|
-
var headerEl = document.getElementById(
|
|
2724
|
+
if (_this20.options.header) {
|
|
2725
|
+
if (_this20.options.header.elementId) {
|
|
2726
|
+
var headerEl = document.getElementById(_this20.options.header.elementId);
|
|
2704
2727
|
|
|
2705
2728
|
if (headerEl) {
|
|
2706
2729
|
pdfData.header = headerEl.outerHTML;
|
|
2707
2730
|
|
|
2708
|
-
if (
|
|
2709
|
-
pdfData.options.headerCSS =
|
|
2731
|
+
if (_this20.options.header.css) {
|
|
2732
|
+
pdfData.options.headerCSS = _this20.options.header.css;
|
|
2710
2733
|
}
|
|
2711
2734
|
}
|
|
2712
|
-
} else if (
|
|
2713
|
-
pdfData.header =
|
|
2735
|
+
} else if (_this20.options.header.html) {
|
|
2736
|
+
pdfData.header = _this20.options.header.html;
|
|
2714
2737
|
|
|
2715
|
-
if (
|
|
2716
|
-
pdfData.options.headerCSS =
|
|
2738
|
+
if (_this20.options.header.css) {
|
|
2739
|
+
pdfData.options.headerCSS = _this20.options.header.css;
|
|
2717
2740
|
}
|
|
2718
2741
|
} else {
|
|
2719
|
-
pdfData.header =
|
|
2742
|
+
pdfData.header = _this20.options.header;
|
|
2720
2743
|
}
|
|
2721
2744
|
}
|
|
2722
2745
|
|
|
2723
|
-
if (
|
|
2724
|
-
if (
|
|
2725
|
-
var footerEl = document.getElementById(
|
|
2746
|
+
if (_this20.options.footer) {
|
|
2747
|
+
if (_this20.options.footer.elementId) {
|
|
2748
|
+
var footerEl = document.getElementById(_this20.options.footer.elementId);
|
|
2726
2749
|
|
|
2727
2750
|
if (footerEl) {
|
|
2728
2751
|
pdfData.footer = footerEl.outerHTML;
|
|
2729
2752
|
|
|
2730
|
-
if (
|
|
2731
|
-
pdfData.options.footerCSS =
|
|
2753
|
+
if (_this20.options.footer.css) {
|
|
2754
|
+
pdfData.options.footerCSS = _this20.options.footer.css;
|
|
2732
2755
|
}
|
|
2733
2756
|
}
|
|
2734
2757
|
} else {
|
|
2735
|
-
pdfData.footer =
|
|
2758
|
+
pdfData.footer = _this20.options.footer;
|
|
2736
2759
|
}
|
|
2737
2760
|
}
|
|
2738
2761
|
|
|
@@ -2741,31 +2764,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2741
2764
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
2742
2765
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
2743
2766
|
|
|
2744
|
-
|
|
2767
|
+
_this20.service.add('', pdfData, {
|
|
2745
2768
|
responseType: 'blob'
|
|
2746
2769
|
}).then(function (response) {
|
|
2747
|
-
|
|
2770
|
+
_this20.loader.hide();
|
|
2748
2771
|
|
|
2749
2772
|
var blob = new Blob([response], {
|
|
2750
2773
|
type: 'application/pdf'
|
|
2751
2774
|
});
|
|
2752
2775
|
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
2776
|
|
|
2754
|
-
if (
|
|
2777
|
+
if (_this20.options.directDownload === true) {
|
|
2755
2778
|
var fileName;
|
|
2756
2779
|
|
|
2757
|
-
if (typeof
|
|
2758
|
-
fileName =
|
|
2780
|
+
if (typeof _this20.options.fileName === 'function') {
|
|
2781
|
+
fileName = _this20.options.fileName() || 'Export';
|
|
2759
2782
|
} else {
|
|
2760
|
-
fileName =
|
|
2783
|
+
fileName = _this20.options.fileName || 'Export';
|
|
2761
2784
|
}
|
|
2762
2785
|
|
|
2763
2786
|
msg += "download='".concat(fileName, ".pdf'");
|
|
2764
2787
|
}
|
|
2765
2788
|
|
|
2766
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
2789
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this20.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
2767
2790
|
|
|
2768
|
-
|
|
2791
|
+
_this20.popup.show({
|
|
2769
2792
|
message: msg,
|
|
2770
2793
|
mask: true
|
|
2771
2794
|
});
|
|
@@ -2950,7 +2973,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
2950
2973
|
|
|
2951
2974
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
2952
2975
|
function ResponsiveText(elementId, options) {
|
|
2953
|
-
var
|
|
2976
|
+
var _this21 = this;
|
|
2954
2977
|
|
|
2955
2978
|
_classCallCheck(this, ResponsiveText);
|
|
2956
2979
|
|
|
@@ -2963,7 +2986,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
2963
2986
|
this.elementId = elementId;
|
|
2964
2987
|
this.canvas = document.createElement('canvas');
|
|
2965
2988
|
window.addEventListener('resize', function () {
|
|
2966
|
-
return
|
|
2989
|
+
return _this21.render();
|
|
2967
2990
|
});
|
|
2968
2991
|
var el = document.getElementById(this.elementId);
|
|
2969
2992
|
|
|
@@ -3182,7 +3205,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3182
3205
|
|
|
3183
3206
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3184
3207
|
function WebsyResultList(elementId, options) {
|
|
3185
|
-
var
|
|
3208
|
+
var _this22 = this;
|
|
3186
3209
|
|
|
3187
3210
|
_classCallCheck(this, WebsyResultList);
|
|
3188
3211
|
|
|
@@ -3210,9 +3233,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3210
3233
|
|
|
3211
3234
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3212
3235
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3213
|
-
|
|
3236
|
+
_this22.options.template = templateString;
|
|
3214
3237
|
|
|
3215
|
-
|
|
3238
|
+
_this22.render();
|
|
3216
3239
|
});
|
|
3217
3240
|
} else {
|
|
3218
3241
|
this.render();
|
|
@@ -3231,7 +3254,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3231
3254
|
}, {
|
|
3232
3255
|
key: "buildHTML",
|
|
3233
3256
|
value: function buildHTML(d) {
|
|
3234
|
-
var
|
|
3257
|
+
var _this23 = this;
|
|
3235
3258
|
|
|
3236
3259
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3237
3260
|
var html = "";
|
|
@@ -3239,7 +3262,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3239
3262
|
if (this.options.template) {
|
|
3240
3263
|
if (d.length > 0) {
|
|
3241
3264
|
d.forEach(function (row, ix) {
|
|
3242
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(
|
|
3265
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(_this23.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3243
3266
|
|
|
3244
3267
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3245
3268
|
|
|
@@ -3359,7 +3382,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3359
3382
|
}, {
|
|
3360
3383
|
key: "handleClick",
|
|
3361
3384
|
value: function handleClick(event) {
|
|
3362
|
-
var
|
|
3385
|
+
var _this24 = this;
|
|
3363
3386
|
|
|
3364
3387
|
if (event.target.classList.contains('clickable')) {
|
|
3365
3388
|
var l = event.target.getAttribute('data-event');
|
|
@@ -3377,8 +3400,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3377
3400
|
l = l[0];
|
|
3378
3401
|
params = params.map(function (p) {
|
|
3379
3402
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
3380
|
-
if (
|
|
3381
|
-
p =
|
|
3403
|
+
if (_this24.rows[+id]) {
|
|
3404
|
+
p = _this24.rows[+id][p];
|
|
3382
3405
|
}
|
|
3383
3406
|
} else if (typeof p === 'string') {
|
|
3384
3407
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -3400,13 +3423,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3400
3423
|
}, {
|
|
3401
3424
|
key: "render",
|
|
3402
3425
|
value: function render() {
|
|
3403
|
-
var
|
|
3426
|
+
var _this25 = this;
|
|
3404
3427
|
|
|
3405
3428
|
if (this.options.entity) {
|
|
3406
3429
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3407
|
-
|
|
3430
|
+
_this25.rows = results.rows;
|
|
3408
3431
|
|
|
3409
|
-
|
|
3432
|
+
_this25.resize();
|
|
3410
3433
|
});
|
|
3411
3434
|
} else {
|
|
3412
3435
|
this.resize();
|
|
@@ -3485,14 +3508,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3485
3508
|
_createClass(WebsyRouter, [{
|
|
3486
3509
|
key: "addGroup",
|
|
3487
3510
|
value: function addGroup(group) {
|
|
3488
|
-
var
|
|
3511
|
+
var _this26 = this;
|
|
3489
3512
|
|
|
3490
3513
|
if (!this.groups[group]) {
|
|
3491
3514
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3492
3515
|
|
|
3493
3516
|
if (els) {
|
|
3494
3517
|
this.getClosestParent(els[0], function (parent) {
|
|
3495
|
-
|
|
3518
|
+
_this26.groups[group] = {
|
|
3496
3519
|
activeView: '',
|
|
3497
3520
|
views: [],
|
|
3498
3521
|
parent: parent.getAttribute('data-view')
|
|
@@ -3817,12 +3840,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3817
3840
|
}, {
|
|
3818
3841
|
key: "showComponents",
|
|
3819
3842
|
value: function showComponents(view) {
|
|
3820
|
-
var
|
|
3843
|
+
var _this27 = this;
|
|
3821
3844
|
|
|
3822
3845
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
3823
3846
|
this.options.views[view].components.forEach(function (c) {
|
|
3824
3847
|
if (typeof c.instance === 'undefined') {
|
|
3825
|
-
|
|
3848
|
+
_this27.prepComponent(c.elementId, c.options);
|
|
3826
3849
|
|
|
3827
3850
|
c.instance = new c.Component(c.elementId, c.options);
|
|
3828
3851
|
} else if (c.instance.render) {
|
|
@@ -4250,7 +4273,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4250
4273
|
|
|
4251
4274
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4252
4275
|
function WebsyTemplate(elementId, options) {
|
|
4253
|
-
var
|
|
4276
|
+
var _this28 = this;
|
|
4254
4277
|
|
|
4255
4278
|
_classCallCheck(this, WebsyTemplate);
|
|
4256
4279
|
|
|
@@ -4276,9 +4299,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4276
4299
|
|
|
4277
4300
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4278
4301
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4279
|
-
|
|
4302
|
+
_this28.options.template = templateString;
|
|
4280
4303
|
|
|
4281
|
-
|
|
4304
|
+
_this28.render();
|
|
4282
4305
|
});
|
|
4283
4306
|
} else {
|
|
4284
4307
|
this.render();
|
|
@@ -4288,7 +4311,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4288
4311
|
_createClass(WebsyTemplate, [{
|
|
4289
4312
|
key: "buildHTML",
|
|
4290
4313
|
value: function buildHTML() {
|
|
4291
|
-
var
|
|
4314
|
+
var _this29 = this;
|
|
4292
4315
|
|
|
4293
4316
|
var html = "";
|
|
4294
4317
|
|
|
@@ -4350,14 +4373,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4350
4373
|
}
|
|
4351
4374
|
|
|
4352
4375
|
if (polarity === true) {
|
|
4353
|
-
if (typeof
|
|
4376
|
+
if (typeof _this29.options.data[parts[0]] !== 'undefined' && _this29.options.data[parts[0]] === parts[1]) {
|
|
4354
4377
|
// remove the <if> tags
|
|
4355
4378
|
removeAll = false;
|
|
4356
4379
|
} else if (parts[0] === parts[1]) {
|
|
4357
4380
|
removeAll = false;
|
|
4358
4381
|
}
|
|
4359
4382
|
} else if (polarity === false) {
|
|
4360
|
-
if (typeof
|
|
4383
|
+
if (typeof _this29.options.data[parts[0]] !== 'undefined' && _this29.options.data[parts[0]] !== parts[1]) {
|
|
4361
4384
|
// remove the <if> tags
|
|
4362
4385
|
removeAll = false;
|
|
4363
4386
|
}
|
|
@@ -4644,7 +4667,7 @@ var WebsyUtils = {
|
|
|
4644
4667
|
|
|
4645
4668
|
var WebsyTable = /*#__PURE__*/function () {
|
|
4646
4669
|
function WebsyTable(elementId, options) {
|
|
4647
|
-
var
|
|
4670
|
+
var _this30 = this;
|
|
4648
4671
|
|
|
4649
4672
|
_classCallCheck(this, WebsyTable);
|
|
4650
4673
|
|
|
@@ -4682,8 +4705,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4682
4705
|
allowClear: false,
|
|
4683
4706
|
disableSearch: true,
|
|
4684
4707
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4685
|
-
if (
|
|
4686
|
-
|
|
4708
|
+
if (_this30.options.onChangePageSize) {
|
|
4709
|
+
_this30.options.onChangePageSize(selectedItem.value);
|
|
4687
4710
|
}
|
|
4688
4711
|
}
|
|
4689
4712
|
});
|
|
@@ -4704,7 +4727,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4704
4727
|
_createClass(WebsyTable, [{
|
|
4705
4728
|
key: "appendRows",
|
|
4706
4729
|
value: function appendRows(data) {
|
|
4707
|
-
var
|
|
4730
|
+
var _this31 = this;
|
|
4708
4731
|
|
|
4709
4732
|
this.hideError();
|
|
4710
4733
|
var bodyHTML = '';
|
|
@@ -4712,15 +4735,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4712
4735
|
if (data) {
|
|
4713
4736
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4714
4737
|
return '<tr>' + r.map(function (c, i) {
|
|
4715
|
-
if (
|
|
4738
|
+
if (_this31.options.columns[i].show !== false) {
|
|
4716
4739
|
var style = '';
|
|
4717
4740
|
|
|
4718
4741
|
if (c.style) {
|
|
4719
4742
|
style += c.style;
|
|
4720
4743
|
}
|
|
4721
4744
|
|
|
4722
|
-
if (
|
|
4723
|
-
style += "width: ".concat(
|
|
4745
|
+
if (_this31.options.columns[i].width) {
|
|
4746
|
+
style += "width: ".concat(_this31.options.columns[i].width, "; ");
|
|
4724
4747
|
}
|
|
4725
4748
|
|
|
4726
4749
|
if (c.backgroundColor) {
|
|
@@ -4735,18 +4758,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4735
4758
|
style += "color: ".concat(c.color, "; ");
|
|
4736
4759
|
}
|
|
4737
4760
|
|
|
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(
|
|
4761
|
+
if (_this31.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
4762
|
+
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 ");
|
|
4763
|
+
} else if ((_this31.options.columns[i].showAsNavigatorLink === true || _this31.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
4764
|
+
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
4765
|
} else {
|
|
4743
4766
|
var info = c.value;
|
|
4744
4767
|
|
|
4745
|
-
if (
|
|
4768
|
+
if (_this31.options.columns[i].showAsImage === true) {
|
|
4746
4769
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4747
4770
|
}
|
|
4748
4771
|
|
|
4749
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
4772
|
+
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
4773
|
}
|
|
4751
4774
|
}
|
|
4752
4775
|
}).join('') + '</tr>';
|
|
@@ -4918,7 +4941,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4918
4941
|
}, {
|
|
4919
4942
|
key: "render",
|
|
4920
4943
|
value: function render(data) {
|
|
4921
|
-
var
|
|
4944
|
+
var _this32 = this;
|
|
4922
4945
|
|
|
4923
4946
|
if (!this.options.columns) {
|
|
4924
4947
|
return;
|
|
@@ -4943,7 +4966,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4943
4966
|
|
|
4944
4967
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
4945
4968
|
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 ?
|
|
4969
|
+
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
4970
|
}
|
|
4948
4971
|
}).join('') + '</tr>';
|
|
4949
4972
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -4962,7 +4985,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4962
4985
|
|
|
4963
4986
|
if (pagingEl) {
|
|
4964
4987
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
4965
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
4988
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this32.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
4966
4989
|
});
|
|
4967
4990
|
var startIndex = 0;
|
|
4968
4991
|
|
|
@@ -5030,7 +5053,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5030
5053
|
|
|
5031
5054
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5032
5055
|
function WebsyTable2(elementId, options) {
|
|
5033
|
-
var
|
|
5056
|
+
var _this33 = this;
|
|
5034
5057
|
|
|
5035
5058
|
_classCallCheck(this, WebsyTable2);
|
|
5036
5059
|
|
|
@@ -5071,8 +5094,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5071
5094
|
allowClear: false,
|
|
5072
5095
|
disableSearch: true,
|
|
5073
5096
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5074
|
-
if (
|
|
5075
|
-
|
|
5097
|
+
if (_this33.options.onChangePageSize) {
|
|
5098
|
+
_this33.options.onChangePageSize(selectedItem.value);
|
|
5076
5099
|
}
|
|
5077
5100
|
}
|
|
5078
5101
|
});
|
|
@@ -5096,7 +5119,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5096
5119
|
_createClass(WebsyTable2, [{
|
|
5097
5120
|
key: "appendRows",
|
|
5098
5121
|
value: function appendRows(data) {
|
|
5099
|
-
var
|
|
5122
|
+
var _this34 = this;
|
|
5100
5123
|
|
|
5101
5124
|
this.hideError();
|
|
5102
5125
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -5105,15 +5128,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5105
5128
|
if (data) {
|
|
5106
5129
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5107
5130
|
return '<tr>' + r.map(function (c, i) {
|
|
5108
|
-
if (
|
|
5109
|
-
var style = "height: ".concat(
|
|
5131
|
+
if (_this34.options.columns[i].show !== false) {
|
|
5132
|
+
var style = "height: ".concat(_this34.options.cellSize, "px; line-height: ").concat(_this34.options.cellSize, "px;");
|
|
5110
5133
|
|
|
5111
5134
|
if (c.style) {
|
|
5112
5135
|
style += c.style;
|
|
5113
5136
|
}
|
|
5114
5137
|
|
|
5115
|
-
if (
|
|
5116
|
-
style += "width: ".concat(
|
|
5138
|
+
if (_this34.options.columns[i].width) {
|
|
5139
|
+
style += "width: ".concat(_this34.options.columns[i].width, "; ");
|
|
5117
5140
|
}
|
|
5118
5141
|
|
|
5119
5142
|
if (c.backgroundColor) {
|
|
@@ -5128,18 +5151,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5128
5151
|
style += "color: ".concat(c.color, "; ");
|
|
5129
5152
|
}
|
|
5130
5153
|
|
|
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(
|
|
5154
|
+
if (_this34.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5155
|
+
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 ");
|
|
5156
|
+
} else if ((_this34.options.columns[i].showAsNavigatorLink === true || _this34.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5157
|
+
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
5158
|
} else {
|
|
5136
5159
|
var info = c.value;
|
|
5137
5160
|
|
|
5138
|
-
if (
|
|
5161
|
+
if (_this34.options.columns[i].showAsImage === true) {
|
|
5139
5162
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5140
5163
|
}
|
|
5141
5164
|
|
|
5142
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5165
|
+
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
5166
|
}
|
|
5144
5167
|
}
|
|
5145
5168
|
}).join('') + '</tr>';
|
|
@@ -5397,7 +5420,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5397
5420
|
}, {
|
|
5398
5421
|
key: "render",
|
|
5399
5422
|
value: function render(data) {
|
|
5400
|
-
var
|
|
5423
|
+
var _this35 = this;
|
|
5401
5424
|
|
|
5402
5425
|
if (!this.options.columns) {
|
|
5403
5426
|
return;
|
|
@@ -5433,7 +5456,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5433
5456
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5434
5457
|
}
|
|
5435
5458
|
|
|
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 ?
|
|
5459
|
+
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
5460
|
}
|
|
5438
5461
|
}).join('') + '</tr>';
|
|
5439
5462
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5444,7 +5467,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5444
5467
|
var dropdownHTML = "";
|
|
5445
5468
|
this.options.columns.forEach(function (c, i) {
|
|
5446
5469
|
if (c.searchable && c.searchField) {
|
|
5447
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5470
|
+
dropdownHTML += "\n <div id=\"".concat(_this35.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
5448
5471
|
}
|
|
5449
5472
|
});
|
|
5450
5473
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5466,7 +5489,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5466
5489
|
|
|
5467
5490
|
if (pagingEl) {
|
|
5468
5491
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5469
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5492
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this35.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5470
5493
|
});
|
|
5471
5494
|
var startIndex = 0;
|
|
5472
5495
|
|
|
@@ -5553,7 +5576,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5553
5576
|
}, {
|
|
5554
5577
|
key: "getColumnParameters",
|
|
5555
5578
|
value: function getColumnParameters(values) {
|
|
5556
|
-
var
|
|
5579
|
+
var _this36 = this;
|
|
5557
5580
|
|
|
5558
5581
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
5559
5582
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -5561,10 +5584,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5561
5584
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
5562
5585
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5563
5586
|
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 ?
|
|
5587
|
+
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
5588
|
}).join('') + '</tr>';
|
|
5566
5589
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
5567
|
-
return "\n <td \n style='height: ".concat(
|
|
5590
|
+
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
5591
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
5569
5592
|
|
|
5570
5593
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -5614,7 +5637,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5614
5637
|
|
|
5615
5638
|
var WebsyChart = /*#__PURE__*/function () {
|
|
5616
5639
|
function WebsyChart(elementId, options) {
|
|
5617
|
-
var
|
|
5640
|
+
var _this37 = this;
|
|
5618
5641
|
|
|
5619
5642
|
_classCallCheck(this, WebsyChart);
|
|
5620
5643
|
|
|
@@ -5663,22 +5686,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5663
5686
|
this.invertOverride = function (input, input2) {
|
|
5664
5687
|
var xAxis = 'bottomAxis';
|
|
5665
5688
|
|
|
5666
|
-
if (
|
|
5689
|
+
if (_this37.options.orientation === 'horizontal') {
|
|
5667
5690
|
xAxis = 'leftAxis';
|
|
5668
5691
|
}
|
|
5669
5692
|
|
|
5670
|
-
var width =
|
|
5693
|
+
var width = _this37[xAxis].step();
|
|
5671
5694
|
|
|
5672
5695
|
var output;
|
|
5673
5696
|
|
|
5674
|
-
var domain = _toConsumableArray(
|
|
5697
|
+
var domain = _toConsumableArray(_this37[xAxis].domain());
|
|
5675
5698
|
|
|
5676
|
-
if (
|
|
5699
|
+
if (_this37.options.orientation === 'horizontal') {
|
|
5677
5700
|
domain = domain.reverse();
|
|
5678
5701
|
}
|
|
5679
5702
|
|
|
5680
5703
|
for (var j = 0; j < domain.length; j++) {
|
|
5681
|
-
var breakA =
|
|
5704
|
+
var breakA = _this37[xAxis](domain[j]) - width / 2;
|
|
5682
5705
|
var breakB = breakA + width;
|
|
5683
5706
|
|
|
5684
5707
|
if (input > breakA && input <= breakB) {
|
|
@@ -5778,10 +5801,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5778
5801
|
}, {
|
|
5779
5802
|
key: "handleEventMouseMove",
|
|
5780
5803
|
value: function handleEventMouseMove(event, d) {
|
|
5781
|
-
var
|
|
5804
|
+
var _this38 = this;
|
|
5782
5805
|
|
|
5783
5806
|
var bisectDate = d3.bisector(function (d) {
|
|
5784
|
-
return
|
|
5807
|
+
return _this38.parseX(d.x.value);
|
|
5785
5808
|
}).left;
|
|
5786
5809
|
|
|
5787
5810
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -5820,8 +5843,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5820
5843
|
}
|
|
5821
5844
|
|
|
5822
5845
|
this.options.data.series.forEach(function (s) {
|
|
5823
|
-
if (
|
|
5824
|
-
xPoint =
|
|
5846
|
+
if (_this38.options.data[xData].scale !== 'Time') {
|
|
5847
|
+
xPoint = _this38[xAxis](_this38.parseX(xLabel));
|
|
5825
5848
|
s.data.forEach(function (d) {
|
|
5826
5849
|
if (d.x.value === xLabel) {
|
|
5827
5850
|
if (!tooltipTitle) {
|
|
@@ -5840,13 +5863,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5840
5863
|
var pointA = s.data[index - 1];
|
|
5841
5864
|
var pointB = s.data[index];
|
|
5842
5865
|
|
|
5843
|
-
if (
|
|
5866
|
+
if (_this38.options.orientation === 'horizontal') {
|
|
5844
5867
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
5845
5868
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
5846
5869
|
}
|
|
5847
5870
|
|
|
5848
5871
|
if (pointA && !pointB) {
|
|
5849
|
-
xPoint =
|
|
5872
|
+
xPoint = _this38[xAxis](_this38.parseX(pointA.x.value));
|
|
5850
5873
|
tooltipTitle = pointA.x.value;
|
|
5851
5874
|
|
|
5852
5875
|
if (!pointA.y.color) {
|
|
@@ -5856,12 +5879,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5856
5879
|
tooltipData.push(pointA.y);
|
|
5857
5880
|
|
|
5858
5881
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
5859
|
-
tooltipTitle = d3.timeFormat(
|
|
5882
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
5860
5883
|
}
|
|
5861
5884
|
}
|
|
5862
5885
|
|
|
5863
5886
|
if (pointB && !pointA) {
|
|
5864
|
-
xPoint =
|
|
5887
|
+
xPoint = _this38[xAxis](_this38.parseX(pointB.x.value));
|
|
5865
5888
|
tooltipTitle = pointB.x.value;
|
|
5866
5889
|
|
|
5867
5890
|
if (!pointB.y.color) {
|
|
@@ -5871,14 +5894,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5871
5894
|
tooltipData.push(pointB.y);
|
|
5872
5895
|
|
|
5873
5896
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5874
|
-
tooltipTitle = d3.timeFormat(
|
|
5897
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5875
5898
|
}
|
|
5876
5899
|
}
|
|
5877
5900
|
|
|
5878
5901
|
if (pointA && pointB) {
|
|
5879
|
-
var d0 =
|
|
5902
|
+
var d0 = _this38[xAxis](_this38.parseX(pointA.x.value));
|
|
5880
5903
|
|
|
5881
|
-
var d1 =
|
|
5904
|
+
var d1 = _this38[xAxis](_this38.parseX(pointB.x.value));
|
|
5882
5905
|
|
|
5883
5906
|
var mid = Math.abs(d0 - d1) / 2;
|
|
5884
5907
|
|
|
@@ -5887,7 +5910,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5887
5910
|
tooltipTitle = pointB.x.value;
|
|
5888
5911
|
|
|
5889
5912
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5890
|
-
tooltipTitle = d3.timeFormat(
|
|
5913
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5891
5914
|
}
|
|
5892
5915
|
|
|
5893
5916
|
if (!pointB.y.color) {
|
|
@@ -5900,7 +5923,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5900
5923
|
tooltipTitle = pointA.x.value;
|
|
5901
5924
|
|
|
5902
5925
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5903
|
-
tooltipTitle = d3.timeFormat(
|
|
5926
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5904
5927
|
}
|
|
5905
5928
|
|
|
5906
5929
|
if (!pointA.y.color) {
|
|
@@ -6005,7 +6028,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6005
6028
|
}, {
|
|
6006
6029
|
key: "render",
|
|
6007
6030
|
value: function render(options) {
|
|
6008
|
-
var
|
|
6031
|
+
var _this39 = this;
|
|
6009
6032
|
|
|
6010
6033
|
/* global d3 options WebsyUtils */
|
|
6011
6034
|
if (typeof options !== 'undefined') {
|
|
@@ -6074,7 +6097,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6074
6097
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
6075
6098
|
return {
|
|
6076
6099
|
value: s.label || s.key,
|
|
6077
|
-
color: s.color ||
|
|
6100
|
+
color: s.color || _this39.options.colors[i % _this39.options.colors.length]
|
|
6078
6101
|
};
|
|
6079
6102
|
});
|
|
6080
6103
|
|
|
@@ -6326,7 +6349,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6326
6349
|
|
|
6327
6350
|
if (this.options.data.bottom.formatter) {
|
|
6328
6351
|
bAxisFunc.tickFormat(function (d) {
|
|
6329
|
-
return
|
|
6352
|
+
return _this39.options.data.bottom.formatter(d);
|
|
6330
6353
|
});
|
|
6331
6354
|
}
|
|
6332
6355
|
|
|
@@ -6352,8 +6375,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6352
6375
|
|
|
6353
6376
|
if (this.options.margin.axisLeft > 0) {
|
|
6354
6377
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
6355
|
-
if (
|
|
6356
|
-
d =
|
|
6378
|
+
if (_this39.options.data.left.formatter) {
|
|
6379
|
+
d = _this39.options.data.left.formatter(d);
|
|
6357
6380
|
}
|
|
6358
6381
|
|
|
6359
6382
|
return d;
|
|
@@ -6390,8 +6413,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6390
6413
|
|
|
6391
6414
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
6392
6415
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
6393
|
-
if (
|
|
6394
|
-
d =
|
|
6416
|
+
if (_this39.options.data.right.formatter) {
|
|
6417
|
+
d = _this39.options.data.right.formatter(d);
|
|
6395
6418
|
}
|
|
6396
6419
|
|
|
6397
6420
|
return d;
|
|
@@ -6417,16 +6440,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6417
6440
|
|
|
6418
6441
|
this.options.data.series.forEach(function (series, index) {
|
|
6419
6442
|
if (!series.key) {
|
|
6420
|
-
series.key =
|
|
6443
|
+
series.key = _this39.createIdentity();
|
|
6421
6444
|
}
|
|
6422
6445
|
|
|
6423
6446
|
if (!series.color) {
|
|
6424
|
-
series.color =
|
|
6447
|
+
series.color = _this39.options.colors[index % _this39.options.colors.length];
|
|
6425
6448
|
}
|
|
6426
6449
|
|
|
6427
|
-
|
|
6450
|
+
_this39["render".concat(series.type || 'bar')](series, index);
|
|
6428
6451
|
|
|
6429
|
-
|
|
6452
|
+
_this39.renderLabels(series, index);
|
|
6430
6453
|
});
|
|
6431
6454
|
}
|
|
6432
6455
|
}
|
|
@@ -6434,17 +6457,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6434
6457
|
}, {
|
|
6435
6458
|
key: "renderarea",
|
|
6436
6459
|
value: function renderarea(series, index) {
|
|
6437
|
-
var
|
|
6460
|
+
var _this40 = this;
|
|
6438
6461
|
|
|
6439
6462
|
/* global d3 series index */
|
|
6440
6463
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
6441
6464
|
return d3.area().x(function (d) {
|
|
6442
|
-
return
|
|
6465
|
+
return _this40[xAxis](_this40.parseX(d.x.value));
|
|
6443
6466
|
}).y0(function (d) {
|
|
6444
|
-
return
|
|
6467
|
+
return _this40[yAxis](0);
|
|
6445
6468
|
}).y1(function (d) {
|
|
6446
|
-
return
|
|
6447
|
-
}).curve(d3[curveStyle ||
|
|
6469
|
+
return _this40[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6470
|
+
}).curve(d3[curveStyle || _this40.options.curveStyle]);
|
|
6448
6471
|
};
|
|
6449
6472
|
|
|
6450
6473
|
var xAxis = 'bottomAxis';
|
|
@@ -6619,15 +6642,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6619
6642
|
}, {
|
|
6620
6643
|
key: "renderline",
|
|
6621
6644
|
value: function renderline(series, index) {
|
|
6622
|
-
var
|
|
6645
|
+
var _this41 = this;
|
|
6623
6646
|
|
|
6624
6647
|
/* global series index d3 */
|
|
6625
6648
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
6626
6649
|
return d3.line().x(function (d) {
|
|
6627
|
-
return
|
|
6650
|
+
return _this41[xAxis](_this41.parseX(d.x.value));
|
|
6628
6651
|
}).y(function (d) {
|
|
6629
|
-
return
|
|
6630
|
-
}).curve(d3[curveStyle ||
|
|
6652
|
+
return _this41[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6653
|
+
}).curve(d3[curveStyle || _this41.options.curveStyle]);
|
|
6631
6654
|
};
|
|
6632
6655
|
|
|
6633
6656
|
var xAxis = 'bottomAxis';
|
|
@@ -6665,14 +6688,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6665
6688
|
}, {
|
|
6666
6689
|
key: "rendersymbol",
|
|
6667
6690
|
value: function rendersymbol(series, index) {
|
|
6668
|
-
var
|
|
6691
|
+
var _this42 = this;
|
|
6669
6692
|
|
|
6670
6693
|
/* global d3 series index series.key */
|
|
6671
6694
|
var drawSymbol = function drawSymbol(size) {
|
|
6672
6695
|
return d3.symbol() // .type(d => {
|
|
6673
6696
|
// return d3.symbols[0]
|
|
6674
6697
|
// })
|
|
6675
|
-
.size(size ||
|
|
6698
|
+
.size(size || _this42.options.symbolSize);
|
|
6676
6699
|
};
|
|
6677
6700
|
|
|
6678
6701
|
var xAxis = 'bottomAxis';
|
|
@@ -6690,7 +6713,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6690
6713
|
symbols.attr('d', function (d) {
|
|
6691
6714
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
6692
6715
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
6693
|
-
return "translate(".concat(
|
|
6716
|
+
return "translate(".concat(_this42[xAxis](_this42.parseX(d.x.value)), ", ").concat(_this42[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
6694
6717
|
}); // Enter
|
|
6695
6718
|
|
|
6696
6719
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -6699,7 +6722,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6699
6722
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
6700
6723
|
return "symbol symbol_".concat(series.key);
|
|
6701
6724
|
}).attr('transform', function (d) {
|
|
6702
|
-
return "translate(".concat(
|
|
6725
|
+
return "translate(".concat(_this42[xAxis](_this42.parseX(d.x.value)), ", ").concat(_this42[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
6703
6726
|
});
|
|
6704
6727
|
}
|
|
6705
6728
|
}, {
|
|
@@ -6854,7 +6877,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6854
6877
|
}, {
|
|
6855
6878
|
key: "resize",
|
|
6856
6879
|
value: function resize() {
|
|
6857
|
-
var
|
|
6880
|
+
var _this43 = this;
|
|
6858
6881
|
|
|
6859
6882
|
var el = document.getElementById(this.elementId);
|
|
6860
6883
|
|
|
@@ -6867,7 +6890,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6867
6890
|
// }
|
|
6868
6891
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
6869
6892
|
html += this._data.map(function (d, i) {
|
|
6870
|
-
return
|
|
6893
|
+
return _this43.getLegendItemHTML(d);
|
|
6871
6894
|
}).join('');
|
|
6872
6895
|
html += "\n <div>\n ";
|
|
6873
6896
|
el.innerHTML = html;
|
|
@@ -7039,7 +7062,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7039
7062
|
}, {
|
|
7040
7063
|
key: "render",
|
|
7041
7064
|
value: function render() {
|
|
7042
|
-
var
|
|
7065
|
+
var _this44 = this;
|
|
7043
7066
|
|
|
7044
7067
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
7045
7068
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -7048,7 +7071,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7048
7071
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
7049
7072
|
return {
|
|
7050
7073
|
value: s.label || s.key,
|
|
7051
|
-
color: s.color ||
|
|
7074
|
+
color: s.color || _this44.options.colors[i % _this44.options.colors.length]
|
|
7052
7075
|
};
|
|
7053
7076
|
});
|
|
7054
7077
|
var longestValue = legendData.map(function (s) {
|
|
@@ -7112,7 +7135,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7112
7135
|
|
|
7113
7136
|
if (this.polygons) {
|
|
7114
7137
|
this.polygons.forEach(function (p) {
|
|
7115
|
-
return
|
|
7138
|
+
return _this44.map.removeLayer(p);
|
|
7116
7139
|
});
|
|
7117
7140
|
}
|
|
7118
7141
|
|
|
@@ -7170,18 +7193,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7170
7193
|
}
|
|
7171
7194
|
|
|
7172
7195
|
if (!p.options.color) {
|
|
7173
|
-
p.options.color =
|
|
7196
|
+
p.options.color = _this44.options.colors[i % _this44.options.colors.length];
|
|
7174
7197
|
}
|
|
7175
7198
|
|
|
7176
7199
|
var pol = L.polygon(p.data.map(function (c) {
|
|
7177
7200
|
return c.map(function (d) {
|
|
7178
7201
|
return [d.Latitude, d.Longitude];
|
|
7179
7202
|
});
|
|
7180
|
-
}), p.options).addTo(
|
|
7203
|
+
}), p.options).addTo(_this44.map);
|
|
7181
7204
|
|
|
7182
|
-
|
|
7205
|
+
_this44.polygons.push(pol);
|
|
7183
7206
|
|
|
7184
|
-
|
|
7207
|
+
_this44.map.fitBounds(pol.getBounds());
|
|
7185
7208
|
});
|
|
7186
7209
|
} // if (this.data.markers.length > 0) {
|
|
7187
7210
|
// el.classList.remove('hidden')
|