@websy/websy-designs 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/helpers/v1/pgHelper.js +6 -6
- package/dist/websy-designs-es6.debug.js +245 -148
- package/dist/websy-designs-es6.js +397 -270
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +285 -171
- package/dist/websy-designs.js +441 -285
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
package/dist/websy-designs.js
CHANGED
|
@@ -66,7 +66,9 @@ var APIService = /*#__PURE__*/function () {
|
|
|
66
66
|
_classCallCheck(this, APIService);
|
|
67
67
|
|
|
68
68
|
this.baseUrl = baseUrl;
|
|
69
|
-
this.options = _extends({},
|
|
69
|
+
this.options = _extends({}, {
|
|
70
|
+
fieldValueSeparator: ':'
|
|
71
|
+
}, options);
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
_createClass(APIService, [{
|
|
@@ -84,7 +86,7 @@ var APIService = /*#__PURE__*/function () {
|
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
if (id) {
|
|
87
|
-
query.push("id
|
|
89
|
+
query.push("id".concat(this.options.fieldValueSeparator).concat(id));
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
return "".concat(this.baseUrl, "/").concat(entity).concat(query.length > 0 ? "".concat(entity.indexOf('?') === -1 ? '?' : '&', "where=").concat(query.join(';')) : '');
|
|
@@ -341,6 +343,11 @@ var WebsyCarousel = /*#__PURE__*/function () {
|
|
|
341
343
|
}
|
|
342
344
|
|
|
343
345
|
_createClass(WebsyCarousel, [{
|
|
346
|
+
key: "close",
|
|
347
|
+
value: function close() {
|
|
348
|
+
this.pause();
|
|
349
|
+
}
|
|
350
|
+
}, {
|
|
344
351
|
key: "handleClick",
|
|
345
352
|
value: function handleClick(event) {
|
|
346
353
|
if (event.target.classList.contains('websy-next-arrow')) {
|
|
@@ -453,7 +460,7 @@ var WebsyCarousel = /*#__PURE__*/function () {
|
|
|
453
460
|
}
|
|
454
461
|
|
|
455
462
|
if (this.options.showPrevNext === true && this.options.frames.length > 1) {
|
|
456
|
-
html += "\n
|
|
463
|
+
html += "\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"websy-prev-arrow\"\n viewBox=\"0 0 512 512\">\n <title>Caret Back</title>\n <path d=\"M321.94 98L158.82 237.78a24 24 0 000 36.44L321.94 414c15.57 13.34 39.62 2.28 39.62-18.22v-279.6c0-20.5-24.05-31.56-39.62-18.18z\"/>\n </svg>\n \n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" class=\"websy-next-arrow\">\n <title>Caret Forward</title>\n <path d=\"M190.06 414l163.12-139.78a24 24 0 000-36.44L190.06 98c-15.57-13.34-39.62-2.28-39.62 18.22v279.6c0 20.5 24.05 31.56 39.62 18.18z\"/>\n </svg>\n ";
|
|
457
464
|
}
|
|
458
465
|
|
|
459
466
|
html += "\n </div>\n ";
|
|
@@ -477,20 +484,35 @@ var WebsyCarousel = /*#__PURE__*/function () {
|
|
|
477
484
|
}
|
|
478
485
|
|
|
479
486
|
var prevF = document.getElementById("".concat(this.elementId, "_frame_").concat(prevFrameIndex));
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
487
|
+
|
|
488
|
+
if (prevF) {
|
|
489
|
+
setTimeout(function () {
|
|
490
|
+
prevF.style.transform = "translateX(".concat(prevTranslateX, ")");
|
|
491
|
+
}, 100);
|
|
492
|
+
}
|
|
493
|
+
|
|
483
494
|
var btnInactive = document.getElementById("".concat(this.elementId, "_selector_").concat(prevFrameIndex));
|
|
484
|
-
|
|
495
|
+
|
|
496
|
+
if (btnInactive) {
|
|
497
|
+
btnInactive.classList.remove('websy-progress-btn-active');
|
|
498
|
+
}
|
|
499
|
+
|
|
485
500
|
var newF = document.getElementById("".concat(this.elementId, "_frame_").concat(currFrameIndex));
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
newF.
|
|
490
|
-
|
|
491
|
-
|
|
501
|
+
|
|
502
|
+
if (newF) {
|
|
503
|
+
newF.classList.remove('animate');
|
|
504
|
+
newF.style.transform = "translateX(".concat(nextTranslateX, ")");
|
|
505
|
+
setTimeout(function () {
|
|
506
|
+
newF.classList.add('animate');
|
|
507
|
+
newF.style.transform = 'translateX(0%)';
|
|
508
|
+
}, 100);
|
|
509
|
+
}
|
|
510
|
+
|
|
492
511
|
var btnActive = document.getElementById("".concat(this.elementId, "_selector_").concat(currFrameIndex));
|
|
493
|
-
|
|
512
|
+
|
|
513
|
+
if (btnActive) {
|
|
514
|
+
btnActive.classList.add('websy-progress-btn-active');
|
|
515
|
+
}
|
|
494
516
|
} // showFrameSelector () {
|
|
495
517
|
// }
|
|
496
518
|
|
|
@@ -819,75 +841,103 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
819
841
|
}
|
|
820
842
|
|
|
821
843
|
if (this.customRangeSelected === true) {
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
if (this.options.mode === 'date') {
|
|
825
|
-
diff = Math.floor((this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime() - this.selectedRangeDates[0].getTime()) / this.oneDay); // if (this.selectedRangeDates[0].getMonth() !== this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth()) {
|
|
826
|
-
// diff += 1
|
|
827
|
-
// }
|
|
828
|
-
} else if (this.options.mode === 'year') {
|
|
829
|
-
diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
|
|
830
|
-
|
|
831
|
-
if (this.selectedRangeDates[this.selectedRangeDates.length - 1] !== this.selectedRangeDates[0]) {// diff += 1
|
|
832
|
-
}
|
|
833
|
-
} else if (this.options.mode === 'monthyear') {
|
|
834
|
-
var yearDiff = (this.selectedRangeDates[this.selectedRangeDates.length - 1].getFullYear() - this.selectedRangeDates[0].getFullYear()) * 12;
|
|
835
|
-
diff = Math.floor(this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth() - this.selectedRangeDates[0].getMonth()) + yearDiff;
|
|
836
|
-
} else if (this.options.mode === 'hour') {
|
|
837
|
-
diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
for (var _i = 0; _i < diff + 1; _i++) {
|
|
841
|
-
var d = void 0;
|
|
842
|
-
var rangeStart = void 0;
|
|
843
|
-
var rangeEnd = void 0;
|
|
844
|
+
if (this.isContinuousRange || this.mouseDown) {
|
|
845
|
+
var diff;
|
|
844
846
|
|
|
845
847
|
if (this.options.mode === 'date') {
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
rangeStart = this.selectedRangeDates[0].getTime();
|
|
851
|
-
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
848
|
+
diff = Math.floor((this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime() - this.selectedRangeDates[0].getTime()) / this.oneDay); // if (this.selectedRangeDates[0].getMonth() !== this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth()) {
|
|
849
|
+
// diff += 1
|
|
850
|
+
// }
|
|
852
851
|
} else if (this.options.mode === 'year') {
|
|
853
|
-
|
|
854
|
-
rangeStart = this.selectedRangeDates[0];
|
|
855
|
-
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
856
|
-
} else if (this.options.mode === 'monthyear') {
|
|
857
|
-
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + _i));
|
|
858
|
-
d = d.getTime();
|
|
859
|
-
console.log('highlighting', this.selectedRangeDates[0].getTime(), d);
|
|
860
|
-
rangeStart = this.selectedRangeDates[0].getTime();
|
|
861
|
-
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
862
|
-
} else if (this.options.mode === 'hour') {
|
|
863
|
-
d = this.selectedRangeDates[0] + _i;
|
|
864
|
-
rangeStart = this.selectedRangeDates[0];
|
|
865
|
-
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
var dateEl = void 0;
|
|
852
|
+
diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
|
|
869
853
|
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
} else if (this.options.mode === 'year') {
|
|
873
|
-
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_year"));
|
|
854
|
+
if (this.selectedRangeDates[this.selectedRangeDates.length - 1] !== this.selectedRangeDates[0]) {// diff += 1
|
|
855
|
+
}
|
|
874
856
|
} else if (this.options.mode === 'monthyear') {
|
|
875
|
-
|
|
857
|
+
var yearDiff = (this.selectedRangeDates[this.selectedRangeDates.length - 1].getFullYear() - this.selectedRangeDates[0].getFullYear()) * 12;
|
|
858
|
+
diff = Math.floor(this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth() - this.selectedRangeDates[0].getMonth()) + yearDiff;
|
|
876
859
|
} else if (this.options.mode === 'hour') {
|
|
877
|
-
|
|
878
|
-
}
|
|
860
|
+
diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
for (var _i = 0; _i < diff + 1; _i++) {
|
|
864
|
+
var d = void 0;
|
|
865
|
+
var rangeStart = void 0;
|
|
866
|
+
var rangeEnd = void 0;
|
|
867
|
+
|
|
868
|
+
if (this.options.mode === 'date') {
|
|
869
|
+
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + _i * this.oneDay)); // d.setUTCHours(12, 0, 0, 0)
|
|
870
|
+
|
|
871
|
+
d = d.getTime(); // console.log('highlighting', this.selectedRangeDates[0].getTime(), d)
|
|
872
|
+
|
|
873
|
+
rangeStart = this.selectedRangeDates[0].getTime();
|
|
874
|
+
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
875
|
+
} else if (this.options.mode === 'year') {
|
|
876
|
+
d = this.selectedRangeDates[0] + _i;
|
|
877
|
+
rangeStart = this.selectedRangeDates[0];
|
|
878
|
+
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
879
|
+
} else if (this.options.mode === 'monthyear') {
|
|
880
|
+
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + _i));
|
|
881
|
+
d = d.getTime();
|
|
882
|
+
console.log('highlighting', this.selectedRangeDates[0].getTime(), d);
|
|
883
|
+
rangeStart = this.selectedRangeDates[0].getTime();
|
|
884
|
+
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
885
|
+
} else if (this.options.mode === 'hour') {
|
|
886
|
+
d = this.selectedRangeDates[0] + _i;
|
|
887
|
+
rangeStart = this.selectedRangeDates[0];
|
|
888
|
+
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
889
|
+
}
|
|
879
890
|
|
|
880
|
-
|
|
881
|
-
dateEl.classList.add('selected');
|
|
891
|
+
var dateEl = void 0;
|
|
882
892
|
|
|
883
|
-
if (
|
|
884
|
-
dateEl.
|
|
893
|
+
if (this.options.mode === 'date') {
|
|
894
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_date"));
|
|
895
|
+
} else if (this.options.mode === 'year') {
|
|
896
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_year"));
|
|
897
|
+
} else if (this.options.mode === 'monthyear') {
|
|
898
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_monthyear"));
|
|
899
|
+
} else if (this.options.mode === 'hour') {
|
|
900
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_hour"));
|
|
885
901
|
}
|
|
886
902
|
|
|
887
|
-
if (
|
|
888
|
-
dateEl.classList.add(
|
|
903
|
+
if (dateEl) {
|
|
904
|
+
dateEl.classList.add('selected');
|
|
905
|
+
|
|
906
|
+
if (d === rangeStart) {
|
|
907
|
+
dateEl.classList.add("".concat(this.options.sortDirection === 'desc' ? 'last' : 'first'));
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
if (d === rangeEnd) {
|
|
911
|
+
dateEl.classList.add("".concat(this.options.sortDirection === 'desc' ? 'first' : 'last'));
|
|
912
|
+
}
|
|
889
913
|
}
|
|
890
914
|
}
|
|
915
|
+
} else {
|
|
916
|
+
this.selectedRangeDates.forEach(function (dIn) {
|
|
917
|
+
var d;
|
|
918
|
+
var suffix = '_date';
|
|
919
|
+
|
|
920
|
+
if (_this5.options.mode === 'date') {
|
|
921
|
+
d = _this5.floorDate(new Date(dIn.getTime()));
|
|
922
|
+
d = d.getTime();
|
|
923
|
+
} else if (_this5.options.mode === 'year') {
|
|
924
|
+
d = dIn;
|
|
925
|
+
suffix = '_year';
|
|
926
|
+
} else if (_this5.options.mode === 'monthyear') {
|
|
927
|
+
d = _this5.floorDate(new Date(dIn.getTime()).setMonth(dIn.getMonth()));
|
|
928
|
+
d = d.getTime();
|
|
929
|
+
suffix = '_monthyear';
|
|
930
|
+
} else if (_this5.options.mode === 'hour') {
|
|
931
|
+
d = dIn;
|
|
932
|
+
suffix = '_hour';
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
var dateEl = document.getElementById("".concat(_this5.elementId, "_").concat(d).concat(suffix));
|
|
936
|
+
|
|
937
|
+
if (dateEl) {
|
|
938
|
+
dateEl.classList.add('selected', 'first', 'last');
|
|
939
|
+
}
|
|
940
|
+
});
|
|
891
941
|
}
|
|
892
942
|
} else {
|
|
893
943
|
this.currentselection.forEach(function (d) {
|
|
@@ -1184,7 +1234,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1184
1234
|
} else if (this.options.mode === 'hour') {
|
|
1185
1235
|
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'><ul>");
|
|
1186
1236
|
html += this.options.hours.map(function (h) {
|
|
1187
|
-
return "<li id='".concat(_this6.elementId, "_").concat(+h.text.split(':')[0], "_hour' data-hour='").concat(h.text, "' class='websy-dp-date websy-dp-hour'>").concat(h.text, "</li>");
|
|
1237
|
+
return "<li id='".concat(_this6.elementId, "_").concat(+h.text.split(':')[0], "_hour' data-id='").concat(+h.text.split(':')[0], "' data-hour='").concat(h.text, "' class='websy-dp-date websy-dp-hour'>").concat(h.text, "</li>");
|
|
1188
1238
|
}).join('');
|
|
1189
1239
|
html += "</ul></div>";
|
|
1190
1240
|
}
|
|
@@ -1294,7 +1344,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1294
1344
|
var _this8 = this;
|
|
1295
1345
|
|
|
1296
1346
|
this.selectedRange = -1;
|
|
1297
|
-
|
|
1347
|
+
this.isContinuousRange = true; // if (rangeInput.length === 1) {
|
|
1298
1348
|
// this.selectedRangeDates = [...rangeInput]
|
|
1299
1349
|
// this.customRangeSelected = true
|
|
1300
1350
|
// }
|
|
@@ -1309,22 +1359,22 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1309
1359
|
if (i > 0) {
|
|
1310
1360
|
if (_this8.options.mode === 'date' || _this8.options.mode === 'monthyear') {
|
|
1311
1361
|
if (r.getTime() / _this8.oneDay - rangeInput[i - 1] / _this8.oneDay > 1) {
|
|
1312
|
-
isContinuousRange = false;
|
|
1362
|
+
_this8.isContinuousRange = false;
|
|
1313
1363
|
}
|
|
1314
1364
|
} else if (_this8.options.mode === 'hour' || _this8.options.mode === 'year') {
|
|
1315
1365
|
if (r - rangeInput[i - 1] > 1) {
|
|
1316
|
-
isContinuousRange = false;
|
|
1366
|
+
_this8.isContinuousRange = false;
|
|
1317
1367
|
}
|
|
1318
1368
|
}
|
|
1319
1369
|
}
|
|
1320
1370
|
});
|
|
1321
1371
|
|
|
1322
|
-
if (rangeInput.length > 2 && isContinuousRange === true) {
|
|
1372
|
+
if (rangeInput.length > 2 && this.isContinuousRange === true) {
|
|
1323
1373
|
this.selectedRangeDates = [rangeInput[0], rangeInput[rangeInput.length - 1]];
|
|
1324
1374
|
this.customRangeSelected = true;
|
|
1325
1375
|
}
|
|
1326
1376
|
|
|
1327
|
-
if (isContinuousRange === false) {
|
|
1377
|
+
if (this.isContinuousRange === false) {
|
|
1328
1378
|
this.currentselection = [];
|
|
1329
1379
|
} // check if the custom range matches a configured range
|
|
1330
1380
|
|
|
@@ -1419,7 +1469,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1419
1469
|
var start = list[0];
|
|
1420
1470
|
var end = '';
|
|
1421
1471
|
|
|
1422
|
-
if (this.customRangeSelected === true) {
|
|
1472
|
+
if (this.customRangeSelected === true && this.isContinuousRange === true) {
|
|
1423
1473
|
end = " - ".concat(list[list.length - 1]);
|
|
1424
1474
|
|
|
1425
1475
|
if (this.options.mode === 'hour') {
|
|
@@ -1512,8 +1562,9 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1512
1562
|
});
|
|
1513
1563
|
}
|
|
1514
1564
|
|
|
1565
|
+
this.searchText = '';
|
|
1515
1566
|
this.tooltipTimeoutFn = null;
|
|
1516
|
-
this._originalData =
|
|
1567
|
+
this._originalData = _toConsumableArray(this.options.items);
|
|
1517
1568
|
this.selectedItems = this.options.selectedItems || [];
|
|
1518
1569
|
|
|
1519
1570
|
if (!elementId) {
|
|
@@ -1656,6 +1707,8 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1656
1707
|
key: "handleKeyUp",
|
|
1657
1708
|
value: function handleKeyUp(event) {
|
|
1658
1709
|
if (event.target.classList.contains('websy-dropdown-search')) {
|
|
1710
|
+
this.searchText = event.target.value;
|
|
1711
|
+
|
|
1659
1712
|
if (this._originalData.length === 0) {
|
|
1660
1713
|
this._originalData = _toConsumableArray(this.options.items);
|
|
1661
1714
|
}
|
|
@@ -1852,6 +1905,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1852
1905
|
var itemEls = el.querySelectorAll(".websy-dropdown-item");
|
|
1853
1906
|
var dataToUse = this._originalData;
|
|
1854
1907
|
|
|
1908
|
+
if (this._originalData.length === 0 && this.searchText === '') {
|
|
1909
|
+
dataToUse = this.options.items;
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1855
1912
|
if (this.options.onSearch) {
|
|
1856
1913
|
dataToUse = this.options.items;
|
|
1857
1914
|
}
|
|
@@ -3744,6 +3801,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3744
3801
|
|
|
3745
3802
|
if (el) {
|
|
3746
3803
|
el.addEventListener('click', this.handleClick.bind(this));
|
|
3804
|
+
el.addEventListener('change', this.handleChange.bind(this));
|
|
3805
|
+
el.addEventListener('keyup', this.handleKeyUp.bind(this));
|
|
3806
|
+
el.addEventListener('keydown', this.handleKeyDown.bind(this));
|
|
3747
3807
|
}
|
|
3748
3808
|
|
|
3749
3809
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
@@ -3956,56 +4016,76 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3956
4016
|
key: "handleClick",
|
|
3957
4017
|
value: function handleClick(event) {
|
|
3958
4018
|
if (event.target.classList.contains('clickable')) {
|
|
3959
|
-
|
|
4019
|
+
this.handleEvent(event, 'clickable', 'click');
|
|
4020
|
+
}
|
|
4021
|
+
}
|
|
4022
|
+
}, {
|
|
4023
|
+
key: "handleChange",
|
|
4024
|
+
value: function handleChange(event) {
|
|
4025
|
+
this.handleEvent(event, 'keyable', 'change');
|
|
4026
|
+
}
|
|
4027
|
+
}, {
|
|
4028
|
+
key: "handleKeyUp",
|
|
4029
|
+
value: function handleKeyUp(event) {
|
|
4030
|
+
this.handleEvent(event, 'keyable', 'keyup');
|
|
4031
|
+
}
|
|
4032
|
+
}, {
|
|
4033
|
+
key: "handleKeyDown",
|
|
4034
|
+
value: function handleKeyDown(event) {
|
|
4035
|
+
this.handleEvent(event, 'keyable', 'keydown');
|
|
4036
|
+
}
|
|
4037
|
+
}, {
|
|
4038
|
+
key: "handleEvent",
|
|
4039
|
+
value: function handleEvent(event, eventType, action) {
|
|
4040
|
+
var l = event.target.getAttribute('data-event');
|
|
3960
4041
|
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
4042
|
+
if (l) {
|
|
4043
|
+
l = l.split('(');
|
|
4044
|
+
var params = [];
|
|
4045
|
+
var id = event.target.getAttribute('data-id');
|
|
4046
|
+
var locator = event.target.getAttribute('data-locator');
|
|
3966
4047
|
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
4048
|
+
if (l[1]) {
|
|
4049
|
+
l[1] = l[1].replace(')', '');
|
|
4050
|
+
params = l[1].split(',');
|
|
4051
|
+
}
|
|
3971
4052
|
|
|
3972
|
-
|
|
3973
|
-
|
|
4053
|
+
l = l[0];
|
|
4054
|
+
var data = this.rows;
|
|
3974
4055
|
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
4056
|
+
if (locator !== '') {
|
|
4057
|
+
var locatorItems = locator.split(';');
|
|
4058
|
+
locatorItems.forEach(function (loc) {
|
|
4059
|
+
var locatorParts = loc.split(':');
|
|
3979
4060
|
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
4061
|
+
if (data[locatorParts[0]]) {
|
|
4062
|
+
data = data[locatorParts[0]];
|
|
4063
|
+
var parts = locatorParts[1].split('.');
|
|
4064
|
+
parts.forEach(function (p) {
|
|
4065
|
+
data = data[p];
|
|
4066
|
+
});
|
|
4067
|
+
}
|
|
4068
|
+
});
|
|
4069
|
+
}
|
|
3989
4070
|
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
}
|
|
3995
|
-
} else if (typeof p === 'string') {
|
|
3996
|
-
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
4071
|
+
params = params.map(function (p) {
|
|
4072
|
+
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
4073
|
+
if (data[+id]) {
|
|
4074
|
+
p = data[+id][p];
|
|
3997
4075
|
}
|
|
4076
|
+
} else if (typeof p === 'string') {
|
|
4077
|
+
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
4078
|
+
}
|
|
3998
4079
|
|
|
3999
|
-
|
|
4000
|
-
|
|
4080
|
+
return p;
|
|
4081
|
+
});
|
|
4001
4082
|
|
|
4002
|
-
|
|
4003
|
-
|
|
4083
|
+
if (event.target.classList.contains(eventType) && this.options.listeners[action] && this.options.listeners[action][l]) {
|
|
4084
|
+
var _this$options$listene;
|
|
4004
4085
|
|
|
4005
|
-
|
|
4086
|
+
event.stopPropagation();
|
|
4006
4087
|
|
|
4007
|
-
|
|
4008
|
-
}
|
|
4088
|
+
(_this$options$listene = this.options.listeners[action][l]).call.apply(_this$options$listene, [this, event, data[+id]].concat(_toConsumableArray(params)));
|
|
4009
4089
|
}
|
|
4010
4090
|
}
|
|
4011
4091
|
}
|
|
@@ -4065,7 +4145,8 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4065
4145
|
show: [],
|
|
4066
4146
|
hide: []
|
|
4067
4147
|
},
|
|
4068
|
-
persistentParameters: false
|
|
4148
|
+
persistentParameters: false,
|
|
4149
|
+
fieldValueSeparator: ':'
|
|
4069
4150
|
};
|
|
4070
4151
|
this.triggerIdList = [];
|
|
4071
4152
|
this.viewIdList = [];
|
|
@@ -4134,6 +4215,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4134
4215
|
key: "addUrlParams",
|
|
4135
4216
|
value: function addUrlParams(params) {
|
|
4136
4217
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4218
|
+
var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
4137
4219
|
|
|
4138
4220
|
if (typeof params === 'undefined') {
|
|
4139
4221
|
return;
|
|
@@ -4159,14 +4241,47 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4159
4241
|
|
|
4160
4242
|
if (this.options.urlPrefix) {
|
|
4161
4243
|
inputPath = "/".concat(this.options.urlPrefix, "/").concat(inputPath);
|
|
4244
|
+
} // history.pushState({
|
|
4245
|
+
// inputPath
|
|
4246
|
+
// }, 'unused', `${inputPath}?${path}`)
|
|
4247
|
+
|
|
4248
|
+
|
|
4249
|
+
if (reloadView === true) {
|
|
4250
|
+
// this.showView(this.currentView, this.currentParams, 'main')
|
|
4251
|
+
this.navigate("".concat(inputPath, "?").concat(path), 'main', null, noHistory);
|
|
4162
4252
|
}
|
|
4253
|
+
}
|
|
4254
|
+
}, {
|
|
4255
|
+
key: "removeUrlParams",
|
|
4256
|
+
value: function removeUrlParams() {
|
|
4257
|
+
var _this27 = this;
|
|
4163
4258
|
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4259
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4260
|
+
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4261
|
+
var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
4262
|
+
this.previousParams = _extends({}, this.currentParams);
|
|
4263
|
+
var output = {
|
|
4264
|
+
path: '',
|
|
4265
|
+
items: {}
|
|
4266
|
+
};
|
|
4267
|
+
var path = '';
|
|
4268
|
+
|
|
4269
|
+
if (this.currentParams && this.currentParams.items) {
|
|
4270
|
+
params.forEach(function (p) {
|
|
4271
|
+
delete _this27.currentParams.items[p];
|
|
4272
|
+
});
|
|
4273
|
+
path = this.buildUrlPath(this.currentParams.items);
|
|
4274
|
+
}
|
|
4275
|
+
|
|
4276
|
+
var inputPath = this.currentView;
|
|
4277
|
+
|
|
4278
|
+
if (this.options.urlPrefix) {
|
|
4279
|
+
inputPath = "/".concat(this.options.urlPrefix, "/").concat(inputPath);
|
|
4280
|
+
}
|
|
4167
4281
|
|
|
4168
4282
|
if (reloadView === true) {
|
|
4169
|
-
this.showView(this.currentView, this.currentParams, 'main')
|
|
4283
|
+
// this.showView(this.currentView, this.currentParams, 'main')
|
|
4284
|
+
this.navigate("".concat(inputPath, "?").concat(path), 'main', null, noHistory);
|
|
4170
4285
|
}
|
|
4171
4286
|
}
|
|
4172
4287
|
}, {
|
|
@@ -4270,6 +4385,38 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4270
4385
|
|
|
4271
4386
|
return views;
|
|
4272
4387
|
}
|
|
4388
|
+
}, {
|
|
4389
|
+
key: "getParamValues",
|
|
4390
|
+
value: function getParamValues(param) {
|
|
4391
|
+
var output = [];
|
|
4392
|
+
|
|
4393
|
+
if (this.currentParams && this.currentParams.items && this.currentParams.items[param] && this.currentParams.items[param] !== '') {
|
|
4394
|
+
return this.currentParams.items[param].split('|').map(function (d) {
|
|
4395
|
+
return decodeURI(d);
|
|
4396
|
+
});
|
|
4397
|
+
}
|
|
4398
|
+
|
|
4399
|
+
return output;
|
|
4400
|
+
}
|
|
4401
|
+
}, {
|
|
4402
|
+
key: "getAPIQuery",
|
|
4403
|
+
value: function getAPIQuery() {
|
|
4404
|
+
var ignoredParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4405
|
+
|
|
4406
|
+
if (this.currentParams && this.currentParams.items) {
|
|
4407
|
+
var query = [];
|
|
4408
|
+
|
|
4409
|
+
for (var key in this.currentParams.items) {
|
|
4410
|
+
if (ignoredParams.indexOf(key) === -1) {
|
|
4411
|
+
query.push("".concat(key).concat(this.options.fieldValueSeparator).concat(this.currentParams.items[key]));
|
|
4412
|
+
}
|
|
4413
|
+
}
|
|
4414
|
+
|
|
4415
|
+
return query;
|
|
4416
|
+
}
|
|
4417
|
+
|
|
4418
|
+
return [];
|
|
4419
|
+
}
|
|
4273
4420
|
}, {
|
|
4274
4421
|
key: "handleClick",
|
|
4275
4422
|
value: function handleClick(event) {
|
|
@@ -4300,20 +4447,17 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4300
4447
|
url += "?".concat(params.path);
|
|
4301
4448
|
}
|
|
4302
4449
|
|
|
4303
|
-
this.currentView = view
|
|
4304
|
-
this.currentViewMain = view
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
if (view !== '') {
|
|
4315
|
-
this.showView(view, params, 'main');
|
|
4316
|
-
}
|
|
4450
|
+
this.navigate(url); // this.currentView = view
|
|
4451
|
+
// this.currentViewMain = view
|
|
4452
|
+
// if (this.currentView === '/' || this.currentView === '') {
|
|
4453
|
+
// this.currentView = this.options.defaultView
|
|
4454
|
+
// }
|
|
4455
|
+
// if (this.currentViewMain === '/' || this.currentViewMain === '') {
|
|
4456
|
+
// this.currentViewMain = this.options.defaultView
|
|
4457
|
+
// }
|
|
4458
|
+
// if (view !== '') {
|
|
4459
|
+
// this.showView(view, params, 'main')
|
|
4460
|
+
// }
|
|
4317
4461
|
}
|
|
4318
4462
|
}, {
|
|
4319
4463
|
key: "handleFocus",
|
|
@@ -4461,12 +4605,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4461
4605
|
}, {
|
|
4462
4606
|
key: "showComponents",
|
|
4463
4607
|
value: function showComponents(view) {
|
|
4464
|
-
var
|
|
4608
|
+
var _this28 = this;
|
|
4465
4609
|
|
|
4466
4610
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4467
4611
|
this.options.views[view].components.forEach(function (c) {
|
|
4468
4612
|
if (typeof c.instance === 'undefined') {
|
|
4469
|
-
|
|
4613
|
+
_this28.prepComponent(c.elementId, c.options);
|
|
4470
4614
|
|
|
4471
4615
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4472
4616
|
} else if (c.instance.render) {
|
|
@@ -4625,27 +4769,30 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4625
4769
|
inputPath = window.location.pathname.split('/').pop() + inputPath;
|
|
4626
4770
|
}
|
|
4627
4771
|
|
|
4628
|
-
if ((this.currentPath !==
|
|
4629
|
-
|
|
4630
|
-
var historyUrl = inputPath;
|
|
4772
|
+
if ((this.currentPath !== inputPath || previousParamsPath !== this.currentParams.path) && group === this.options.defaultGroup) {
|
|
4773
|
+
var historyUrl = inputPath;
|
|
4631
4774
|
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4775
|
+
if (this.options.urlPrefix) {
|
|
4776
|
+
historyUrl = historyUrl === '/' ? '' : "/".concat(historyUrl);
|
|
4777
|
+
inputPath = inputPath === '/' ? '' : "/".concat(inputPath);
|
|
4778
|
+
historyUrl = "/".concat(this.options.urlPrefix).concat(historyUrl).replace(/\/\//g, '/');
|
|
4779
|
+
inputPath = "/".concat(this.options.urlPrefix).concat(inputPath).replace(/\/\//g, '/');
|
|
4780
|
+
}
|
|
4638
4781
|
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4782
|
+
if (this.currentParams && this.currentParams.path) {
|
|
4783
|
+
historyUrl += "?".concat(this.currentParams.path);
|
|
4784
|
+
} else if (this.queryParams && this.options.persistentParameters === true) {
|
|
4785
|
+
historyUrl += "?".concat(this.queryParams);
|
|
4786
|
+
}
|
|
4644
4787
|
|
|
4788
|
+
if (popped === false) {
|
|
4645
4789
|
history.pushState({
|
|
4646
|
-
inputPath:
|
|
4647
|
-
},
|
|
4648
|
-
} else {
|
|
4790
|
+
inputPath: historyUrl
|
|
4791
|
+
}, 'unused', historyUrl);
|
|
4792
|
+
} else {
|
|
4793
|
+
history.replaceState({
|
|
4794
|
+
inputPath: historyUrl
|
|
4795
|
+
}, 'unused', historyUrl);
|
|
4649
4796
|
}
|
|
4650
4797
|
}
|
|
4651
4798
|
|
|
@@ -4812,7 +4959,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
4812
4959
|
}, {
|
|
4813
4960
|
key: "handleKeyUp",
|
|
4814
4961
|
value: function handleKeyUp(event) {
|
|
4815
|
-
var
|
|
4962
|
+
var _this29 = this;
|
|
4816
4963
|
|
|
4817
4964
|
if (event.target.classList.contains('websy-search-input')) {
|
|
4818
4965
|
if (this.searchTimeoutFn) {
|
|
@@ -4829,8 +4976,8 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
4829
4976
|
|
|
4830
4977
|
if (event.target.value.length >= this.options.minLength) {
|
|
4831
4978
|
this.searchTimeoutFn = setTimeout(function () {
|
|
4832
|
-
if (
|
|
4833
|
-
|
|
4979
|
+
if (_this29.options.onSearch) {
|
|
4980
|
+
_this29.options.onSearch(event.target.value);
|
|
4834
4981
|
}
|
|
4835
4982
|
}, this.options.searchTimeout);
|
|
4836
4983
|
} else {
|
|
@@ -4840,6 +4987,15 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
4840
4987
|
}
|
|
4841
4988
|
}
|
|
4842
4989
|
}
|
|
4990
|
+
}, {
|
|
4991
|
+
key: "text",
|
|
4992
|
+
set: function set(text) {
|
|
4993
|
+
var el = document.getElementById("".concat(this.elementId, "_search"));
|
|
4994
|
+
|
|
4995
|
+
if (el) {
|
|
4996
|
+
el.value = text;
|
|
4997
|
+
}
|
|
4998
|
+
}
|
|
4843
4999
|
}]);
|
|
4844
5000
|
|
|
4845
5001
|
return WebsySearch;
|
|
@@ -4981,7 +5137,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4981
5137
|
|
|
4982
5138
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4983
5139
|
function WebsyTemplate(elementId, options) {
|
|
4984
|
-
var
|
|
5140
|
+
var _this30 = this;
|
|
4985
5141
|
|
|
4986
5142
|
_classCallCheck(this, WebsyTemplate);
|
|
4987
5143
|
|
|
@@ -5007,9 +5163,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5007
5163
|
|
|
5008
5164
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
5009
5165
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
5010
|
-
|
|
5166
|
+
_this30.options.template = templateString;
|
|
5011
5167
|
|
|
5012
|
-
|
|
5168
|
+
_this30.render();
|
|
5013
5169
|
});
|
|
5014
5170
|
} else {
|
|
5015
5171
|
this.render();
|
|
@@ -5019,7 +5175,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5019
5175
|
_createClass(WebsyTemplate, [{
|
|
5020
5176
|
key: "buildHTML",
|
|
5021
5177
|
value: function buildHTML() {
|
|
5022
|
-
var
|
|
5178
|
+
var _this31 = this;
|
|
5023
5179
|
|
|
5024
5180
|
var html = "";
|
|
5025
5181
|
|
|
@@ -5081,14 +5237,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5081
5237
|
}
|
|
5082
5238
|
|
|
5083
5239
|
if (polarity === true) {
|
|
5084
|
-
if (typeof
|
|
5240
|
+
if (typeof _this31.options.data[parts[0]] !== 'undefined' && _this31.options.data[parts[0]] === parts[1]) {
|
|
5085
5241
|
// remove the <if> tags
|
|
5086
5242
|
removeAll = false;
|
|
5087
5243
|
} else if (parts[0] === parts[1]) {
|
|
5088
5244
|
removeAll = false;
|
|
5089
5245
|
}
|
|
5090
5246
|
} else if (polarity === false) {
|
|
5091
|
-
if (typeof
|
|
5247
|
+
if (typeof _this31.options.data[parts[0]] !== 'undefined' && _this31.options.data[parts[0]] !== parts[1]) {
|
|
5092
5248
|
// remove the <if> tags
|
|
5093
5249
|
removeAll = false;
|
|
5094
5250
|
}
|
|
@@ -5378,7 +5534,7 @@ var WebsyUtils = {
|
|
|
5378
5534
|
|
|
5379
5535
|
var WebsyTable = /*#__PURE__*/function () {
|
|
5380
5536
|
function WebsyTable(elementId, options) {
|
|
5381
|
-
var
|
|
5537
|
+
var _this32 = this;
|
|
5382
5538
|
|
|
5383
5539
|
_classCallCheck(this, WebsyTable);
|
|
5384
5540
|
|
|
@@ -5416,8 +5572,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5416
5572
|
allowClear: false,
|
|
5417
5573
|
disableSearch: true,
|
|
5418
5574
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5419
|
-
if (
|
|
5420
|
-
|
|
5575
|
+
if (_this32.options.onChangePageSize) {
|
|
5576
|
+
_this32.options.onChangePageSize(selectedItem.value);
|
|
5421
5577
|
}
|
|
5422
5578
|
}
|
|
5423
5579
|
});
|
|
@@ -5438,7 +5594,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5438
5594
|
_createClass(WebsyTable, [{
|
|
5439
5595
|
key: "appendRows",
|
|
5440
5596
|
value: function appendRows(data) {
|
|
5441
|
-
var
|
|
5597
|
+
var _this33 = this;
|
|
5442
5598
|
|
|
5443
5599
|
this.hideError();
|
|
5444
5600
|
var bodyHTML = '';
|
|
@@ -5446,15 +5602,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5446
5602
|
if (data) {
|
|
5447
5603
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5448
5604
|
return '<tr>' + r.map(function (c, i) {
|
|
5449
|
-
if (
|
|
5605
|
+
if (_this33.options.columns[i].show !== false) {
|
|
5450
5606
|
var style = '';
|
|
5451
5607
|
|
|
5452
5608
|
if (c.style) {
|
|
5453
5609
|
style += c.style;
|
|
5454
5610
|
}
|
|
5455
5611
|
|
|
5456
|
-
if (
|
|
5457
|
-
style += "width: ".concat(
|
|
5612
|
+
if (_this33.options.columns[i].width) {
|
|
5613
|
+
style += "width: ".concat(_this33.options.columns[i].width, "; ");
|
|
5458
5614
|
}
|
|
5459
5615
|
|
|
5460
5616
|
if (c.backgroundColor) {
|
|
@@ -5469,18 +5625,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5469
5625
|
style += "color: ".concat(c.color, "; ");
|
|
5470
5626
|
}
|
|
5471
5627
|
|
|
5472
|
-
if (
|
|
5473
|
-
return "\n <td \n data-row-index='".concat(
|
|
5474
|
-
} else if ((
|
|
5475
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5628
|
+
if (_this33.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5629
|
+
return "\n <td \n data-row-index='".concat(_this33.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this33.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(_this33.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this33.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5630
|
+
} else if ((_this33.options.columns[i].showAsNavigatorLink === true || _this33.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5631
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this33.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this33.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this33.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this33.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5476
5632
|
} else {
|
|
5477
5633
|
var info = c.value;
|
|
5478
5634
|
|
|
5479
|
-
if (
|
|
5635
|
+
if (_this33.options.columns[i].showAsImage === true) {
|
|
5480
5636
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5481
5637
|
}
|
|
5482
5638
|
|
|
5483
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5639
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this33.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this33.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 ");
|
|
5484
5640
|
}
|
|
5485
5641
|
}
|
|
5486
5642
|
}).join('') + '</tr>';
|
|
@@ -5652,7 +5808,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5652
5808
|
}, {
|
|
5653
5809
|
key: "render",
|
|
5654
5810
|
value: function render(data) {
|
|
5655
|
-
var
|
|
5811
|
+
var _this34 = this;
|
|
5656
5812
|
|
|
5657
5813
|
if (!this.options.columns) {
|
|
5658
5814
|
return;
|
|
@@ -5687,7 +5843,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5687
5843
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5688
5844
|
}
|
|
5689
5845
|
|
|
5690
|
-
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 ?
|
|
5846
|
+
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 ? _this34.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
5691
5847
|
}
|
|
5692
5848
|
}).join('') + '</tr>';
|
|
5693
5849
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5706,7 +5862,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5706
5862
|
|
|
5707
5863
|
if (pagingEl) {
|
|
5708
5864
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5709
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5865
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this34.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5710
5866
|
});
|
|
5711
5867
|
var startIndex = 0;
|
|
5712
5868
|
|
|
@@ -5774,7 +5930,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5774
5930
|
|
|
5775
5931
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5776
5932
|
function WebsyTable2(elementId, options) {
|
|
5777
|
-
var
|
|
5933
|
+
var _this35 = this;
|
|
5778
5934
|
|
|
5779
5935
|
_classCallCheck(this, WebsyTable2);
|
|
5780
5936
|
|
|
@@ -5815,8 +5971,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5815
5971
|
allowClear: false,
|
|
5816
5972
|
disableSearch: true,
|
|
5817
5973
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5818
|
-
if (
|
|
5819
|
-
|
|
5974
|
+
if (_this35.options.onChangePageSize) {
|
|
5975
|
+
_this35.options.onChangePageSize(selectedItem.value);
|
|
5820
5976
|
}
|
|
5821
5977
|
}
|
|
5822
5978
|
});
|
|
@@ -5840,7 +5996,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5840
5996
|
_createClass(WebsyTable2, [{
|
|
5841
5997
|
key: "appendRows",
|
|
5842
5998
|
value: function appendRows(data) {
|
|
5843
|
-
var
|
|
5999
|
+
var _this36 = this;
|
|
5844
6000
|
|
|
5845
6001
|
this.hideError();
|
|
5846
6002
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -5849,15 +6005,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5849
6005
|
if (data) {
|
|
5850
6006
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5851
6007
|
return '<tr>' + r.map(function (c, i) {
|
|
5852
|
-
if (
|
|
5853
|
-
var style = "height: ".concat(
|
|
6008
|
+
if (_this36.options.columns[i].show !== false) {
|
|
6009
|
+
var style = "height: ".concat(_this36.options.cellSize, "px; line-height: ").concat(_this36.options.cellSize, "px;");
|
|
5854
6010
|
|
|
5855
6011
|
if (c.style) {
|
|
5856
6012
|
style += c.style;
|
|
5857
6013
|
}
|
|
5858
6014
|
|
|
5859
|
-
if (
|
|
5860
|
-
style += "width: ".concat(
|
|
6015
|
+
if (_this36.options.columns[i].width) {
|
|
6016
|
+
style += "width: ".concat(_this36.options.columns[i].width, "; ");
|
|
5861
6017
|
}
|
|
5862
6018
|
|
|
5863
6019
|
if (c.backgroundColor) {
|
|
@@ -5872,18 +6028,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5872
6028
|
style += "color: ".concat(c.color, "; ");
|
|
5873
6029
|
}
|
|
5874
6030
|
|
|
5875
|
-
if (
|
|
5876
|
-
return "\n <td \n data-row-index='".concat(
|
|
5877
|
-
} else if ((
|
|
5878
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
6031
|
+
if (_this36.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
6032
|
+
return "\n <td \n data-row-index='".concat(_this36.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this36.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(_this36.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this36.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
6033
|
+
} else if ((_this36.options.columns[i].showAsNavigatorLink === true || _this36.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
6034
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this36.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this36.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this36.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this36.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5879
6035
|
} else {
|
|
5880
6036
|
var info = c.value;
|
|
5881
6037
|
|
|
5882
|
-
if (
|
|
6038
|
+
if (_this36.options.columns[i].showAsImage === true) {
|
|
5883
6039
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5884
6040
|
}
|
|
5885
6041
|
|
|
5886
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
6042
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this36.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this36.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 ");
|
|
5887
6043
|
}
|
|
5888
6044
|
}
|
|
5889
6045
|
}).join('') + '</tr>';
|
|
@@ -6146,7 +6302,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6146
6302
|
}, {
|
|
6147
6303
|
key: "render",
|
|
6148
6304
|
value: function render(data) {
|
|
6149
|
-
var
|
|
6305
|
+
var _this37 = this;
|
|
6150
6306
|
|
|
6151
6307
|
if (!this.options.columns) {
|
|
6152
6308
|
return;
|
|
@@ -6182,7 +6338,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6182
6338
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
6183
6339
|
}
|
|
6184
6340
|
|
|
6185
|
-
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-sort-index=\"").concat(c.sortIndex || i, "\"\n data-index=\"").concat(i, "\"\n data-sort=\"").concat(c.sort, "\"\n style=\"").concat(c.style || '', "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n ").concat(c.searchable === true ?
|
|
6341
|
+
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-sort-index=\"").concat(c.sortIndex || i, "\"\n data-index=\"").concat(i, "\"\n data-sort=\"").concat(c.sort, "\"\n style=\"").concat(c.style || '', "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n ").concat(c.searchable === true ? _this37.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6186
6342
|
}
|
|
6187
6343
|
}).join('') + '</tr>';
|
|
6188
6344
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6193,7 +6349,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6193
6349
|
var dropdownHTML = "";
|
|
6194
6350
|
this.options.columns.forEach(function (c, i) {
|
|
6195
6351
|
if (c.searchable && c.searchField) {
|
|
6196
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
6352
|
+
dropdownHTML += "\n <div id=\"".concat(_this37.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
6197
6353
|
}
|
|
6198
6354
|
});
|
|
6199
6355
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -6215,7 +6371,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6215
6371
|
|
|
6216
6372
|
if (pagingEl) {
|
|
6217
6373
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6218
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6374
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this37.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6219
6375
|
});
|
|
6220
6376
|
var startIndex = 0;
|
|
6221
6377
|
|
|
@@ -6306,7 +6462,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6306
6462
|
}, {
|
|
6307
6463
|
key: "getColumnParameters",
|
|
6308
6464
|
value: function getColumnParameters(values) {
|
|
6309
|
-
var
|
|
6465
|
+
var _this38 = this;
|
|
6310
6466
|
|
|
6311
6467
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6312
6468
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -6314,10 +6470,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6314
6470
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6315
6471
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6316
6472
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
6317
|
-
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 ?
|
|
6473
|
+
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 ? _this38.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6318
6474
|
}).join('') + '</tr>';
|
|
6319
6475
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6320
|
-
return "\n <td \n style='height: ".concat(
|
|
6476
|
+
return "\n <td \n style='height: ".concat(_this38.options.cellSize, "px; line-height: ").concat(_this38.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
6321
6477
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
6322
6478
|
|
|
6323
6479
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -6522,7 +6678,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6522
6678
|
}, {
|
|
6523
6679
|
key: "buildHeaderHtml",
|
|
6524
6680
|
value: function buildHeaderHtml() {
|
|
6525
|
-
var
|
|
6681
|
+
var _this39 = this;
|
|
6526
6682
|
|
|
6527
6683
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6528
6684
|
var headerHtml = '';
|
|
@@ -6537,7 +6693,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6537
6693
|
}
|
|
6538
6694
|
|
|
6539
6695
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6540
|
-
if (useWidths === false && rowIndex !==
|
|
6696
|
+
if (useWidths === false && rowIndex !== _this39.options.columns.length - 1) {
|
|
6541
6697
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6542
6698
|
return;
|
|
6543
6699
|
}
|
|
@@ -6563,18 +6719,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6563
6719
|
// `
|
|
6564
6720
|
// }
|
|
6565
6721
|
|
|
6566
|
-
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ?
|
|
6722
|
+
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ? _this39.buildSearchIcon(col, colIndex) : '', "</div></td>");
|
|
6567
6723
|
});
|
|
6568
6724
|
headerHtml += "</tr>";
|
|
6569
6725
|
});
|
|
6570
6726
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6571
6727
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6572
6728
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6573
|
-
var testEl = document.getElementById("".concat(
|
|
6729
|
+
var testEl = document.getElementById("".concat(_this39.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6574
6730
|
|
|
6575
6731
|
if (!testEl) {
|
|
6576
6732
|
var newE = document.createElement('div');
|
|
6577
|
-
newE.id = "".concat(
|
|
6733
|
+
newE.id = "".concat(_this39.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6578
6734
|
newE.className = 'websy-modal-dropdown';
|
|
6579
6735
|
dropdownEl.appendChild(newE);
|
|
6580
6736
|
}
|
|
@@ -6590,7 +6746,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6590
6746
|
}, {
|
|
6591
6747
|
key: "buildTotalHtml",
|
|
6592
6748
|
value: function buildTotalHtml() {
|
|
6593
|
-
var
|
|
6749
|
+
var _this40 = this;
|
|
6594
6750
|
|
|
6595
6751
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6596
6752
|
|
|
@@ -6603,7 +6759,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6603
6759
|
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6604
6760
|
|
|
6605
6761
|
if (useWidths === true) {
|
|
6606
|
-
totalHtml += "\n style='width: ".concat(
|
|
6762
|
+
totalHtml += "\n style='width: ".concat(_this40.options.columns[_this40.options.columns.length - 1][colIndex].width || _this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6607
6763
|
}
|
|
6608
6764
|
|
|
6609
6765
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -6614,7 +6770,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6614
6770
|
}, {
|
|
6615
6771
|
key: "calculateSizes",
|
|
6616
6772
|
value: function calculateSizes() {
|
|
6617
|
-
var
|
|
6773
|
+
var _this41 = this;
|
|
6618
6774
|
|
|
6619
6775
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6620
6776
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -6657,32 +6813,32 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6657
6813
|
rows.forEach(function (row, rowIndex) {
|
|
6658
6814
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6659
6815
|
var colSize = col.getBoundingClientRect();
|
|
6660
|
-
|
|
6816
|
+
_this41.sizes.cellHeight = colSize.height;
|
|
6661
6817
|
|
|
6662
|
-
if (
|
|
6663
|
-
if (!
|
|
6664
|
-
|
|
6818
|
+
if (_this41.options.columns[_this41.options.columns.length - 1][colIndex]) {
|
|
6819
|
+
if (!_this41.options.columns[_this41.options.columns.length - 1][colIndex].actualWidth) {
|
|
6820
|
+
_this41.options.columns[_this41.options.columns.length - 1][colIndex].actualWidth = 0;
|
|
6665
6821
|
}
|
|
6666
6822
|
|
|
6667
|
-
|
|
6668
|
-
|
|
6823
|
+
_this41.options.columns[_this41.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this41.options.columns[_this41.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
|
|
6824
|
+
_this41.options.columns[_this41.options.columns.length - 1][colIndex].cellHeight = colSize.height;
|
|
6669
6825
|
|
|
6670
|
-
if (colIndex >=
|
|
6671
|
-
firstNonPinnedColumnWidth =
|
|
6826
|
+
if (colIndex >= _this41.pinnedColumns) {
|
|
6827
|
+
firstNonPinnedColumnWidth = _this41.options.columns[_this41.options.columns.length - 1][colIndex].actualWidth;
|
|
6672
6828
|
}
|
|
6673
6829
|
}
|
|
6674
6830
|
});
|
|
6675
6831
|
});
|
|
6676
6832
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6677
|
-
if (colIndex <
|
|
6678
|
-
|
|
6833
|
+
if (colIndex < _this41.pinnedColumns) {
|
|
6834
|
+
_this41.sizes.scrollableWidth -= col.actualWidth;
|
|
6679
6835
|
}
|
|
6680
6836
|
});
|
|
6681
6837
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6682
6838
|
return a + (b.width || b.actualWidth);
|
|
6683
6839
|
}, 0);
|
|
6684
6840
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6685
|
-
return i >=
|
|
6841
|
+
return i >= _this41.pinnedColumns;
|
|
6686
6842
|
}).reduce(function (a, b) {
|
|
6687
6843
|
return a + (b.width || b.actualWidth);
|
|
6688
6844
|
}, 0);
|
|
@@ -6703,10 +6859,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6703
6859
|
c.actualWidth += equalWidth; // }
|
|
6704
6860
|
// }
|
|
6705
6861
|
|
|
6706
|
-
|
|
6862
|
+
_this41.sizes.totalWidth += c.width || c.actualWidth;
|
|
6707
6863
|
|
|
6708
|
-
if (i <
|
|
6709
|
-
|
|
6864
|
+
if (i < _this41.pinnedColumns) {
|
|
6865
|
+
_this41.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6710
6866
|
} // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6711
6867
|
|
|
6712
6868
|
});
|
|
@@ -7164,7 +7320,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7164
7320
|
|
|
7165
7321
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7166
7322
|
function WebsyChart(elementId, options) {
|
|
7167
|
-
var
|
|
7323
|
+
var _this42 = this;
|
|
7168
7324
|
|
|
7169
7325
|
_classCallCheck(this, WebsyChart);
|
|
7170
7326
|
|
|
@@ -7215,22 +7371,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7215
7371
|
this.invertOverride = function (input, input2) {
|
|
7216
7372
|
var xAxis = 'bottomAxis';
|
|
7217
7373
|
|
|
7218
|
-
if (
|
|
7374
|
+
if (_this42.options.orientation === 'horizontal') {
|
|
7219
7375
|
xAxis = 'leftAxis';
|
|
7220
7376
|
}
|
|
7221
7377
|
|
|
7222
|
-
var width =
|
|
7378
|
+
var width = _this42[xAxis].step();
|
|
7223
7379
|
|
|
7224
7380
|
var output;
|
|
7225
7381
|
|
|
7226
|
-
var domain = _toConsumableArray(
|
|
7382
|
+
var domain = _toConsumableArray(_this42[xAxis].domain());
|
|
7227
7383
|
|
|
7228
|
-
if (
|
|
7384
|
+
if (_this42.options.orientation === 'horizontal') {
|
|
7229
7385
|
domain = domain.reverse();
|
|
7230
7386
|
}
|
|
7231
7387
|
|
|
7232
7388
|
for (var j = 0; j < domain.length; j++) {
|
|
7233
|
-
var breakA =
|
|
7389
|
+
var breakA = _this42[xAxis](domain[j]) - width / 2;
|
|
7234
7390
|
var breakB = breakA + width;
|
|
7235
7391
|
|
|
7236
7392
|
if (input > breakA && input <= breakB) {
|
|
@@ -7330,10 +7486,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7330
7486
|
}, {
|
|
7331
7487
|
key: "handleEventMouseMove",
|
|
7332
7488
|
value: function handleEventMouseMove(event, d) {
|
|
7333
|
-
var
|
|
7489
|
+
var _this43 = this;
|
|
7334
7490
|
|
|
7335
7491
|
var bisectDate = d3.bisector(function (d) {
|
|
7336
|
-
return
|
|
7492
|
+
return _this43.parseX(d.x.value);
|
|
7337
7493
|
}).left;
|
|
7338
7494
|
|
|
7339
7495
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7372,8 +7528,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7372
7528
|
}
|
|
7373
7529
|
|
|
7374
7530
|
this.options.data.series.forEach(function (s) {
|
|
7375
|
-
if (
|
|
7376
|
-
xPoint =
|
|
7531
|
+
if (_this43.options.data[xData].scale !== 'Time') {
|
|
7532
|
+
xPoint = _this43[xAxis](_this43.parseX(xLabel));
|
|
7377
7533
|
s.data.forEach(function (d) {
|
|
7378
7534
|
if (d.x.value === xLabel) {
|
|
7379
7535
|
if (!tooltipTitle) {
|
|
@@ -7392,13 +7548,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7392
7548
|
var pointA = s.data[index - 1];
|
|
7393
7549
|
var pointB = s.data[index];
|
|
7394
7550
|
|
|
7395
|
-
if (
|
|
7551
|
+
if (_this43.options.orientation === 'horizontal') {
|
|
7396
7552
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7397
7553
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7398
7554
|
}
|
|
7399
7555
|
|
|
7400
7556
|
if (pointA && !pointB) {
|
|
7401
|
-
xPoint =
|
|
7557
|
+
xPoint = _this43[xAxis](_this43.parseX(pointA.x.value));
|
|
7402
7558
|
tooltipTitle = pointA.x.value;
|
|
7403
7559
|
|
|
7404
7560
|
if (!pointA.y.color) {
|
|
@@ -7408,12 +7564,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7408
7564
|
tooltipData.push(pointA.y);
|
|
7409
7565
|
|
|
7410
7566
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7411
|
-
tooltipTitle = d3.timeFormat(
|
|
7567
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7412
7568
|
}
|
|
7413
7569
|
}
|
|
7414
7570
|
|
|
7415
7571
|
if (pointB && !pointA) {
|
|
7416
|
-
xPoint =
|
|
7572
|
+
xPoint = _this43[xAxis](_this43.parseX(pointB.x.value));
|
|
7417
7573
|
tooltipTitle = pointB.x.value;
|
|
7418
7574
|
|
|
7419
7575
|
if (!pointB.y.color) {
|
|
@@ -7423,14 +7579,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7423
7579
|
tooltipData.push(pointB.y);
|
|
7424
7580
|
|
|
7425
7581
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7426
|
-
tooltipTitle = d3.timeFormat(
|
|
7582
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7427
7583
|
}
|
|
7428
7584
|
}
|
|
7429
7585
|
|
|
7430
7586
|
if (pointA && pointB) {
|
|
7431
|
-
var d0 =
|
|
7587
|
+
var d0 = _this43[xAxis](_this43.parseX(pointA.x.value));
|
|
7432
7588
|
|
|
7433
|
-
var d1 =
|
|
7589
|
+
var d1 = _this43[xAxis](_this43.parseX(pointB.x.value));
|
|
7434
7590
|
|
|
7435
7591
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7436
7592
|
|
|
@@ -7439,7 +7595,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7439
7595
|
tooltipTitle = pointB.x.value;
|
|
7440
7596
|
|
|
7441
7597
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7442
|
-
tooltipTitle = d3.timeFormat(
|
|
7598
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7443
7599
|
}
|
|
7444
7600
|
|
|
7445
7601
|
if (!pointB.y.color) {
|
|
@@ -7452,7 +7608,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7452
7608
|
tooltipTitle = pointA.x.value;
|
|
7453
7609
|
|
|
7454
7610
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7455
|
-
tooltipTitle = d3.timeFormat(
|
|
7611
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7456
7612
|
}
|
|
7457
7613
|
|
|
7458
7614
|
if (!pointA.y.color) {
|
|
@@ -7566,7 +7722,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7566
7722
|
}, {
|
|
7567
7723
|
key: "render",
|
|
7568
7724
|
value: function render(options) {
|
|
7569
|
-
var
|
|
7725
|
+
var _this44 = this;
|
|
7570
7726
|
|
|
7571
7727
|
/* global d3 options WebsyUtils */
|
|
7572
7728
|
if (typeof options !== 'undefined') {
|
|
@@ -7635,7 +7791,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7635
7791
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
7636
7792
|
return {
|
|
7637
7793
|
value: s.label || s.key,
|
|
7638
|
-
color: s.color ||
|
|
7794
|
+
color: s.color || _this44.options.colors[i % _this44.options.colors.length]
|
|
7639
7795
|
};
|
|
7640
7796
|
});
|
|
7641
7797
|
|
|
@@ -7917,7 +8073,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7917
8073
|
|
|
7918
8074
|
if (this.options.data.bottom.formatter) {
|
|
7919
8075
|
bAxisFunc.tickFormat(function (d) {
|
|
7920
|
-
return
|
|
8076
|
+
return _this44.options.data.bottom.formatter(d);
|
|
7921
8077
|
});
|
|
7922
8078
|
}
|
|
7923
8079
|
|
|
@@ -7943,8 +8099,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7943
8099
|
|
|
7944
8100
|
if (this.options.margin.axisLeft > 0) {
|
|
7945
8101
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7946
|
-
if (
|
|
7947
|
-
d =
|
|
8102
|
+
if (_this44.options.data.left.formatter) {
|
|
8103
|
+
d = _this44.options.data.left.formatter(d);
|
|
7948
8104
|
}
|
|
7949
8105
|
|
|
7950
8106
|
return d;
|
|
@@ -7981,8 +8137,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7981
8137
|
|
|
7982
8138
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
7983
8139
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7984
|
-
if (
|
|
7985
|
-
d =
|
|
8140
|
+
if (_this44.options.data.right.formatter) {
|
|
8141
|
+
d = _this44.options.data.right.formatter(d);
|
|
7986
8142
|
}
|
|
7987
8143
|
|
|
7988
8144
|
return d;
|
|
@@ -8021,18 +8177,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8021
8177
|
this.renderedKeys = {};
|
|
8022
8178
|
this.options.data.series.forEach(function (series, index) {
|
|
8023
8179
|
if (!series.key) {
|
|
8024
|
-
series.key =
|
|
8180
|
+
series.key = _this44.createIdentity();
|
|
8025
8181
|
}
|
|
8026
8182
|
|
|
8027
8183
|
if (!series.color) {
|
|
8028
|
-
series.color =
|
|
8184
|
+
series.color = _this44.options.colors[index % _this44.options.colors.length];
|
|
8029
8185
|
}
|
|
8030
8186
|
|
|
8031
|
-
|
|
8187
|
+
_this44["render".concat(series.type || 'bar')](series, index);
|
|
8032
8188
|
|
|
8033
|
-
|
|
8189
|
+
_this44.renderLabels(series, index);
|
|
8034
8190
|
|
|
8035
|
-
|
|
8191
|
+
_this44.renderedKeys[series.key] = series.type;
|
|
8036
8192
|
});
|
|
8037
8193
|
}
|
|
8038
8194
|
}
|
|
@@ -8040,17 +8196,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8040
8196
|
}, {
|
|
8041
8197
|
key: "renderarea",
|
|
8042
8198
|
value: function renderarea(series, index) {
|
|
8043
|
-
var
|
|
8199
|
+
var _this45 = this;
|
|
8044
8200
|
|
|
8045
8201
|
/* global d3 series index */
|
|
8046
8202
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
8047
8203
|
return d3.area().x(function (d) {
|
|
8048
|
-
return
|
|
8204
|
+
return _this45[xAxis](_this45.parseX(d.x.value));
|
|
8049
8205
|
}).y0(function (d) {
|
|
8050
|
-
return
|
|
8206
|
+
return _this45[yAxis](0);
|
|
8051
8207
|
}).y1(function (d) {
|
|
8052
|
-
return
|
|
8053
|
-
}).curve(d3[curveStyle ||
|
|
8208
|
+
return _this45[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8209
|
+
}).curve(d3[curveStyle || _this45.options.curveStyle]);
|
|
8054
8210
|
};
|
|
8055
8211
|
|
|
8056
8212
|
var xAxis = 'bottomAxis';
|
|
@@ -8173,7 +8329,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8173
8329
|
}, {
|
|
8174
8330
|
key: "renderLabels",
|
|
8175
8331
|
value: function renderLabels(series, index) {
|
|
8176
|
-
var
|
|
8332
|
+
var _this46 = this;
|
|
8177
8333
|
|
|
8178
8334
|
/* global series index d3 WebsyDesigns */
|
|
8179
8335
|
var xAxis = 'bottomAxis';
|
|
@@ -8192,11 +8348,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8192
8348
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
8193
8349
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
8194
8350
|
labels.attr('x', function (d) {
|
|
8195
|
-
return getLabelX.call(
|
|
8351
|
+
return getLabelX.call(_this46, d, series.labelPosition);
|
|
8196
8352
|
}).attr('y', function (d) {
|
|
8197
|
-
return getLabelY.call(
|
|
8353
|
+
return getLabelY.call(_this46, d, series.labelPosition);
|
|
8198
8354
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
8199
|
-
return
|
|
8355
|
+
return _this46.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8200
8356
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
8201
8357
|
return d.y.label || d.y.value;
|
|
8202
8358
|
}).each(function (d, i) {
|
|
@@ -8221,11 +8377,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8221
8377
|
}
|
|
8222
8378
|
});
|
|
8223
8379
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
8224
|
-
return getLabelX.call(
|
|
8380
|
+
return getLabelX.call(_this46, d, series.labelPosition);
|
|
8225
8381
|
}).attr('y', function (d) {
|
|
8226
|
-
return getLabelY.call(
|
|
8382
|
+
return getLabelY.call(_this46, d, series.labelPosition);
|
|
8227
8383
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
8228
|
-
return
|
|
8384
|
+
return _this46.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8229
8385
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
8230
8386
|
return d.y.label || d.y.value;
|
|
8231
8387
|
}).each(function (d, i) {
|
|
@@ -8282,16 +8438,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8282
8438
|
}, {
|
|
8283
8439
|
key: "renderline",
|
|
8284
8440
|
value: function renderline(series, index) {
|
|
8285
|
-
var
|
|
8441
|
+
var _this47 = this;
|
|
8286
8442
|
|
|
8287
8443
|
/* global series index d3 */
|
|
8288
8444
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
8289
8445
|
return d3.line().x(function (d) {
|
|
8290
|
-
var adjustment =
|
|
8291
|
-
return
|
|
8446
|
+
var adjustment = _this47.options.data[xAxis].scale === 'Time' ? 0 : _this47["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8447
|
+
return _this47["".concat(xAxis, "Axis")](_this47.parseX(d.x.value)) + adjustment;
|
|
8292
8448
|
}).y(function (d) {
|
|
8293
|
-
return
|
|
8294
|
-
}).curve(d3[curveStyle ||
|
|
8449
|
+
return _this47["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8450
|
+
}).curve(d3[curveStyle || _this47.options.curveStyle]);
|
|
8295
8451
|
};
|
|
8296
8452
|
|
|
8297
8453
|
var xAxis = 'bottom';
|
|
@@ -8335,14 +8491,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8335
8491
|
}, {
|
|
8336
8492
|
key: "rendersymbol",
|
|
8337
8493
|
value: function rendersymbol(series, index) {
|
|
8338
|
-
var
|
|
8494
|
+
var _this48 = this;
|
|
8339
8495
|
|
|
8340
8496
|
/* global d3 series index series.key */
|
|
8341
8497
|
var drawSymbol = function drawSymbol(size) {
|
|
8342
8498
|
return d3.symbol() // .type(d => {
|
|
8343
8499
|
// return d3.symbols[0]
|
|
8344
8500
|
// })
|
|
8345
|
-
.size(size ||
|
|
8501
|
+
.size(size || _this48.options.symbolSize);
|
|
8346
8502
|
};
|
|
8347
8503
|
|
|
8348
8504
|
var xAxis = 'bottomAxis';
|
|
@@ -8360,7 +8516,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8360
8516
|
symbols.attr('d', function (d) {
|
|
8361
8517
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
8362
8518
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
8363
|
-
return "translate(".concat(
|
|
8519
|
+
return "translate(".concat(_this48[xAxis](_this48.parseX(d.x.value)), ", ").concat(_this48[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8364
8520
|
}); // Enter
|
|
8365
8521
|
|
|
8366
8522
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -8369,7 +8525,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8369
8525
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
8370
8526
|
return "symbol symbol_".concat(series.key);
|
|
8371
8527
|
}).attr('transform', function (d) {
|
|
8372
|
-
return "translate(".concat(
|
|
8528
|
+
return "translate(".concat(_this48[xAxis](_this48.parseX(d.x.value)), ", ").concat(_this48[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8373
8529
|
});
|
|
8374
8530
|
}
|
|
8375
8531
|
}, {
|
|
@@ -8524,7 +8680,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8524
8680
|
}, {
|
|
8525
8681
|
key: "resize",
|
|
8526
8682
|
value: function resize() {
|
|
8527
|
-
var
|
|
8683
|
+
var _this49 = this;
|
|
8528
8684
|
|
|
8529
8685
|
var el = document.getElementById(this.elementId);
|
|
8530
8686
|
|
|
@@ -8537,7 +8693,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8537
8693
|
// }
|
|
8538
8694
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
8539
8695
|
html += this._data.map(function (d, i) {
|
|
8540
|
-
return
|
|
8696
|
+
return _this49.getLegendItemHTML(d);
|
|
8541
8697
|
}).join('');
|
|
8542
8698
|
html += "\n <div>\n ";
|
|
8543
8699
|
el.innerHTML = html;
|
|
@@ -8709,7 +8865,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8709
8865
|
}, {
|
|
8710
8866
|
key: "render",
|
|
8711
8867
|
value: function render() {
|
|
8712
|
-
var
|
|
8868
|
+
var _this50 = this;
|
|
8713
8869
|
|
|
8714
8870
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
8715
8871
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -8718,7 +8874,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8718
8874
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
8719
8875
|
return {
|
|
8720
8876
|
value: s.label || s.key,
|
|
8721
|
-
color: s.color ||
|
|
8877
|
+
color: s.color || _this50.options.colors[i % _this50.options.colors.length]
|
|
8722
8878
|
};
|
|
8723
8879
|
});
|
|
8724
8880
|
var longestValue = legendData.map(function (s) {
|
|
@@ -8782,7 +8938,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8782
8938
|
|
|
8783
8939
|
if (this.polygons) {
|
|
8784
8940
|
this.polygons.forEach(function (p) {
|
|
8785
|
-
return
|
|
8941
|
+
return _this50.map.removeLayer(p);
|
|
8786
8942
|
});
|
|
8787
8943
|
}
|
|
8788
8944
|
|
|
@@ -8840,18 +8996,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8840
8996
|
}
|
|
8841
8997
|
|
|
8842
8998
|
if (!p.options.color) {
|
|
8843
|
-
p.options.color =
|
|
8999
|
+
p.options.color = _this50.options.colors[i % _this50.options.colors.length];
|
|
8844
9000
|
}
|
|
8845
9001
|
|
|
8846
9002
|
var pol = L.polygon(p.data.map(function (c) {
|
|
8847
9003
|
return c.map(function (d) {
|
|
8848
9004
|
return [d.Latitude, d.Longitude];
|
|
8849
9005
|
});
|
|
8850
|
-
}), p.options).addTo(
|
|
9006
|
+
}), p.options).addTo(_this50.map);
|
|
8851
9007
|
|
|
8852
|
-
|
|
9008
|
+
_this50.polygons.push(pol);
|
|
8853
9009
|
|
|
8854
|
-
|
|
9010
|
+
_this50.map.fitBounds(pol.getBounds());
|
|
8855
9011
|
});
|
|
8856
9012
|
} // if (this.data.markers.length > 0) {
|
|
8857
9013
|
// el.classList.remove('hidden')
|