@websy/websy-designs 1.2.17 → 1.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/websy-designs-es6.debug.js +31 -6
- package/dist/websy-designs-es6.js +222 -193
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +31 -6
- package/dist/websy-designs.js +222 -193
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
package/dist/websy-designs.js
CHANGED
|
@@ -649,7 +649,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
649
649
|
}
|
|
650
650
|
} else {
|
|
651
651
|
if (this.options.mode === 'hour') {
|
|
652
|
-
var _hoursOut = this.
|
|
652
|
+
var _hoursOut = this.currentselection.map(function (h) {
|
|
653
653
|
return _this4.options.hours[h];
|
|
654
654
|
});
|
|
655
655
|
|
|
@@ -1265,19 +1265,47 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1265
1265
|
}
|
|
1266
1266
|
}, {
|
|
1267
1267
|
key: "selectCustomRange",
|
|
1268
|
-
value: function selectCustomRange(
|
|
1268
|
+
value: function selectCustomRange(rangeInput) {
|
|
1269
|
+
var _this8 = this;
|
|
1270
|
+
|
|
1269
1271
|
this.selectedRange = -1;
|
|
1270
|
-
|
|
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
|
+
} // check if the custom range matches a configured range
|
|
1299
|
+
|
|
1272
1300
|
|
|
1273
1301
|
for (var i = 0; i < this.options.ranges[this.options.mode].length; i++) {
|
|
1274
1302
|
if (this.options.ranges[this.options.mode][i].range.length === 1) {
|
|
1275
|
-
if (this.options.ranges[this.options.mode][i].range[0] ===
|
|
1303
|
+
if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0]) {
|
|
1276
1304
|
this.selectedRange = i;
|
|
1277
1305
|
break;
|
|
1278
1306
|
}
|
|
1279
1307
|
} else if (this.options.ranges[this.options.mode][i].range.length === 2) {
|
|
1280
|
-
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]) {
|
|
1281
1309
|
this.selectedRange = i;
|
|
1282
1310
|
break;
|
|
1283
1311
|
}
|
|
@@ -1311,27 +1339,27 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1311
1339
|
}, {
|
|
1312
1340
|
key: "updateRange",
|
|
1313
1341
|
value: function updateRange() {
|
|
1314
|
-
var
|
|
1342
|
+
var _this9 = this;
|
|
1315
1343
|
|
|
1316
1344
|
var range;
|
|
1317
1345
|
|
|
1318
1346
|
if (this.selectedRange === -1) {
|
|
1319
1347
|
var list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(function (d) {
|
|
1320
|
-
if (
|
|
1348
|
+
if (_this9.options.mode === 'date') {
|
|
1321
1349
|
if (!d.toLocaleDateString) {
|
|
1322
1350
|
d = new Date(d);
|
|
1323
1351
|
}
|
|
1324
1352
|
|
|
1325
1353
|
return d.toLocaleDateString();
|
|
1326
|
-
} else if (
|
|
1354
|
+
} else if (_this9.options.mode === 'year') {
|
|
1327
1355
|
return d;
|
|
1328
|
-
} else if (
|
|
1356
|
+
} else if (_this9.options.mode === 'monthyear') {
|
|
1329
1357
|
if (!d.getMonth) {
|
|
1330
1358
|
d = new Date(d);
|
|
1331
1359
|
}
|
|
1332
1360
|
|
|
1333
|
-
return "".concat(
|
|
1334
|
-
} else if (
|
|
1361
|
+
return "".concat(_this9.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
1362
|
+
} else if (_this9.options.mode === 'hour') {
|
|
1335
1363
|
return d;
|
|
1336
1364
|
}
|
|
1337
1365
|
});
|
|
@@ -1342,6 +1370,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1342
1370
|
end = " - ".concat(list[list.length - 1]);
|
|
1343
1371
|
|
|
1344
1372
|
if (this.options.mode === 'hour') {
|
|
1373
|
+
start = this.options.hours[start].text;
|
|
1345
1374
|
end = "".concat(this.customRangeSelected === true ? ' - ' : '').concat(this.options.hours[list[list.length - 1]].text);
|
|
1346
1375
|
}
|
|
1347
1376
|
} else {
|
|
@@ -1390,7 +1419,7 @@ Date.prototype.floor = function () {
|
|
|
1390
1419
|
|
|
1391
1420
|
var WebsyDropdown = /*#__PURE__*/function () {
|
|
1392
1421
|
function WebsyDropdown(elementId, options) {
|
|
1393
|
-
var
|
|
1422
|
+
var _this10 = this;
|
|
1394
1423
|
|
|
1395
1424
|
_classCallCheck(this, WebsyDropdown);
|
|
1396
1425
|
|
|
@@ -1434,10 +1463,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1434
1463
|
el.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
1435
1464
|
el.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
1436
1465
|
var headerLabel = this.selectedItems.map(function (s) {
|
|
1437
|
-
return
|
|
1466
|
+
return _this10.options.items[s].label || _this10.options.items[s].value;
|
|
1438
1467
|
}).join(this.options.multiValueDelimiter);
|
|
1439
1468
|
var headerValue = this.selectedItems.map(function (s) {
|
|
1440
|
-
return
|
|
1469
|
+
return _this10.options.items[s].value || _this10.options.items[s].label;
|
|
1441
1470
|
}).join(this.options.multiValueDelimiter);
|
|
1442
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 ");
|
|
1443
1472
|
|
|
@@ -1720,10 +1749,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1720
1749
|
}, {
|
|
1721
1750
|
key: "renderItems",
|
|
1722
1751
|
value: function renderItems() {
|
|
1723
|
-
var
|
|
1752
|
+
var _this11 = this;
|
|
1724
1753
|
|
|
1725
1754
|
var html = this.options.items.map(function (r, i) {
|
|
1726
|
-
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 ");
|
|
1727
1756
|
}).join('');
|
|
1728
1757
|
var el = document.getElementById("".concat(this.elementId, "_items"));
|
|
1729
1758
|
|
|
@@ -1742,7 +1771,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1742
1771
|
}, {
|
|
1743
1772
|
key: "updateHeader",
|
|
1744
1773
|
value: function updateHeader(item) {
|
|
1745
|
-
var
|
|
1774
|
+
var _this12 = this;
|
|
1746
1775
|
|
|
1747
1776
|
var el = document.getElementById(this.elementId);
|
|
1748
1777
|
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
@@ -1789,17 +1818,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1789
1818
|
} else if (this.selectedItems.length > 1) {
|
|
1790
1819
|
if (this.options.showCompleteSelectedList === true) {
|
|
1791
1820
|
var selectedLabels = this.selectedItems.map(function (s) {
|
|
1792
|
-
return
|
|
1821
|
+
return _this12.options.items[s].label || _this12.options.items[s].value;
|
|
1793
1822
|
}).join(this.options.multiValueDelimiter);
|
|
1794
1823
|
var selectedValues = this.selectedItems.map(function (s) {
|
|
1795
|
-
return
|
|
1824
|
+
return _this12.options.items[s].value || _this12.options.items[s].label;
|
|
1796
1825
|
}).join(this.options.multiValueDelimiter);
|
|
1797
1826
|
labelEl.innerHTML = selectedLabels;
|
|
1798
1827
|
labelEl.setAttribute('data-info', selectedLabels);
|
|
1799
1828
|
inputEl.value = selectedValues;
|
|
1800
1829
|
} else {
|
|
1801
1830
|
var _selectedValues = this.selectedItems.map(function (s) {
|
|
1802
|
-
return
|
|
1831
|
+
return _this12.options.items[s].value || _this12.options.items[s].label;
|
|
1803
1832
|
}).join(this.options.multiValueDelimiter);
|
|
1804
1833
|
|
|
1805
1834
|
labelEl.innerHTML = "".concat(this.selectedItems.length, " selected");
|
|
@@ -1936,16 +1965,16 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1936
1965
|
}, {
|
|
1937
1966
|
key: "checkRecaptcha",
|
|
1938
1967
|
value: function checkRecaptcha() {
|
|
1939
|
-
var
|
|
1968
|
+
var _this13 = this;
|
|
1940
1969
|
|
|
1941
1970
|
return new Promise(function (resolve, reject) {
|
|
1942
|
-
if (
|
|
1971
|
+
if (_this13.options.useRecaptcha === true) {
|
|
1943
1972
|
// if (this.recaptchaValue) {
|
|
1944
1973
|
grecaptcha.ready(function () {
|
|
1945
1974
|
grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
|
|
1946
1975
|
action: 'submit'
|
|
1947
1976
|
}).then(function (token) {
|
|
1948
|
-
|
|
1977
|
+
_this13.apiService.add('google/checkrecaptcha', {
|
|
1949
1978
|
grecaptcharesponse: token
|
|
1950
1979
|
}).then(function (response) {
|
|
1951
1980
|
if (response.success && response.success === true) {
|
|
@@ -2008,14 +2037,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2008
2037
|
}, {
|
|
2009
2038
|
key: "processComponents",
|
|
2010
2039
|
value: function processComponents(components, callbackFn) {
|
|
2011
|
-
var
|
|
2040
|
+
var _this14 = this;
|
|
2012
2041
|
|
|
2013
2042
|
if (components.length === 0) {
|
|
2014
2043
|
callbackFn();
|
|
2015
2044
|
} else {
|
|
2016
2045
|
components.forEach(function (c) {
|
|
2017
2046
|
if (typeof WebsyDesigns[c.component] !== 'undefined') {
|
|
2018
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
2047
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this14.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
2019
2048
|
} else {// some user feedback here
|
|
2020
2049
|
}
|
|
2021
2050
|
});
|
|
@@ -2036,7 +2065,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2036
2065
|
}, {
|
|
2037
2066
|
key: "render",
|
|
2038
2067
|
value: function render(update, data) {
|
|
2039
|
-
var
|
|
2068
|
+
var _this15 = this;
|
|
2040
2069
|
|
|
2041
2070
|
var el = document.getElementById(this.elementId);
|
|
2042
2071
|
var componentsToProcess = [];
|
|
@@ -2046,11 +2075,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2046
2075
|
this.options.fields.forEach(function (f, i) {
|
|
2047
2076
|
if (f.component) {
|
|
2048
2077
|
componentsToProcess.push(f);
|
|
2049
|
-
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 ");
|
|
2050
2079
|
} else if (f.type === 'longtext') {
|
|
2051
|
-
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 ");
|
|
2052
2081
|
} else {
|
|
2053
|
-
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 ");
|
|
2054
2083
|
}
|
|
2055
2084
|
});
|
|
2056
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 ");
|
|
@@ -2067,7 +2096,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2067
2096
|
|
|
2068
2097
|
el.innerHTML = html;
|
|
2069
2098
|
this.processComponents(componentsToProcess, function () {
|
|
2070
|
-
if (
|
|
2099
|
+
if (_this15.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
|
|
2071
2100
|
}
|
|
2072
2101
|
});
|
|
2073
2102
|
}
|
|
@@ -2075,7 +2104,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2075
2104
|
}, {
|
|
2076
2105
|
key: "submitForm",
|
|
2077
2106
|
value: function submitForm() {
|
|
2078
|
-
var
|
|
2107
|
+
var _this16 = this;
|
|
2079
2108
|
|
|
2080
2109
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2081
2110
|
|
|
@@ -2089,32 +2118,32 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2089
2118
|
data[key] = value;
|
|
2090
2119
|
});
|
|
2091
2120
|
|
|
2092
|
-
if (
|
|
2093
|
-
var
|
|
2121
|
+
if (_this16.options.url) {
|
|
2122
|
+
var _this16$apiService;
|
|
2094
2123
|
|
|
2095
|
-
var params = [
|
|
2124
|
+
var params = [_this16.options.url];
|
|
2096
2125
|
|
|
2097
|
-
if (
|
|
2098
|
-
params.push(
|
|
2126
|
+
if (_this16.options.mode === 'update') {
|
|
2127
|
+
params.push(_this16.options.id);
|
|
2099
2128
|
}
|
|
2100
2129
|
|
|
2101
2130
|
params.push(data);
|
|
2102
2131
|
|
|
2103
|
-
(
|
|
2104
|
-
if (
|
|
2132
|
+
(_this16$apiService = _this16.apiService)[_this16.options.mode].apply(_this16$apiService, params).then(function (result) {
|
|
2133
|
+
if (_this16.options.clearAfterSave === true) {
|
|
2105
2134
|
// this.render()
|
|
2106
2135
|
formEl.reset();
|
|
2107
2136
|
}
|
|
2108
2137
|
|
|
2109
|
-
|
|
2138
|
+
_this16.options.onSuccess.call(_this16, result);
|
|
2110
2139
|
}, function (err) {
|
|
2111
2140
|
console.log('Error submitting form data:', err);
|
|
2112
2141
|
|
|
2113
|
-
|
|
2142
|
+
_this16.options.onError.call(_this16, err);
|
|
2114
2143
|
});
|
|
2115
|
-
} else if (
|
|
2116
|
-
|
|
2117
|
-
if (
|
|
2144
|
+
} else if (_this16.options.submitFn) {
|
|
2145
|
+
_this16.options.submitFn(data, function () {
|
|
2146
|
+
if (_this16.options.clearAfterSave === true) {
|
|
2118
2147
|
// this.render()
|
|
2119
2148
|
formEl.reset();
|
|
2120
2149
|
}
|
|
@@ -2134,17 +2163,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2134
2163
|
}, {
|
|
2135
2164
|
key: "data",
|
|
2136
2165
|
set: function set(d) {
|
|
2137
|
-
var
|
|
2166
|
+
var _this17 = this;
|
|
2138
2167
|
|
|
2139
2168
|
if (!this.options.fields) {
|
|
2140
2169
|
this.options.fields = [];
|
|
2141
2170
|
}
|
|
2142
2171
|
|
|
2143
2172
|
var _loop = function _loop(key) {
|
|
2144
|
-
|
|
2173
|
+
_this17.options.fields.forEach(function (f) {
|
|
2145
2174
|
if (f.field === key) {
|
|
2146
2175
|
f.value = d[key];
|
|
2147
|
-
var el = document.getElementById("".concat(
|
|
2176
|
+
var el = document.getElementById("".concat(_this17.elementId, "_input_").concat(f.field));
|
|
2148
2177
|
el.value = f.value;
|
|
2149
2178
|
}
|
|
2150
2179
|
});
|
|
@@ -2523,7 +2552,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2523
2552
|
|
|
2524
2553
|
var Pager = /*#__PURE__*/function () {
|
|
2525
2554
|
function Pager(elementId, options) {
|
|
2526
|
-
var
|
|
2555
|
+
var _this18 = this;
|
|
2527
2556
|
|
|
2528
2557
|
_classCallCheck(this, Pager);
|
|
2529
2558
|
|
|
@@ -2576,8 +2605,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2576
2605
|
allowClear: false,
|
|
2577
2606
|
disableSearch: true,
|
|
2578
2607
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
2579
|
-
if (
|
|
2580
|
-
|
|
2608
|
+
if (_this18.options.onChangePageSize) {
|
|
2609
|
+
_this18.options.onChangePageSize(selectedItem.value);
|
|
2581
2610
|
}
|
|
2582
2611
|
}
|
|
2583
2612
|
});
|
|
@@ -2601,13 +2630,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2601
2630
|
}, {
|
|
2602
2631
|
key: "render",
|
|
2603
2632
|
value: function render() {
|
|
2604
|
-
var
|
|
2633
|
+
var _this19 = this;
|
|
2605
2634
|
|
|
2606
2635
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
2607
2636
|
|
|
2608
2637
|
if (el) {
|
|
2609
2638
|
var pages = this.options.pages.map(function (item, index) {
|
|
2610
|
-
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>");
|
|
2611
2640
|
});
|
|
2612
2641
|
var startIndex = 0;
|
|
2613
2642
|
|
|
@@ -2675,58 +2704,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2675
2704
|
_createClass(WebsyPDFButton, [{
|
|
2676
2705
|
key: "handleClick",
|
|
2677
2706
|
value: function handleClick(event) {
|
|
2678
|
-
var
|
|
2707
|
+
var _this20 = this;
|
|
2679
2708
|
|
|
2680
2709
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
2681
2710
|
this.loader.show();
|
|
2682
2711
|
setTimeout(function () {
|
|
2683
|
-
if (
|
|
2684
|
-
var el = document.getElementById(
|
|
2712
|
+
if (_this20.options.targetId) {
|
|
2713
|
+
var el = document.getElementById(_this20.options.targetId);
|
|
2685
2714
|
|
|
2686
2715
|
if (el) {
|
|
2687
2716
|
var pdfData = {
|
|
2688
2717
|
options: {}
|
|
2689
2718
|
};
|
|
2690
2719
|
|
|
2691
|
-
if (
|
|
2692
|
-
pdfData.options = _extends({},
|
|
2720
|
+
if (_this20.options.pdfOptions) {
|
|
2721
|
+
pdfData.options = _extends({}, _this20.options.pdfOptions);
|
|
2693
2722
|
}
|
|
2694
2723
|
|
|
2695
|
-
if (
|
|
2696
|
-
if (
|
|
2697
|
-
var headerEl = document.getElementById(
|
|
2724
|
+
if (_this20.options.header) {
|
|
2725
|
+
if (_this20.options.header.elementId) {
|
|
2726
|
+
var headerEl = document.getElementById(_this20.options.header.elementId);
|
|
2698
2727
|
|
|
2699
2728
|
if (headerEl) {
|
|
2700
2729
|
pdfData.header = headerEl.outerHTML;
|
|
2701
2730
|
|
|
2702
|
-
if (
|
|
2703
|
-
pdfData.options.headerCSS =
|
|
2731
|
+
if (_this20.options.header.css) {
|
|
2732
|
+
pdfData.options.headerCSS = _this20.options.header.css;
|
|
2704
2733
|
}
|
|
2705
2734
|
}
|
|
2706
|
-
} else if (
|
|
2707
|
-
pdfData.header =
|
|
2735
|
+
} else if (_this20.options.header.html) {
|
|
2736
|
+
pdfData.header = _this20.options.header.html;
|
|
2708
2737
|
|
|
2709
|
-
if (
|
|
2710
|
-
pdfData.options.headerCSS =
|
|
2738
|
+
if (_this20.options.header.css) {
|
|
2739
|
+
pdfData.options.headerCSS = _this20.options.header.css;
|
|
2711
2740
|
}
|
|
2712
2741
|
} else {
|
|
2713
|
-
pdfData.header =
|
|
2742
|
+
pdfData.header = _this20.options.header;
|
|
2714
2743
|
}
|
|
2715
2744
|
}
|
|
2716
2745
|
|
|
2717
|
-
if (
|
|
2718
|
-
if (
|
|
2719
|
-
var footerEl = document.getElementById(
|
|
2746
|
+
if (_this20.options.footer) {
|
|
2747
|
+
if (_this20.options.footer.elementId) {
|
|
2748
|
+
var footerEl = document.getElementById(_this20.options.footer.elementId);
|
|
2720
2749
|
|
|
2721
2750
|
if (footerEl) {
|
|
2722
2751
|
pdfData.footer = footerEl.outerHTML;
|
|
2723
2752
|
|
|
2724
|
-
if (
|
|
2725
|
-
pdfData.options.footerCSS =
|
|
2753
|
+
if (_this20.options.footer.css) {
|
|
2754
|
+
pdfData.options.footerCSS = _this20.options.footer.css;
|
|
2726
2755
|
}
|
|
2727
2756
|
}
|
|
2728
2757
|
} else {
|
|
2729
|
-
pdfData.footer =
|
|
2758
|
+
pdfData.footer = _this20.options.footer;
|
|
2730
2759
|
}
|
|
2731
2760
|
}
|
|
2732
2761
|
|
|
@@ -2735,31 +2764,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2735
2764
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
2736
2765
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
2737
2766
|
|
|
2738
|
-
|
|
2767
|
+
_this20.service.add('', pdfData, {
|
|
2739
2768
|
responseType: 'blob'
|
|
2740
2769
|
}).then(function (response) {
|
|
2741
|
-
|
|
2770
|
+
_this20.loader.hide();
|
|
2742
2771
|
|
|
2743
2772
|
var blob = new Blob([response], {
|
|
2744
2773
|
type: 'application/pdf'
|
|
2745
2774
|
});
|
|
2746
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 ");
|
|
2747
2776
|
|
|
2748
|
-
if (
|
|
2777
|
+
if (_this20.options.directDownload === true) {
|
|
2749
2778
|
var fileName;
|
|
2750
2779
|
|
|
2751
|
-
if (typeof
|
|
2752
|
-
fileName =
|
|
2780
|
+
if (typeof _this20.options.fileName === 'function') {
|
|
2781
|
+
fileName = _this20.options.fileName() || 'Export';
|
|
2753
2782
|
} else {
|
|
2754
|
-
fileName =
|
|
2783
|
+
fileName = _this20.options.fileName || 'Export';
|
|
2755
2784
|
}
|
|
2756
2785
|
|
|
2757
2786
|
msg += "download='".concat(fileName, ".pdf'");
|
|
2758
2787
|
}
|
|
2759
2788
|
|
|
2760
|
-
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 ");
|
|
2761
2790
|
|
|
2762
|
-
|
|
2791
|
+
_this20.popup.show({
|
|
2763
2792
|
message: msg,
|
|
2764
2793
|
mask: true
|
|
2765
2794
|
});
|
|
@@ -2944,7 +2973,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
2944
2973
|
|
|
2945
2974
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
2946
2975
|
function ResponsiveText(elementId, options) {
|
|
2947
|
-
var
|
|
2976
|
+
var _this21 = this;
|
|
2948
2977
|
|
|
2949
2978
|
_classCallCheck(this, ResponsiveText);
|
|
2950
2979
|
|
|
@@ -2957,7 +2986,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
2957
2986
|
this.elementId = elementId;
|
|
2958
2987
|
this.canvas = document.createElement('canvas');
|
|
2959
2988
|
window.addEventListener('resize', function () {
|
|
2960
|
-
return
|
|
2989
|
+
return _this21.render();
|
|
2961
2990
|
});
|
|
2962
2991
|
var el = document.getElementById(this.elementId);
|
|
2963
2992
|
|
|
@@ -3176,7 +3205,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3176
3205
|
|
|
3177
3206
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3178
3207
|
function WebsyResultList(elementId, options) {
|
|
3179
|
-
var
|
|
3208
|
+
var _this22 = this;
|
|
3180
3209
|
|
|
3181
3210
|
_classCallCheck(this, WebsyResultList);
|
|
3182
3211
|
|
|
@@ -3204,9 +3233,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3204
3233
|
|
|
3205
3234
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3206
3235
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3207
|
-
|
|
3236
|
+
_this22.options.template = templateString;
|
|
3208
3237
|
|
|
3209
|
-
|
|
3238
|
+
_this22.render();
|
|
3210
3239
|
});
|
|
3211
3240
|
} else {
|
|
3212
3241
|
this.render();
|
|
@@ -3225,7 +3254,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3225
3254
|
}, {
|
|
3226
3255
|
key: "buildHTML",
|
|
3227
3256
|
value: function buildHTML(d) {
|
|
3228
|
-
var
|
|
3257
|
+
var _this23 = this;
|
|
3229
3258
|
|
|
3230
3259
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3231
3260
|
var html = "";
|
|
@@ -3233,7 +3262,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3233
3262
|
if (this.options.template) {
|
|
3234
3263
|
if (d.length > 0) {
|
|
3235
3264
|
d.forEach(function (row, ix) {
|
|
3236
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(
|
|
3265
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(_this23.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3237
3266
|
|
|
3238
3267
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3239
3268
|
|
|
@@ -3353,7 +3382,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3353
3382
|
}, {
|
|
3354
3383
|
key: "handleClick",
|
|
3355
3384
|
value: function handleClick(event) {
|
|
3356
|
-
var
|
|
3385
|
+
var _this24 = this;
|
|
3357
3386
|
|
|
3358
3387
|
if (event.target.classList.contains('clickable')) {
|
|
3359
3388
|
var l = event.target.getAttribute('data-event');
|
|
@@ -3371,8 +3400,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3371
3400
|
l = l[0];
|
|
3372
3401
|
params = params.map(function (p) {
|
|
3373
3402
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
3374
|
-
if (
|
|
3375
|
-
p =
|
|
3403
|
+
if (_this24.rows[+id]) {
|
|
3404
|
+
p = _this24.rows[+id][p];
|
|
3376
3405
|
}
|
|
3377
3406
|
} else if (typeof p === 'string') {
|
|
3378
3407
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -3394,13 +3423,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3394
3423
|
}, {
|
|
3395
3424
|
key: "render",
|
|
3396
3425
|
value: function render() {
|
|
3397
|
-
var
|
|
3426
|
+
var _this25 = this;
|
|
3398
3427
|
|
|
3399
3428
|
if (this.options.entity) {
|
|
3400
3429
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3401
|
-
|
|
3430
|
+
_this25.rows = results.rows;
|
|
3402
3431
|
|
|
3403
|
-
|
|
3432
|
+
_this25.resize();
|
|
3404
3433
|
});
|
|
3405
3434
|
} else {
|
|
3406
3435
|
this.resize();
|
|
@@ -3479,14 +3508,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3479
3508
|
_createClass(WebsyRouter, [{
|
|
3480
3509
|
key: "addGroup",
|
|
3481
3510
|
value: function addGroup(group) {
|
|
3482
|
-
var
|
|
3511
|
+
var _this26 = this;
|
|
3483
3512
|
|
|
3484
3513
|
if (!this.groups[group]) {
|
|
3485
3514
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3486
3515
|
|
|
3487
3516
|
if (els) {
|
|
3488
3517
|
this.getClosestParent(els[0], function (parent) {
|
|
3489
|
-
|
|
3518
|
+
_this26.groups[group] = {
|
|
3490
3519
|
activeView: '',
|
|
3491
3520
|
views: [],
|
|
3492
3521
|
parent: parent.getAttribute('data-view')
|
|
@@ -3811,12 +3840,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3811
3840
|
}, {
|
|
3812
3841
|
key: "showComponents",
|
|
3813
3842
|
value: function showComponents(view) {
|
|
3814
|
-
var
|
|
3843
|
+
var _this27 = this;
|
|
3815
3844
|
|
|
3816
3845
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
3817
3846
|
this.options.views[view].components.forEach(function (c) {
|
|
3818
3847
|
if (typeof c.instance === 'undefined') {
|
|
3819
|
-
|
|
3848
|
+
_this27.prepComponent(c.elementId, c.options);
|
|
3820
3849
|
|
|
3821
3850
|
c.instance = new c.Component(c.elementId, c.options);
|
|
3822
3851
|
} else if (c.instance.render) {
|
|
@@ -4244,7 +4273,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4244
4273
|
|
|
4245
4274
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4246
4275
|
function WebsyTemplate(elementId, options) {
|
|
4247
|
-
var
|
|
4276
|
+
var _this28 = this;
|
|
4248
4277
|
|
|
4249
4278
|
_classCallCheck(this, WebsyTemplate);
|
|
4250
4279
|
|
|
@@ -4270,9 +4299,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4270
4299
|
|
|
4271
4300
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4272
4301
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4273
|
-
|
|
4302
|
+
_this28.options.template = templateString;
|
|
4274
4303
|
|
|
4275
|
-
|
|
4304
|
+
_this28.render();
|
|
4276
4305
|
});
|
|
4277
4306
|
} else {
|
|
4278
4307
|
this.render();
|
|
@@ -4282,7 +4311,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4282
4311
|
_createClass(WebsyTemplate, [{
|
|
4283
4312
|
key: "buildHTML",
|
|
4284
4313
|
value: function buildHTML() {
|
|
4285
|
-
var
|
|
4314
|
+
var _this29 = this;
|
|
4286
4315
|
|
|
4287
4316
|
var html = "";
|
|
4288
4317
|
|
|
@@ -4344,14 +4373,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4344
4373
|
}
|
|
4345
4374
|
|
|
4346
4375
|
if (polarity === true) {
|
|
4347
|
-
if (typeof
|
|
4376
|
+
if (typeof _this29.options.data[parts[0]] !== 'undefined' && _this29.options.data[parts[0]] === parts[1]) {
|
|
4348
4377
|
// remove the <if> tags
|
|
4349
4378
|
removeAll = false;
|
|
4350
4379
|
} else if (parts[0] === parts[1]) {
|
|
4351
4380
|
removeAll = false;
|
|
4352
4381
|
}
|
|
4353
4382
|
} else if (polarity === false) {
|
|
4354
|
-
if (typeof
|
|
4383
|
+
if (typeof _this29.options.data[parts[0]] !== 'undefined' && _this29.options.data[parts[0]] !== parts[1]) {
|
|
4355
4384
|
// remove the <if> tags
|
|
4356
4385
|
removeAll = false;
|
|
4357
4386
|
}
|
|
@@ -4638,7 +4667,7 @@ var WebsyUtils = {
|
|
|
4638
4667
|
|
|
4639
4668
|
var WebsyTable = /*#__PURE__*/function () {
|
|
4640
4669
|
function WebsyTable(elementId, options) {
|
|
4641
|
-
var
|
|
4670
|
+
var _this30 = this;
|
|
4642
4671
|
|
|
4643
4672
|
_classCallCheck(this, WebsyTable);
|
|
4644
4673
|
|
|
@@ -4676,8 +4705,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4676
4705
|
allowClear: false,
|
|
4677
4706
|
disableSearch: true,
|
|
4678
4707
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4679
|
-
if (
|
|
4680
|
-
|
|
4708
|
+
if (_this30.options.onChangePageSize) {
|
|
4709
|
+
_this30.options.onChangePageSize(selectedItem.value);
|
|
4681
4710
|
}
|
|
4682
4711
|
}
|
|
4683
4712
|
});
|
|
@@ -4698,7 +4727,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4698
4727
|
_createClass(WebsyTable, [{
|
|
4699
4728
|
key: "appendRows",
|
|
4700
4729
|
value: function appendRows(data) {
|
|
4701
|
-
var
|
|
4730
|
+
var _this31 = this;
|
|
4702
4731
|
|
|
4703
4732
|
this.hideError();
|
|
4704
4733
|
var bodyHTML = '';
|
|
@@ -4706,15 +4735,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4706
4735
|
if (data) {
|
|
4707
4736
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4708
4737
|
return '<tr>' + r.map(function (c, i) {
|
|
4709
|
-
if (
|
|
4738
|
+
if (_this31.options.columns[i].show !== false) {
|
|
4710
4739
|
var style = '';
|
|
4711
4740
|
|
|
4712
4741
|
if (c.style) {
|
|
4713
4742
|
style += c.style;
|
|
4714
4743
|
}
|
|
4715
4744
|
|
|
4716
|
-
if (
|
|
4717
|
-
style += "width: ".concat(
|
|
4745
|
+
if (_this31.options.columns[i].width) {
|
|
4746
|
+
style += "width: ".concat(_this31.options.columns[i].width, "; ");
|
|
4718
4747
|
}
|
|
4719
4748
|
|
|
4720
4749
|
if (c.backgroundColor) {
|
|
@@ -4729,18 +4758,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4729
4758
|
style += "color: ".concat(c.color, "; ");
|
|
4730
4759
|
}
|
|
4731
4760
|
|
|
4732
|
-
if (
|
|
4733
|
-
return "\n <td \n data-row-index='".concat(
|
|
4734
|
-
} else if ((
|
|
4735
|
-
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 ");
|
|
4736
4765
|
} else {
|
|
4737
4766
|
var info = c.value;
|
|
4738
4767
|
|
|
4739
|
-
if (
|
|
4768
|
+
if (_this31.options.columns[i].showAsImage === true) {
|
|
4740
4769
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4741
4770
|
}
|
|
4742
4771
|
|
|
4743
|
-
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 ");
|
|
4744
4773
|
}
|
|
4745
4774
|
}
|
|
4746
4775
|
}).join('') + '</tr>';
|
|
@@ -4912,7 +4941,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4912
4941
|
}, {
|
|
4913
4942
|
key: "render",
|
|
4914
4943
|
value: function render(data) {
|
|
4915
|
-
var
|
|
4944
|
+
var _this32 = this;
|
|
4916
4945
|
|
|
4917
4946
|
if (!this.options.columns) {
|
|
4918
4947
|
return;
|
|
@@ -4937,7 +4966,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4937
4966
|
|
|
4938
4967
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
4939
4968
|
if (c.show !== false) {
|
|
4940
|
-
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 ");
|
|
4941
4970
|
}
|
|
4942
4971
|
}).join('') + '</tr>';
|
|
4943
4972
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -4956,7 +4985,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4956
4985
|
|
|
4957
4986
|
if (pagingEl) {
|
|
4958
4987
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
4959
|
-
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>");
|
|
4960
4989
|
});
|
|
4961
4990
|
var startIndex = 0;
|
|
4962
4991
|
|
|
@@ -5024,7 +5053,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5024
5053
|
|
|
5025
5054
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5026
5055
|
function WebsyTable2(elementId, options) {
|
|
5027
|
-
var
|
|
5056
|
+
var _this33 = this;
|
|
5028
5057
|
|
|
5029
5058
|
_classCallCheck(this, WebsyTable2);
|
|
5030
5059
|
|
|
@@ -5065,8 +5094,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5065
5094
|
allowClear: false,
|
|
5066
5095
|
disableSearch: true,
|
|
5067
5096
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5068
|
-
if (
|
|
5069
|
-
|
|
5097
|
+
if (_this33.options.onChangePageSize) {
|
|
5098
|
+
_this33.options.onChangePageSize(selectedItem.value);
|
|
5070
5099
|
}
|
|
5071
5100
|
}
|
|
5072
5101
|
});
|
|
@@ -5090,7 +5119,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5090
5119
|
_createClass(WebsyTable2, [{
|
|
5091
5120
|
key: "appendRows",
|
|
5092
5121
|
value: function appendRows(data) {
|
|
5093
|
-
var
|
|
5122
|
+
var _this34 = this;
|
|
5094
5123
|
|
|
5095
5124
|
this.hideError();
|
|
5096
5125
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -5099,15 +5128,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5099
5128
|
if (data) {
|
|
5100
5129
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5101
5130
|
return '<tr>' + r.map(function (c, i) {
|
|
5102
|
-
if (
|
|
5103
|
-
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;");
|
|
5104
5133
|
|
|
5105
5134
|
if (c.style) {
|
|
5106
5135
|
style += c.style;
|
|
5107
5136
|
}
|
|
5108
5137
|
|
|
5109
|
-
if (
|
|
5110
|
-
style += "width: ".concat(
|
|
5138
|
+
if (_this34.options.columns[i].width) {
|
|
5139
|
+
style += "width: ".concat(_this34.options.columns[i].width, "; ");
|
|
5111
5140
|
}
|
|
5112
5141
|
|
|
5113
5142
|
if (c.backgroundColor) {
|
|
@@ -5122,18 +5151,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5122
5151
|
style += "color: ".concat(c.color, "; ");
|
|
5123
5152
|
}
|
|
5124
5153
|
|
|
5125
|
-
if (
|
|
5126
|
-
return "\n <td \n data-row-index='".concat(
|
|
5127
|
-
} else if ((
|
|
5128
|
-
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 ");
|
|
5129
5158
|
} else {
|
|
5130
5159
|
var info = c.value;
|
|
5131
5160
|
|
|
5132
|
-
if (
|
|
5161
|
+
if (_this34.options.columns[i].showAsImage === true) {
|
|
5133
5162
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5134
5163
|
}
|
|
5135
5164
|
|
|
5136
|
-
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 ");
|
|
5137
5166
|
}
|
|
5138
5167
|
}
|
|
5139
5168
|
}).join('') + '</tr>';
|
|
@@ -5391,7 +5420,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5391
5420
|
}, {
|
|
5392
5421
|
key: "render",
|
|
5393
5422
|
value: function render(data) {
|
|
5394
|
-
var
|
|
5423
|
+
var _this35 = this;
|
|
5395
5424
|
|
|
5396
5425
|
if (!this.options.columns) {
|
|
5397
5426
|
return;
|
|
@@ -5427,7 +5456,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5427
5456
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5428
5457
|
}
|
|
5429
5458
|
|
|
5430
|
-
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 ");
|
|
5431
5460
|
}
|
|
5432
5461
|
}).join('') + '</tr>';
|
|
5433
5462
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5438,7 +5467,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5438
5467
|
var dropdownHTML = "";
|
|
5439
5468
|
this.options.columns.forEach(function (c, i) {
|
|
5440
5469
|
if (c.searchable && c.searchField) {
|
|
5441
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5470
|
+
dropdownHTML += "\n <div id=\"".concat(_this35.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
5442
5471
|
}
|
|
5443
5472
|
});
|
|
5444
5473
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5460,7 +5489,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5460
5489
|
|
|
5461
5490
|
if (pagingEl) {
|
|
5462
5491
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5463
|
-
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>");
|
|
5464
5493
|
});
|
|
5465
5494
|
var startIndex = 0;
|
|
5466
5495
|
|
|
@@ -5547,7 +5576,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5547
5576
|
}, {
|
|
5548
5577
|
key: "getColumnParameters",
|
|
5549
5578
|
value: function getColumnParameters(values) {
|
|
5550
|
-
var
|
|
5579
|
+
var _this36 = this;
|
|
5551
5580
|
|
|
5552
5581
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
5553
5582
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -5555,10 +5584,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5555
5584
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
5556
5585
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5557
5586
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
5558
|
-
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 ");
|
|
5559
5588
|
}).join('') + '</tr>';
|
|
5560
5589
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
5561
|
-
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 ");
|
|
5562
5591
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
5563
5592
|
|
|
5564
5593
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -5608,7 +5637,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5608
5637
|
|
|
5609
5638
|
var WebsyChart = /*#__PURE__*/function () {
|
|
5610
5639
|
function WebsyChart(elementId, options) {
|
|
5611
|
-
var
|
|
5640
|
+
var _this37 = this;
|
|
5612
5641
|
|
|
5613
5642
|
_classCallCheck(this, WebsyChart);
|
|
5614
5643
|
|
|
@@ -5657,22 +5686,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5657
5686
|
this.invertOverride = function (input, input2) {
|
|
5658
5687
|
var xAxis = 'bottomAxis';
|
|
5659
5688
|
|
|
5660
|
-
if (
|
|
5689
|
+
if (_this37.options.orientation === 'horizontal') {
|
|
5661
5690
|
xAxis = 'leftAxis';
|
|
5662
5691
|
}
|
|
5663
5692
|
|
|
5664
|
-
var width =
|
|
5693
|
+
var width = _this37[xAxis].step();
|
|
5665
5694
|
|
|
5666
5695
|
var output;
|
|
5667
5696
|
|
|
5668
|
-
var domain = _toConsumableArray(
|
|
5697
|
+
var domain = _toConsumableArray(_this37[xAxis].domain());
|
|
5669
5698
|
|
|
5670
|
-
if (
|
|
5699
|
+
if (_this37.options.orientation === 'horizontal') {
|
|
5671
5700
|
domain = domain.reverse();
|
|
5672
5701
|
}
|
|
5673
5702
|
|
|
5674
5703
|
for (var j = 0; j < domain.length; j++) {
|
|
5675
|
-
var breakA =
|
|
5704
|
+
var breakA = _this37[xAxis](domain[j]) - width / 2;
|
|
5676
5705
|
var breakB = breakA + width;
|
|
5677
5706
|
|
|
5678
5707
|
if (input > breakA && input <= breakB) {
|
|
@@ -5772,10 +5801,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5772
5801
|
}, {
|
|
5773
5802
|
key: "handleEventMouseMove",
|
|
5774
5803
|
value: function handleEventMouseMove(event, d) {
|
|
5775
|
-
var
|
|
5804
|
+
var _this38 = this;
|
|
5776
5805
|
|
|
5777
5806
|
var bisectDate = d3.bisector(function (d) {
|
|
5778
|
-
return
|
|
5807
|
+
return _this38.parseX(d.x.value);
|
|
5779
5808
|
}).left;
|
|
5780
5809
|
|
|
5781
5810
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -5814,8 +5843,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5814
5843
|
}
|
|
5815
5844
|
|
|
5816
5845
|
this.options.data.series.forEach(function (s) {
|
|
5817
|
-
if (
|
|
5818
|
-
xPoint =
|
|
5846
|
+
if (_this38.options.data[xData].scale !== 'Time') {
|
|
5847
|
+
xPoint = _this38[xAxis](_this38.parseX(xLabel));
|
|
5819
5848
|
s.data.forEach(function (d) {
|
|
5820
5849
|
if (d.x.value === xLabel) {
|
|
5821
5850
|
if (!tooltipTitle) {
|
|
@@ -5834,13 +5863,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5834
5863
|
var pointA = s.data[index - 1];
|
|
5835
5864
|
var pointB = s.data[index];
|
|
5836
5865
|
|
|
5837
|
-
if (
|
|
5866
|
+
if (_this38.options.orientation === 'horizontal') {
|
|
5838
5867
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
5839
5868
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
5840
5869
|
}
|
|
5841
5870
|
|
|
5842
5871
|
if (pointA && !pointB) {
|
|
5843
|
-
xPoint =
|
|
5872
|
+
xPoint = _this38[xAxis](_this38.parseX(pointA.x.value));
|
|
5844
5873
|
tooltipTitle = pointA.x.value;
|
|
5845
5874
|
|
|
5846
5875
|
if (!pointA.y.color) {
|
|
@@ -5850,12 +5879,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5850
5879
|
tooltipData.push(pointA.y);
|
|
5851
5880
|
|
|
5852
5881
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
5853
|
-
tooltipTitle = d3.timeFormat(
|
|
5882
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
5854
5883
|
}
|
|
5855
5884
|
}
|
|
5856
5885
|
|
|
5857
5886
|
if (pointB && !pointA) {
|
|
5858
|
-
xPoint =
|
|
5887
|
+
xPoint = _this38[xAxis](_this38.parseX(pointB.x.value));
|
|
5859
5888
|
tooltipTitle = pointB.x.value;
|
|
5860
5889
|
|
|
5861
5890
|
if (!pointB.y.color) {
|
|
@@ -5865,14 +5894,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5865
5894
|
tooltipData.push(pointB.y);
|
|
5866
5895
|
|
|
5867
5896
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5868
|
-
tooltipTitle = d3.timeFormat(
|
|
5897
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5869
5898
|
}
|
|
5870
5899
|
}
|
|
5871
5900
|
|
|
5872
5901
|
if (pointA && pointB) {
|
|
5873
|
-
var d0 =
|
|
5902
|
+
var d0 = _this38[xAxis](_this38.parseX(pointA.x.value));
|
|
5874
5903
|
|
|
5875
|
-
var d1 =
|
|
5904
|
+
var d1 = _this38[xAxis](_this38.parseX(pointB.x.value));
|
|
5876
5905
|
|
|
5877
5906
|
var mid = Math.abs(d0 - d1) / 2;
|
|
5878
5907
|
|
|
@@ -5881,7 +5910,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5881
5910
|
tooltipTitle = pointB.x.value;
|
|
5882
5911
|
|
|
5883
5912
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5884
|
-
tooltipTitle = d3.timeFormat(
|
|
5913
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5885
5914
|
}
|
|
5886
5915
|
|
|
5887
5916
|
if (!pointB.y.color) {
|
|
@@ -5894,7 +5923,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5894
5923
|
tooltipTitle = pointA.x.value;
|
|
5895
5924
|
|
|
5896
5925
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5897
|
-
tooltipTitle = d3.timeFormat(
|
|
5926
|
+
tooltipTitle = d3.timeFormat(_this38.options.dateFormat || _this38.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5898
5927
|
}
|
|
5899
5928
|
|
|
5900
5929
|
if (!pointA.y.color) {
|
|
@@ -5999,7 +6028,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5999
6028
|
}, {
|
|
6000
6029
|
key: "render",
|
|
6001
6030
|
value: function render(options) {
|
|
6002
|
-
var
|
|
6031
|
+
var _this39 = this;
|
|
6003
6032
|
|
|
6004
6033
|
/* global d3 options WebsyUtils */
|
|
6005
6034
|
if (typeof options !== 'undefined') {
|
|
@@ -6068,7 +6097,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6068
6097
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
6069
6098
|
return {
|
|
6070
6099
|
value: s.label || s.key,
|
|
6071
|
-
color: s.color ||
|
|
6100
|
+
color: s.color || _this39.options.colors[i % _this39.options.colors.length]
|
|
6072
6101
|
};
|
|
6073
6102
|
});
|
|
6074
6103
|
|
|
@@ -6320,7 +6349,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6320
6349
|
|
|
6321
6350
|
if (this.options.data.bottom.formatter) {
|
|
6322
6351
|
bAxisFunc.tickFormat(function (d) {
|
|
6323
|
-
return
|
|
6352
|
+
return _this39.options.data.bottom.formatter(d);
|
|
6324
6353
|
});
|
|
6325
6354
|
}
|
|
6326
6355
|
|
|
@@ -6346,8 +6375,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6346
6375
|
|
|
6347
6376
|
if (this.options.margin.axisLeft > 0) {
|
|
6348
6377
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
6349
|
-
if (
|
|
6350
|
-
d =
|
|
6378
|
+
if (_this39.options.data.left.formatter) {
|
|
6379
|
+
d = _this39.options.data.left.formatter(d);
|
|
6351
6380
|
}
|
|
6352
6381
|
|
|
6353
6382
|
return d;
|
|
@@ -6384,8 +6413,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6384
6413
|
|
|
6385
6414
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
6386
6415
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
6387
|
-
if (
|
|
6388
|
-
d =
|
|
6416
|
+
if (_this39.options.data.right.formatter) {
|
|
6417
|
+
d = _this39.options.data.right.formatter(d);
|
|
6389
6418
|
}
|
|
6390
6419
|
|
|
6391
6420
|
return d;
|
|
@@ -6411,16 +6440,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6411
6440
|
|
|
6412
6441
|
this.options.data.series.forEach(function (series, index) {
|
|
6413
6442
|
if (!series.key) {
|
|
6414
|
-
series.key =
|
|
6443
|
+
series.key = _this39.createIdentity();
|
|
6415
6444
|
}
|
|
6416
6445
|
|
|
6417
6446
|
if (!series.color) {
|
|
6418
|
-
series.color =
|
|
6447
|
+
series.color = _this39.options.colors[index % _this39.options.colors.length];
|
|
6419
6448
|
}
|
|
6420
6449
|
|
|
6421
|
-
|
|
6450
|
+
_this39["render".concat(series.type || 'bar')](series, index);
|
|
6422
6451
|
|
|
6423
|
-
|
|
6452
|
+
_this39.renderLabels(series, index);
|
|
6424
6453
|
});
|
|
6425
6454
|
}
|
|
6426
6455
|
}
|
|
@@ -6428,17 +6457,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6428
6457
|
}, {
|
|
6429
6458
|
key: "renderarea",
|
|
6430
6459
|
value: function renderarea(series, index) {
|
|
6431
|
-
var
|
|
6460
|
+
var _this40 = this;
|
|
6432
6461
|
|
|
6433
6462
|
/* global d3 series index */
|
|
6434
6463
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
6435
6464
|
return d3.area().x(function (d) {
|
|
6436
|
-
return
|
|
6465
|
+
return _this40[xAxis](_this40.parseX(d.x.value));
|
|
6437
6466
|
}).y0(function (d) {
|
|
6438
|
-
return
|
|
6467
|
+
return _this40[yAxis](0);
|
|
6439
6468
|
}).y1(function (d) {
|
|
6440
|
-
return
|
|
6441
|
-
}).curve(d3[curveStyle ||
|
|
6469
|
+
return _this40[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6470
|
+
}).curve(d3[curveStyle || _this40.options.curveStyle]);
|
|
6442
6471
|
};
|
|
6443
6472
|
|
|
6444
6473
|
var xAxis = 'bottomAxis';
|
|
@@ -6613,15 +6642,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6613
6642
|
}, {
|
|
6614
6643
|
key: "renderline",
|
|
6615
6644
|
value: function renderline(series, index) {
|
|
6616
|
-
var
|
|
6645
|
+
var _this41 = this;
|
|
6617
6646
|
|
|
6618
6647
|
/* global series index d3 */
|
|
6619
6648
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
6620
6649
|
return d3.line().x(function (d) {
|
|
6621
|
-
return
|
|
6650
|
+
return _this41[xAxis](_this41.parseX(d.x.value));
|
|
6622
6651
|
}).y(function (d) {
|
|
6623
|
-
return
|
|
6624
|
-
}).curve(d3[curveStyle ||
|
|
6652
|
+
return _this41[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6653
|
+
}).curve(d3[curveStyle || _this41.options.curveStyle]);
|
|
6625
6654
|
};
|
|
6626
6655
|
|
|
6627
6656
|
var xAxis = 'bottomAxis';
|
|
@@ -6659,14 +6688,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6659
6688
|
}, {
|
|
6660
6689
|
key: "rendersymbol",
|
|
6661
6690
|
value: function rendersymbol(series, index) {
|
|
6662
|
-
var
|
|
6691
|
+
var _this42 = this;
|
|
6663
6692
|
|
|
6664
6693
|
/* global d3 series index series.key */
|
|
6665
6694
|
var drawSymbol = function drawSymbol(size) {
|
|
6666
6695
|
return d3.symbol() // .type(d => {
|
|
6667
6696
|
// return d3.symbols[0]
|
|
6668
6697
|
// })
|
|
6669
|
-
.size(size ||
|
|
6698
|
+
.size(size || _this42.options.symbolSize);
|
|
6670
6699
|
};
|
|
6671
6700
|
|
|
6672
6701
|
var xAxis = 'bottomAxis';
|
|
@@ -6684,7 +6713,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6684
6713
|
symbols.attr('d', function (d) {
|
|
6685
6714
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
6686
6715
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
6687
|
-
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), ")");
|
|
6688
6717
|
}); // Enter
|
|
6689
6718
|
|
|
6690
6719
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -6693,7 +6722,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6693
6722
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
6694
6723
|
return "symbol symbol_".concat(series.key);
|
|
6695
6724
|
}).attr('transform', function (d) {
|
|
6696
|
-
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), ")");
|
|
6697
6726
|
});
|
|
6698
6727
|
}
|
|
6699
6728
|
}, {
|
|
@@ -6848,7 +6877,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6848
6877
|
}, {
|
|
6849
6878
|
key: "resize",
|
|
6850
6879
|
value: function resize() {
|
|
6851
|
-
var
|
|
6880
|
+
var _this43 = this;
|
|
6852
6881
|
|
|
6853
6882
|
var el = document.getElementById(this.elementId);
|
|
6854
6883
|
|
|
@@ -6861,7 +6890,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6861
6890
|
// }
|
|
6862
6891
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
6863
6892
|
html += this._data.map(function (d, i) {
|
|
6864
|
-
return
|
|
6893
|
+
return _this43.getLegendItemHTML(d);
|
|
6865
6894
|
}).join('');
|
|
6866
6895
|
html += "\n <div>\n ";
|
|
6867
6896
|
el.innerHTML = html;
|
|
@@ -7033,7 +7062,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7033
7062
|
}, {
|
|
7034
7063
|
key: "render",
|
|
7035
7064
|
value: function render() {
|
|
7036
|
-
var
|
|
7065
|
+
var _this44 = this;
|
|
7037
7066
|
|
|
7038
7067
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
7039
7068
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -7042,7 +7071,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7042
7071
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
7043
7072
|
return {
|
|
7044
7073
|
value: s.label || s.key,
|
|
7045
|
-
color: s.color ||
|
|
7074
|
+
color: s.color || _this44.options.colors[i % _this44.options.colors.length]
|
|
7046
7075
|
};
|
|
7047
7076
|
});
|
|
7048
7077
|
var longestValue = legendData.map(function (s) {
|
|
@@ -7106,7 +7135,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7106
7135
|
|
|
7107
7136
|
if (this.polygons) {
|
|
7108
7137
|
this.polygons.forEach(function (p) {
|
|
7109
|
-
return
|
|
7138
|
+
return _this44.map.removeLayer(p);
|
|
7110
7139
|
});
|
|
7111
7140
|
}
|
|
7112
7141
|
|
|
@@ -7164,18 +7193,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7164
7193
|
}
|
|
7165
7194
|
|
|
7166
7195
|
if (!p.options.color) {
|
|
7167
|
-
p.options.color =
|
|
7196
|
+
p.options.color = _this44.options.colors[i % _this44.options.colors.length];
|
|
7168
7197
|
}
|
|
7169
7198
|
|
|
7170
7199
|
var pol = L.polygon(p.data.map(function (c) {
|
|
7171
7200
|
return c.map(function (d) {
|
|
7172
7201
|
return [d.Latitude, d.Longitude];
|
|
7173
7202
|
});
|
|
7174
|
-
}), p.options).addTo(
|
|
7203
|
+
}), p.options).addTo(_this44.map);
|
|
7175
7204
|
|
|
7176
|
-
|
|
7205
|
+
_this44.polygons.push(pol);
|
|
7177
7206
|
|
|
7178
|
-
|
|
7207
|
+
_this44.map.fitBounds(pol.getBounds());
|
|
7179
7208
|
});
|
|
7180
7209
|
} // if (this.data.markers.length > 0) {
|
|
7181
7210
|
// el.classList.remove('hidden')
|