@websy/websy-designs 1.4.0 → 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 +264 -148
- package/dist/websy-designs-es6.js +418 -269
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +304 -171
- package/dist/websy-designs.js +462 -284
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -40,7 +40,9 @@ var APIService = /*#__PURE__*/function () {
|
|
|
40
40
|
_classCallCheck(this, APIService);
|
|
41
41
|
|
|
42
42
|
this.baseUrl = baseUrl;
|
|
43
|
-
this.options = _extends({},
|
|
43
|
+
this.options = _extends({}, {
|
|
44
|
+
fieldValueSeparator: ':'
|
|
45
|
+
}, options);
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
_createClass(APIService, [{
|
|
@@ -58,7 +60,7 @@ var APIService = /*#__PURE__*/function () {
|
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
if (id) {
|
|
61
|
-
query.push("id
|
|
63
|
+
query.push("id".concat(this.options.fieldValueSeparator).concat(id));
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
return "".concat(this.baseUrl, "/").concat(entity).concat(query.length > 0 ? "".concat(entity.indexOf('?') === -1 ? '?' : '&', "where=").concat(query.join(';')) : '');
|
|
@@ -604,75 +606,103 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
604
606
|
}
|
|
605
607
|
|
|
606
608
|
if (this.customRangeSelected === true) {
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
if (this.options.mode === 'date') {
|
|
610
|
-
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()) {
|
|
611
|
-
// diff += 1
|
|
612
|
-
// }
|
|
613
|
-
} else if (this.options.mode === 'year') {
|
|
614
|
-
diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
|
|
615
|
-
|
|
616
|
-
if (this.selectedRangeDates[this.selectedRangeDates.length - 1] !== this.selectedRangeDates[0]) {// diff += 1
|
|
617
|
-
}
|
|
618
|
-
} else if (this.options.mode === 'monthyear') {
|
|
619
|
-
var yearDiff = (this.selectedRangeDates[this.selectedRangeDates.length - 1].getFullYear() - this.selectedRangeDates[0].getFullYear()) * 12;
|
|
620
|
-
diff = Math.floor(this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth() - this.selectedRangeDates[0].getMonth()) + yearDiff;
|
|
621
|
-
} else if (this.options.mode === 'hour') {
|
|
622
|
-
diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
for (var _i = 0; _i < diff + 1; _i++) {
|
|
626
|
-
var d = void 0;
|
|
627
|
-
var rangeStart = void 0;
|
|
628
|
-
var rangeEnd = void 0;
|
|
609
|
+
if (this.isContinuousRange || this.mouseDown) {
|
|
610
|
+
var diff;
|
|
629
611
|
|
|
630
612
|
if (this.options.mode === 'date') {
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
rangeStart = this.selectedRangeDates[0].getTime();
|
|
636
|
-
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
613
|
+
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()) {
|
|
614
|
+
// diff += 1
|
|
615
|
+
// }
|
|
637
616
|
} else if (this.options.mode === 'year') {
|
|
638
|
-
|
|
639
|
-
rangeStart = this.selectedRangeDates[0];
|
|
640
|
-
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
641
|
-
} else if (this.options.mode === 'monthyear') {
|
|
642
|
-
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + _i));
|
|
643
|
-
d = d.getTime();
|
|
644
|
-
console.log('highlighting', this.selectedRangeDates[0].getTime(), d);
|
|
645
|
-
rangeStart = this.selectedRangeDates[0].getTime();
|
|
646
|
-
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
647
|
-
} else if (this.options.mode === 'hour') {
|
|
648
|
-
d = this.selectedRangeDates[0] + _i;
|
|
649
|
-
rangeStart = this.selectedRangeDates[0];
|
|
650
|
-
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
var dateEl = void 0;
|
|
617
|
+
diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
|
|
654
618
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
} else if (this.options.mode === 'year') {
|
|
658
|
-
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_year"));
|
|
619
|
+
if (this.selectedRangeDates[this.selectedRangeDates.length - 1] !== this.selectedRangeDates[0]) {// diff += 1
|
|
620
|
+
}
|
|
659
621
|
} else if (this.options.mode === 'monthyear') {
|
|
660
|
-
|
|
622
|
+
var yearDiff = (this.selectedRangeDates[this.selectedRangeDates.length - 1].getFullYear() - this.selectedRangeDates[0].getFullYear()) * 12;
|
|
623
|
+
diff = Math.floor(this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth() - this.selectedRangeDates[0].getMonth()) + yearDiff;
|
|
661
624
|
} else if (this.options.mode === 'hour') {
|
|
662
|
-
|
|
663
|
-
}
|
|
625
|
+
diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
for (var _i = 0; _i < diff + 1; _i++) {
|
|
629
|
+
var d = void 0;
|
|
630
|
+
var rangeStart = void 0;
|
|
631
|
+
var rangeEnd = void 0;
|
|
632
|
+
|
|
633
|
+
if (this.options.mode === 'date') {
|
|
634
|
+
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + _i * this.oneDay)); // d.setUTCHours(12, 0, 0, 0)
|
|
635
|
+
|
|
636
|
+
d = d.getTime(); // console.log('highlighting', this.selectedRangeDates[0].getTime(), d)
|
|
637
|
+
|
|
638
|
+
rangeStart = this.selectedRangeDates[0].getTime();
|
|
639
|
+
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
640
|
+
} else if (this.options.mode === 'year') {
|
|
641
|
+
d = this.selectedRangeDates[0] + _i;
|
|
642
|
+
rangeStart = this.selectedRangeDates[0];
|
|
643
|
+
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
644
|
+
} else if (this.options.mode === 'monthyear') {
|
|
645
|
+
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + _i));
|
|
646
|
+
d = d.getTime();
|
|
647
|
+
console.log('highlighting', this.selectedRangeDates[0].getTime(), d);
|
|
648
|
+
rangeStart = this.selectedRangeDates[0].getTime();
|
|
649
|
+
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
650
|
+
} else if (this.options.mode === 'hour') {
|
|
651
|
+
d = this.selectedRangeDates[0] + _i;
|
|
652
|
+
rangeStart = this.selectedRangeDates[0];
|
|
653
|
+
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
654
|
+
}
|
|
664
655
|
|
|
665
|
-
|
|
666
|
-
dateEl.classList.add('selected');
|
|
656
|
+
var dateEl = void 0;
|
|
667
657
|
|
|
668
|
-
if (
|
|
669
|
-
dateEl.
|
|
658
|
+
if (this.options.mode === 'date') {
|
|
659
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_date"));
|
|
660
|
+
} else if (this.options.mode === 'year') {
|
|
661
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_year"));
|
|
662
|
+
} else if (this.options.mode === 'monthyear') {
|
|
663
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_monthyear"));
|
|
664
|
+
} else if (this.options.mode === 'hour') {
|
|
665
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_hour"));
|
|
670
666
|
}
|
|
671
667
|
|
|
672
|
-
if (
|
|
673
|
-
dateEl.classList.add(
|
|
668
|
+
if (dateEl) {
|
|
669
|
+
dateEl.classList.add('selected');
|
|
670
|
+
|
|
671
|
+
if (d === rangeStart) {
|
|
672
|
+
dateEl.classList.add("".concat(this.options.sortDirection === 'desc' ? 'last' : 'first'));
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
if (d === rangeEnd) {
|
|
676
|
+
dateEl.classList.add("".concat(this.options.sortDirection === 'desc' ? 'first' : 'last'));
|
|
677
|
+
}
|
|
674
678
|
}
|
|
675
679
|
}
|
|
680
|
+
} else {
|
|
681
|
+
this.selectedRangeDates.forEach(function (dIn) {
|
|
682
|
+
var d;
|
|
683
|
+
var suffix = '_date';
|
|
684
|
+
|
|
685
|
+
if (_this3.options.mode === 'date') {
|
|
686
|
+
d = _this3.floorDate(new Date(dIn.getTime()));
|
|
687
|
+
d = d.getTime();
|
|
688
|
+
} else if (_this3.options.mode === 'year') {
|
|
689
|
+
d = dIn;
|
|
690
|
+
suffix = '_year';
|
|
691
|
+
} else if (_this3.options.mode === 'monthyear') {
|
|
692
|
+
d = _this3.floorDate(new Date(dIn.getTime()).setMonth(dIn.getMonth()));
|
|
693
|
+
d = d.getTime();
|
|
694
|
+
suffix = '_monthyear';
|
|
695
|
+
} else if (_this3.options.mode === 'hour') {
|
|
696
|
+
d = dIn;
|
|
697
|
+
suffix = '_hour';
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
var dateEl = document.getElementById("".concat(_this3.elementId, "_").concat(d).concat(suffix));
|
|
701
|
+
|
|
702
|
+
if (dateEl) {
|
|
703
|
+
dateEl.classList.add('selected', 'first', 'last');
|
|
704
|
+
}
|
|
705
|
+
});
|
|
676
706
|
}
|
|
677
707
|
} else {
|
|
678
708
|
this.currentselection.forEach(function (d) {
|
|
@@ -969,7 +999,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
969
999
|
} else if (this.options.mode === 'hour') {
|
|
970
1000
|
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'><ul>");
|
|
971
1001
|
html += this.options.hours.map(function (h) {
|
|
972
|
-
return "<li id='".concat(_this4.elementId, "_").concat(+h.text.split(':')[0], "_hour' data-hour='").concat(h.text, "' class='websy-dp-date websy-dp-hour'>").concat(h.text, "</li>");
|
|
1002
|
+
return "<li id='".concat(_this4.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>");
|
|
973
1003
|
}).join('');
|
|
974
1004
|
html += "</ul></div>";
|
|
975
1005
|
}
|
|
@@ -1079,7 +1109,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1079
1109
|
var _this6 = this;
|
|
1080
1110
|
|
|
1081
1111
|
this.selectedRange = -1;
|
|
1082
|
-
|
|
1112
|
+
this.isContinuousRange = true; // if (rangeInput.length === 1) {
|
|
1083
1113
|
// this.selectedRangeDates = [...rangeInput]
|
|
1084
1114
|
// this.customRangeSelected = true
|
|
1085
1115
|
// }
|
|
@@ -1094,22 +1124,22 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1094
1124
|
if (i > 0) {
|
|
1095
1125
|
if (_this6.options.mode === 'date' || _this6.options.mode === 'monthyear') {
|
|
1096
1126
|
if (r.getTime() / _this6.oneDay - rangeInput[i - 1] / _this6.oneDay > 1) {
|
|
1097
|
-
isContinuousRange = false;
|
|
1127
|
+
_this6.isContinuousRange = false;
|
|
1098
1128
|
}
|
|
1099
1129
|
} else if (_this6.options.mode === 'hour' || _this6.options.mode === 'year') {
|
|
1100
1130
|
if (r - rangeInput[i - 1] > 1) {
|
|
1101
|
-
isContinuousRange = false;
|
|
1131
|
+
_this6.isContinuousRange = false;
|
|
1102
1132
|
}
|
|
1103
1133
|
}
|
|
1104
1134
|
}
|
|
1105
1135
|
});
|
|
1106
1136
|
|
|
1107
|
-
if (rangeInput.length > 2 && isContinuousRange === true) {
|
|
1137
|
+
if (rangeInput.length > 2 && this.isContinuousRange === true) {
|
|
1108
1138
|
this.selectedRangeDates = [rangeInput[0], rangeInput[rangeInput.length - 1]];
|
|
1109
1139
|
this.customRangeSelected = true;
|
|
1110
1140
|
}
|
|
1111
1141
|
|
|
1112
|
-
if (isContinuousRange === false) {
|
|
1142
|
+
if (this.isContinuousRange === false) {
|
|
1113
1143
|
this.currentselection = [];
|
|
1114
1144
|
} // check if the custom range matches a configured range
|
|
1115
1145
|
|
|
@@ -1204,7 +1234,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1204
1234
|
var start = list[0];
|
|
1205
1235
|
var end = '';
|
|
1206
1236
|
|
|
1207
|
-
if (this.customRangeSelected === true) {
|
|
1237
|
+
if (this.customRangeSelected === true && this.isContinuousRange === true) {
|
|
1208
1238
|
end = " - ".concat(list[list.length - 1]);
|
|
1209
1239
|
|
|
1210
1240
|
if (this.options.mode === 'hour') {
|
|
@@ -1618,8 +1648,9 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1618
1648
|
});
|
|
1619
1649
|
}
|
|
1620
1650
|
|
|
1651
|
+
this.searchText = '';
|
|
1621
1652
|
this.tooltipTimeoutFn = null;
|
|
1622
|
-
this._originalData =
|
|
1653
|
+
this._originalData = _toConsumableArray(this.options.items);
|
|
1623
1654
|
this.selectedItems = this.options.selectedItems || [];
|
|
1624
1655
|
|
|
1625
1656
|
if (!elementId) {
|
|
@@ -1762,6 +1793,8 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1762
1793
|
key: "handleKeyUp",
|
|
1763
1794
|
value: function handleKeyUp(event) {
|
|
1764
1795
|
if (event.target.classList.contains('websy-dropdown-search')) {
|
|
1796
|
+
this.searchText = event.target.value;
|
|
1797
|
+
|
|
1765
1798
|
if (this._originalData.length === 0) {
|
|
1766
1799
|
this._originalData = _toConsumableArray(this.options.items);
|
|
1767
1800
|
}
|
|
@@ -1958,6 +1991,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1958
1991
|
var itemEls = el.querySelectorAll(".websy-dropdown-item");
|
|
1959
1992
|
var dataToUse = this._originalData;
|
|
1960
1993
|
|
|
1994
|
+
if (this._originalData.length === 0 && this.searchText === '') {
|
|
1995
|
+
dataToUse = this.options.items;
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1961
1998
|
if (this.options.onSearch) {
|
|
1962
1999
|
dataToUse = this.options.items;
|
|
1963
2000
|
}
|
|
@@ -3462,6 +3499,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3462
3499
|
|
|
3463
3500
|
if (el) {
|
|
3464
3501
|
el.addEventListener('click', this.handleClick.bind(this));
|
|
3502
|
+
el.addEventListener('change', this.handleChange.bind(this));
|
|
3503
|
+
el.addEventListener('keyup', this.handleKeyUp.bind(this));
|
|
3504
|
+
el.addEventListener('keydown', this.handleKeyDown.bind(this));
|
|
3465
3505
|
}
|
|
3466
3506
|
|
|
3467
3507
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
@@ -3674,56 +3714,76 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3674
3714
|
key: "handleClick",
|
|
3675
3715
|
value: function handleClick(event) {
|
|
3676
3716
|
if (event.target.classList.contains('clickable')) {
|
|
3677
|
-
|
|
3717
|
+
this.handleEvent(event, 'clickable', 'click');
|
|
3718
|
+
}
|
|
3719
|
+
}
|
|
3720
|
+
}, {
|
|
3721
|
+
key: "handleChange",
|
|
3722
|
+
value: function handleChange(event) {
|
|
3723
|
+
this.handleEvent(event, 'keyable', 'change');
|
|
3724
|
+
}
|
|
3725
|
+
}, {
|
|
3726
|
+
key: "handleKeyUp",
|
|
3727
|
+
value: function handleKeyUp(event) {
|
|
3728
|
+
this.handleEvent(event, 'keyable', 'keyup');
|
|
3729
|
+
}
|
|
3730
|
+
}, {
|
|
3731
|
+
key: "handleKeyDown",
|
|
3732
|
+
value: function handleKeyDown(event) {
|
|
3733
|
+
this.handleEvent(event, 'keyable', 'keydown');
|
|
3734
|
+
}
|
|
3735
|
+
}, {
|
|
3736
|
+
key: "handleEvent",
|
|
3737
|
+
value: function handleEvent(event, eventType, action) {
|
|
3738
|
+
var l = event.target.getAttribute('data-event');
|
|
3678
3739
|
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3740
|
+
if (l) {
|
|
3741
|
+
l = l.split('(');
|
|
3742
|
+
var params = [];
|
|
3743
|
+
var id = event.target.getAttribute('data-id');
|
|
3744
|
+
var locator = event.target.getAttribute('data-locator');
|
|
3684
3745
|
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3746
|
+
if (l[1]) {
|
|
3747
|
+
l[1] = l[1].replace(')', '');
|
|
3748
|
+
params = l[1].split(',');
|
|
3749
|
+
}
|
|
3689
3750
|
|
|
3690
|
-
|
|
3691
|
-
|
|
3751
|
+
l = l[0];
|
|
3752
|
+
var data = this.rows;
|
|
3692
3753
|
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3754
|
+
if (locator !== '') {
|
|
3755
|
+
var locatorItems = locator.split(';');
|
|
3756
|
+
locatorItems.forEach(function (loc) {
|
|
3757
|
+
var locatorParts = loc.split(':');
|
|
3697
3758
|
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3759
|
+
if (data[locatorParts[0]]) {
|
|
3760
|
+
data = data[locatorParts[0]];
|
|
3761
|
+
var parts = locatorParts[1].split('.');
|
|
3762
|
+
parts.forEach(function (p) {
|
|
3763
|
+
data = data[p];
|
|
3764
|
+
});
|
|
3765
|
+
}
|
|
3766
|
+
});
|
|
3767
|
+
}
|
|
3707
3768
|
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
}
|
|
3713
|
-
} else if (typeof p === 'string') {
|
|
3714
|
-
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
3769
|
+
params = params.map(function (p) {
|
|
3770
|
+
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
3771
|
+
if (data[+id]) {
|
|
3772
|
+
p = data[+id][p];
|
|
3715
3773
|
}
|
|
3774
|
+
} else if (typeof p === 'string') {
|
|
3775
|
+
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
3776
|
+
}
|
|
3716
3777
|
|
|
3717
|
-
|
|
3718
|
-
|
|
3778
|
+
return p;
|
|
3779
|
+
});
|
|
3719
3780
|
|
|
3720
|
-
|
|
3721
|
-
|
|
3781
|
+
if (event.target.classList.contains(eventType) && this.options.listeners[action] && this.options.listeners[action][l]) {
|
|
3782
|
+
var _this$options$listene;
|
|
3722
3783
|
|
|
3723
|
-
|
|
3784
|
+
event.stopPropagation();
|
|
3724
3785
|
|
|
3725
|
-
|
|
3726
|
-
}
|
|
3786
|
+
(_this$options$listene = this.options.listeners[action][l]).call.apply(_this$options$listene, [this, event, data[+id]].concat(_toConsumableArray(params)));
|
|
3727
3787
|
}
|
|
3728
3788
|
}
|
|
3729
3789
|
}
|
|
@@ -3783,7 +3843,8 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3783
3843
|
show: [],
|
|
3784
3844
|
hide: []
|
|
3785
3845
|
},
|
|
3786
|
-
persistentParameters: false
|
|
3846
|
+
persistentParameters: false,
|
|
3847
|
+
fieldValueSeparator: ':'
|
|
3787
3848
|
};
|
|
3788
3849
|
this.triggerIdList = [];
|
|
3789
3850
|
this.viewIdList = [];
|
|
@@ -3852,6 +3913,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3852
3913
|
key: "addUrlParams",
|
|
3853
3914
|
value: function addUrlParams(params) {
|
|
3854
3915
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3916
|
+
var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
3855
3917
|
|
|
3856
3918
|
if (typeof params === 'undefined') {
|
|
3857
3919
|
return;
|
|
@@ -3877,14 +3939,47 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3877
3939
|
|
|
3878
3940
|
if (this.options.urlPrefix) {
|
|
3879
3941
|
inputPath = "/".concat(this.options.urlPrefix, "/").concat(inputPath);
|
|
3942
|
+
} // history.pushState({
|
|
3943
|
+
// inputPath
|
|
3944
|
+
// }, 'unused', `${inputPath}?${path}`)
|
|
3945
|
+
|
|
3946
|
+
|
|
3947
|
+
if (reloadView === true) {
|
|
3948
|
+
// this.showView(this.currentView, this.currentParams, 'main')
|
|
3949
|
+
this.navigate("".concat(inputPath, "?").concat(path), 'main', null, noHistory);
|
|
3880
3950
|
}
|
|
3951
|
+
}
|
|
3952
|
+
}, {
|
|
3953
|
+
key: "removeUrlParams",
|
|
3954
|
+
value: function removeUrlParams() {
|
|
3955
|
+
var _this25 = this;
|
|
3881
3956
|
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3957
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3958
|
+
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3959
|
+
var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
3960
|
+
this.previousParams = _extends({}, this.currentParams);
|
|
3961
|
+
var output = {
|
|
3962
|
+
path: '',
|
|
3963
|
+
items: {}
|
|
3964
|
+
};
|
|
3965
|
+
var path = '';
|
|
3966
|
+
|
|
3967
|
+
if (this.currentParams && this.currentParams.items) {
|
|
3968
|
+
params.forEach(function (p) {
|
|
3969
|
+
delete _this25.currentParams.items[p];
|
|
3970
|
+
});
|
|
3971
|
+
path = this.buildUrlPath(this.currentParams.items);
|
|
3972
|
+
}
|
|
3973
|
+
|
|
3974
|
+
var inputPath = this.currentView;
|
|
3975
|
+
|
|
3976
|
+
if (this.options.urlPrefix) {
|
|
3977
|
+
inputPath = "/".concat(this.options.urlPrefix, "/").concat(inputPath);
|
|
3978
|
+
}
|
|
3885
3979
|
|
|
3886
3980
|
if (reloadView === true) {
|
|
3887
|
-
this.showView(this.currentView, this.currentParams, 'main')
|
|
3981
|
+
// this.showView(this.currentView, this.currentParams, 'main')
|
|
3982
|
+
this.navigate("".concat(inputPath, "?").concat(path), 'main', null, noHistory);
|
|
3888
3983
|
}
|
|
3889
3984
|
}
|
|
3890
3985
|
}, {
|
|
@@ -3988,6 +4083,38 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3988
4083
|
|
|
3989
4084
|
return views;
|
|
3990
4085
|
}
|
|
4086
|
+
}, {
|
|
4087
|
+
key: "getParamValues",
|
|
4088
|
+
value: function getParamValues(param) {
|
|
4089
|
+
var output = [];
|
|
4090
|
+
|
|
4091
|
+
if (this.currentParams && this.currentParams.items && this.currentParams.items[param] && this.currentParams.items[param] !== '') {
|
|
4092
|
+
return this.currentParams.items[param].split('|').map(function (d) {
|
|
4093
|
+
return decodeURI(d);
|
|
4094
|
+
});
|
|
4095
|
+
}
|
|
4096
|
+
|
|
4097
|
+
return output;
|
|
4098
|
+
}
|
|
4099
|
+
}, {
|
|
4100
|
+
key: "getAPIQuery",
|
|
4101
|
+
value: function getAPIQuery() {
|
|
4102
|
+
var ignoredParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4103
|
+
|
|
4104
|
+
if (this.currentParams && this.currentParams.items) {
|
|
4105
|
+
var query = [];
|
|
4106
|
+
|
|
4107
|
+
for (var key in this.currentParams.items) {
|
|
4108
|
+
if (ignoredParams.indexOf(key) === -1) {
|
|
4109
|
+
query.push("".concat(key).concat(this.options.fieldValueSeparator).concat(this.currentParams.items[key]));
|
|
4110
|
+
}
|
|
4111
|
+
}
|
|
4112
|
+
|
|
4113
|
+
return query;
|
|
4114
|
+
}
|
|
4115
|
+
|
|
4116
|
+
return [];
|
|
4117
|
+
}
|
|
3991
4118
|
}, {
|
|
3992
4119
|
key: "handleClick",
|
|
3993
4120
|
value: function handleClick(event) {
|
|
@@ -4018,20 +4145,17 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4018
4145
|
url += "?".concat(params.path);
|
|
4019
4146
|
}
|
|
4020
4147
|
|
|
4021
|
-
this.currentView = view
|
|
4022
|
-
this.currentViewMain = view
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
if (view !== '') {
|
|
4033
|
-
this.showView(view, params, 'main');
|
|
4034
|
-
}
|
|
4148
|
+
this.navigate(url); // this.currentView = view
|
|
4149
|
+
// this.currentViewMain = view
|
|
4150
|
+
// if (this.currentView === '/' || this.currentView === '') {
|
|
4151
|
+
// this.currentView = this.options.defaultView
|
|
4152
|
+
// }
|
|
4153
|
+
// if (this.currentViewMain === '/' || this.currentViewMain === '') {
|
|
4154
|
+
// this.currentViewMain = this.options.defaultView
|
|
4155
|
+
// }
|
|
4156
|
+
// if (view !== '') {
|
|
4157
|
+
// this.showView(view, params, 'main')
|
|
4158
|
+
// }
|
|
4035
4159
|
}
|
|
4036
4160
|
}, {
|
|
4037
4161
|
key: "handleFocus",
|
|
@@ -4179,12 +4303,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4179
4303
|
}, {
|
|
4180
4304
|
key: "showComponents",
|
|
4181
4305
|
value: function showComponents(view) {
|
|
4182
|
-
var
|
|
4306
|
+
var _this26 = this;
|
|
4183
4307
|
|
|
4184
4308
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4185
4309
|
this.options.views[view].components.forEach(function (c) {
|
|
4186
4310
|
if (typeof c.instance === 'undefined') {
|
|
4187
|
-
|
|
4311
|
+
_this26.prepComponent(c.elementId, c.options);
|
|
4188
4312
|
|
|
4189
4313
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4190
4314
|
} else if (c.instance.render) {
|
|
@@ -4343,27 +4467,30 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4343
4467
|
inputPath = window.location.pathname.split('/').pop() + inputPath;
|
|
4344
4468
|
}
|
|
4345
4469
|
|
|
4346
|
-
if ((this.currentPath !==
|
|
4347
|
-
|
|
4348
|
-
var historyUrl = inputPath;
|
|
4470
|
+
if ((this.currentPath !== inputPath || previousParamsPath !== this.currentParams.path) && group === this.options.defaultGroup) {
|
|
4471
|
+
var historyUrl = inputPath;
|
|
4349
4472
|
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4473
|
+
if (this.options.urlPrefix) {
|
|
4474
|
+
historyUrl = historyUrl === '/' ? '' : "/".concat(historyUrl);
|
|
4475
|
+
inputPath = inputPath === '/' ? '' : "/".concat(inputPath);
|
|
4476
|
+
historyUrl = "/".concat(this.options.urlPrefix).concat(historyUrl).replace(/\/\//g, '/');
|
|
4477
|
+
inputPath = "/".concat(this.options.urlPrefix).concat(inputPath).replace(/\/\//g, '/');
|
|
4478
|
+
}
|
|
4356
4479
|
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4480
|
+
if (this.currentParams && this.currentParams.path) {
|
|
4481
|
+
historyUrl += "?".concat(this.currentParams.path);
|
|
4482
|
+
} else if (this.queryParams && this.options.persistentParameters === true) {
|
|
4483
|
+
historyUrl += "?".concat(this.queryParams);
|
|
4484
|
+
}
|
|
4362
4485
|
|
|
4486
|
+
if (popped === false) {
|
|
4363
4487
|
history.pushState({
|
|
4364
|
-
inputPath:
|
|
4365
|
-
},
|
|
4366
|
-
} else {
|
|
4488
|
+
inputPath: historyUrl
|
|
4489
|
+
}, 'unused', historyUrl);
|
|
4490
|
+
} else {
|
|
4491
|
+
history.replaceState({
|
|
4492
|
+
inputPath: historyUrl
|
|
4493
|
+
}, 'unused', historyUrl);
|
|
4367
4494
|
}
|
|
4368
4495
|
}
|
|
4369
4496
|
|
|
@@ -4558,7 +4685,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4558
4685
|
|
|
4559
4686
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4560
4687
|
function WebsyTemplate(elementId, options) {
|
|
4561
|
-
var
|
|
4688
|
+
var _this27 = this;
|
|
4562
4689
|
|
|
4563
4690
|
_classCallCheck(this, WebsyTemplate);
|
|
4564
4691
|
|
|
@@ -4584,9 +4711,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4584
4711
|
|
|
4585
4712
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4586
4713
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4587
|
-
|
|
4714
|
+
_this27.options.template = templateString;
|
|
4588
4715
|
|
|
4589
|
-
|
|
4716
|
+
_this27.render();
|
|
4590
4717
|
});
|
|
4591
4718
|
} else {
|
|
4592
4719
|
this.render();
|
|
@@ -4596,7 +4723,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4596
4723
|
_createClass(WebsyTemplate, [{
|
|
4597
4724
|
key: "buildHTML",
|
|
4598
4725
|
value: function buildHTML() {
|
|
4599
|
-
var
|
|
4726
|
+
var _this28 = this;
|
|
4600
4727
|
|
|
4601
4728
|
var html = "";
|
|
4602
4729
|
|
|
@@ -4658,14 +4785,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4658
4785
|
}
|
|
4659
4786
|
|
|
4660
4787
|
if (polarity === true) {
|
|
4661
|
-
if (typeof
|
|
4788
|
+
if (typeof _this28.options.data[parts[0]] !== 'undefined' && _this28.options.data[parts[0]] === parts[1]) {
|
|
4662
4789
|
// remove the <if> tags
|
|
4663
4790
|
removeAll = false;
|
|
4664
4791
|
} else if (parts[0] === parts[1]) {
|
|
4665
4792
|
removeAll = false;
|
|
4666
4793
|
}
|
|
4667
4794
|
} else if (polarity === false) {
|
|
4668
|
-
if (typeof
|
|
4795
|
+
if (typeof _this28.options.data[parts[0]] !== 'undefined' && _this28.options.data[parts[0]] !== parts[1]) {
|
|
4669
4796
|
// remove the <if> tags
|
|
4670
4797
|
removeAll = false;
|
|
4671
4798
|
}
|
|
@@ -4955,7 +5082,7 @@ var WebsyUtils = {
|
|
|
4955
5082
|
|
|
4956
5083
|
var WebsyTable = /*#__PURE__*/function () {
|
|
4957
5084
|
function WebsyTable(elementId, options) {
|
|
4958
|
-
var
|
|
5085
|
+
var _this29 = this;
|
|
4959
5086
|
|
|
4960
5087
|
_classCallCheck(this, WebsyTable);
|
|
4961
5088
|
|
|
@@ -4993,8 +5120,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4993
5120
|
allowClear: false,
|
|
4994
5121
|
disableSearch: true,
|
|
4995
5122
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4996
|
-
if (
|
|
4997
|
-
|
|
5123
|
+
if (_this29.options.onChangePageSize) {
|
|
5124
|
+
_this29.options.onChangePageSize(selectedItem.value);
|
|
4998
5125
|
}
|
|
4999
5126
|
}
|
|
5000
5127
|
});
|
|
@@ -5015,7 +5142,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5015
5142
|
_createClass(WebsyTable, [{
|
|
5016
5143
|
key: "appendRows",
|
|
5017
5144
|
value: function appendRows(data) {
|
|
5018
|
-
var
|
|
5145
|
+
var _this30 = this;
|
|
5019
5146
|
|
|
5020
5147
|
this.hideError();
|
|
5021
5148
|
var bodyHTML = '';
|
|
@@ -5023,15 +5150,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5023
5150
|
if (data) {
|
|
5024
5151
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5025
5152
|
return '<tr>' + r.map(function (c, i) {
|
|
5026
|
-
if (
|
|
5153
|
+
if (_this30.options.columns[i].show !== false) {
|
|
5027
5154
|
var style = '';
|
|
5028
5155
|
|
|
5029
5156
|
if (c.style) {
|
|
5030
5157
|
style += c.style;
|
|
5031
5158
|
}
|
|
5032
5159
|
|
|
5033
|
-
if (
|
|
5034
|
-
style += "width: ".concat(
|
|
5160
|
+
if (_this30.options.columns[i].width) {
|
|
5161
|
+
style += "width: ".concat(_this30.options.columns[i].width, "; ");
|
|
5035
5162
|
}
|
|
5036
5163
|
|
|
5037
5164
|
if (c.backgroundColor) {
|
|
@@ -5046,18 +5173,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5046
5173
|
style += "color: ".concat(c.color, "; ");
|
|
5047
5174
|
}
|
|
5048
5175
|
|
|
5049
|
-
if (
|
|
5050
|
-
return "\n <td \n data-row-index='".concat(
|
|
5051
|
-
} else if ((
|
|
5052
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5176
|
+
if (_this30.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5177
|
+
return "\n <td \n data-row-index='".concat(_this30.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this30.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(_this30.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this30.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5178
|
+
} else if ((_this30.options.columns[i].showAsNavigatorLink === true || _this30.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5179
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this30.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this30.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this30.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this30.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5053
5180
|
} else {
|
|
5054
5181
|
var info = c.value;
|
|
5055
5182
|
|
|
5056
|
-
if (
|
|
5183
|
+
if (_this30.options.columns[i].showAsImage === true) {
|
|
5057
5184
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5058
5185
|
}
|
|
5059
5186
|
|
|
5060
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5187
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this30.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this30.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 ");
|
|
5061
5188
|
}
|
|
5062
5189
|
}
|
|
5063
5190
|
}).join('') + '</tr>';
|
|
@@ -5229,7 +5356,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5229
5356
|
}, {
|
|
5230
5357
|
key: "render",
|
|
5231
5358
|
value: function render(data) {
|
|
5232
|
-
var
|
|
5359
|
+
var _this31 = this;
|
|
5233
5360
|
|
|
5234
5361
|
if (!this.options.columns) {
|
|
5235
5362
|
return;
|
|
@@ -5264,7 +5391,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5264
5391
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5265
5392
|
}
|
|
5266
5393
|
|
|
5267
|
-
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 ?
|
|
5394
|
+
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 ? _this31.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
5268
5395
|
}
|
|
5269
5396
|
}).join('') + '</tr>';
|
|
5270
5397
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5283,7 +5410,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5283
5410
|
|
|
5284
5411
|
if (pagingEl) {
|
|
5285
5412
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5286
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5413
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this31.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5287
5414
|
});
|
|
5288
5415
|
var startIndex = 0;
|
|
5289
5416
|
|
|
@@ -5351,7 +5478,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5351
5478
|
|
|
5352
5479
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5353
5480
|
function WebsyTable2(elementId, options) {
|
|
5354
|
-
var
|
|
5481
|
+
var _this32 = this;
|
|
5355
5482
|
|
|
5356
5483
|
_classCallCheck(this, WebsyTable2);
|
|
5357
5484
|
|
|
@@ -5392,8 +5519,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5392
5519
|
allowClear: false,
|
|
5393
5520
|
disableSearch: true,
|
|
5394
5521
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5395
|
-
if (
|
|
5396
|
-
|
|
5522
|
+
if (_this32.options.onChangePageSize) {
|
|
5523
|
+
_this32.options.onChangePageSize(selectedItem.value);
|
|
5397
5524
|
}
|
|
5398
5525
|
}
|
|
5399
5526
|
});
|
|
@@ -5417,7 +5544,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5417
5544
|
_createClass(WebsyTable2, [{
|
|
5418
5545
|
key: "appendRows",
|
|
5419
5546
|
value: function appendRows(data) {
|
|
5420
|
-
var
|
|
5547
|
+
var _this33 = this;
|
|
5421
5548
|
|
|
5422
5549
|
this.hideError();
|
|
5423
5550
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -5426,15 +5553,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5426
5553
|
if (data) {
|
|
5427
5554
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5428
5555
|
return '<tr>' + r.map(function (c, i) {
|
|
5429
|
-
if (
|
|
5430
|
-
var style = "height: ".concat(
|
|
5556
|
+
if (_this33.options.columns[i].show !== false) {
|
|
5557
|
+
var style = "height: ".concat(_this33.options.cellSize, "px; line-height: ").concat(_this33.options.cellSize, "px;");
|
|
5431
5558
|
|
|
5432
5559
|
if (c.style) {
|
|
5433
5560
|
style += c.style;
|
|
5434
5561
|
}
|
|
5435
5562
|
|
|
5436
|
-
if (
|
|
5437
|
-
style += "width: ".concat(
|
|
5563
|
+
if (_this33.options.columns[i].width) {
|
|
5564
|
+
style += "width: ".concat(_this33.options.columns[i].width, "; ");
|
|
5438
5565
|
}
|
|
5439
5566
|
|
|
5440
5567
|
if (c.backgroundColor) {
|
|
@@ -5449,18 +5576,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5449
5576
|
style += "color: ".concat(c.color, "; ");
|
|
5450
5577
|
}
|
|
5451
5578
|
|
|
5452
|
-
if (
|
|
5453
|
-
return "\n <td \n data-row-index='".concat(
|
|
5454
|
-
} else if ((
|
|
5455
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5579
|
+
if (_this33.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5580
|
+
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 ");
|
|
5581
|
+
} else if ((_this33.options.columns[i].showAsNavigatorLink === true || _this33.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5582
|
+
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 ");
|
|
5456
5583
|
} else {
|
|
5457
5584
|
var info = c.value;
|
|
5458
5585
|
|
|
5459
|
-
if (
|
|
5586
|
+
if (_this33.options.columns[i].showAsImage === true) {
|
|
5460
5587
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5461
5588
|
}
|
|
5462
5589
|
|
|
5463
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5590
|
+
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 ");
|
|
5464
5591
|
}
|
|
5465
5592
|
}
|
|
5466
5593
|
}).join('') + '</tr>';
|
|
@@ -5723,7 +5850,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5723
5850
|
}, {
|
|
5724
5851
|
key: "render",
|
|
5725
5852
|
value: function render(data) {
|
|
5726
|
-
var
|
|
5853
|
+
var _this34 = this;
|
|
5727
5854
|
|
|
5728
5855
|
if (!this.options.columns) {
|
|
5729
5856
|
return;
|
|
@@ -5759,7 +5886,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5759
5886
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5760
5887
|
}
|
|
5761
5888
|
|
|
5762
|
-
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 ?
|
|
5889
|
+
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 ? _this34.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5763
5890
|
}
|
|
5764
5891
|
}).join('') + '</tr>';
|
|
5765
5892
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5770,7 +5897,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5770
5897
|
var dropdownHTML = "";
|
|
5771
5898
|
this.options.columns.forEach(function (c, i) {
|
|
5772
5899
|
if (c.searchable && c.searchField) {
|
|
5773
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5900
|
+
dropdownHTML += "\n <div id=\"".concat(_this34.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
5774
5901
|
}
|
|
5775
5902
|
});
|
|
5776
5903
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5792,7 +5919,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5792
5919
|
|
|
5793
5920
|
if (pagingEl) {
|
|
5794
5921
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5795
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5922
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this34.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5796
5923
|
});
|
|
5797
5924
|
var startIndex = 0;
|
|
5798
5925
|
|
|
@@ -5883,7 +6010,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5883
6010
|
}, {
|
|
5884
6011
|
key: "getColumnParameters",
|
|
5885
6012
|
value: function getColumnParameters(values) {
|
|
5886
|
-
var
|
|
6013
|
+
var _this35 = this;
|
|
5887
6014
|
|
|
5888
6015
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
5889
6016
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -5891,10 +6018,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5891
6018
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
5892
6019
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5893
6020
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
5894
|
-
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 ?
|
|
6021
|
+
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 ? _this35.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5895
6022
|
}).join('') + '</tr>';
|
|
5896
6023
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
5897
|
-
return "\n <td \n style='height: ".concat(
|
|
6024
|
+
return "\n <td \n style='height: ".concat(_this35.options.cellSize, "px; line-height: ").concat(_this35.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
5898
6025
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
5899
6026
|
|
|
5900
6027
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -6099,7 +6226,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6099
6226
|
}, {
|
|
6100
6227
|
key: "buildHeaderHtml",
|
|
6101
6228
|
value: function buildHeaderHtml() {
|
|
6102
|
-
var
|
|
6229
|
+
var _this36 = this;
|
|
6103
6230
|
|
|
6104
6231
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6105
6232
|
var headerHtml = '';
|
|
@@ -6114,7 +6241,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6114
6241
|
}
|
|
6115
6242
|
|
|
6116
6243
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6117
|
-
if (useWidths === false && rowIndex !==
|
|
6244
|
+
if (useWidths === false && rowIndex !== _this36.options.columns.length - 1) {
|
|
6118
6245
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6119
6246
|
return;
|
|
6120
6247
|
}
|
|
@@ -6140,18 +6267,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6140
6267
|
// `
|
|
6141
6268
|
// }
|
|
6142
6269
|
|
|
6143
|
-
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ?
|
|
6270
|
+
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ? _this36.buildSearchIcon(col, colIndex) : '', "</div></td>");
|
|
6144
6271
|
});
|
|
6145
6272
|
headerHtml += "</tr>";
|
|
6146
6273
|
});
|
|
6147
6274
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6148
6275
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6149
6276
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6150
|
-
var testEl = document.getElementById("".concat(
|
|
6277
|
+
var testEl = document.getElementById("".concat(_this36.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6151
6278
|
|
|
6152
6279
|
if (!testEl) {
|
|
6153
6280
|
var newE = document.createElement('div');
|
|
6154
|
-
newE.id = "".concat(
|
|
6281
|
+
newE.id = "".concat(_this36.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6155
6282
|
newE.className = 'websy-modal-dropdown';
|
|
6156
6283
|
dropdownEl.appendChild(newE);
|
|
6157
6284
|
}
|
|
@@ -6167,7 +6294,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6167
6294
|
}, {
|
|
6168
6295
|
key: "buildTotalHtml",
|
|
6169
6296
|
value: function buildTotalHtml() {
|
|
6170
|
-
var
|
|
6297
|
+
var _this37 = this;
|
|
6171
6298
|
|
|
6172
6299
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6173
6300
|
|
|
@@ -6180,7 +6307,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6180
6307
|
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6181
6308
|
|
|
6182
6309
|
if (useWidths === true) {
|
|
6183
|
-
totalHtml += "\n style='width: ".concat(
|
|
6310
|
+
totalHtml += "\n style='width: ".concat(_this37.options.columns[_this37.options.columns.length - 1][colIndex].width || _this37.options.columns[_this37.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6184
6311
|
}
|
|
6185
6312
|
|
|
6186
6313
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -6191,7 +6318,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6191
6318
|
}, {
|
|
6192
6319
|
key: "calculateSizes",
|
|
6193
6320
|
value: function calculateSizes() {
|
|
6194
|
-
var
|
|
6321
|
+
var _this38 = this;
|
|
6195
6322
|
|
|
6196
6323
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6197
6324
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -6234,32 +6361,32 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6234
6361
|
rows.forEach(function (row, rowIndex) {
|
|
6235
6362
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6236
6363
|
var colSize = col.getBoundingClientRect();
|
|
6237
|
-
|
|
6364
|
+
_this38.sizes.cellHeight = colSize.height;
|
|
6238
6365
|
|
|
6239
|
-
if (
|
|
6240
|
-
if (!
|
|
6241
|
-
|
|
6366
|
+
if (_this38.options.columns[_this38.options.columns.length - 1][colIndex]) {
|
|
6367
|
+
if (!_this38.options.columns[_this38.options.columns.length - 1][colIndex].actualWidth) {
|
|
6368
|
+
_this38.options.columns[_this38.options.columns.length - 1][colIndex].actualWidth = 0;
|
|
6242
6369
|
}
|
|
6243
6370
|
|
|
6244
|
-
|
|
6245
|
-
|
|
6371
|
+
_this38.options.columns[_this38.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this38.options.columns[_this38.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
|
|
6372
|
+
_this38.options.columns[_this38.options.columns.length - 1][colIndex].cellHeight = colSize.height;
|
|
6246
6373
|
|
|
6247
|
-
if (colIndex >=
|
|
6248
|
-
firstNonPinnedColumnWidth =
|
|
6374
|
+
if (colIndex >= _this38.pinnedColumns) {
|
|
6375
|
+
firstNonPinnedColumnWidth = _this38.options.columns[_this38.options.columns.length - 1][colIndex].actualWidth;
|
|
6249
6376
|
}
|
|
6250
6377
|
}
|
|
6251
6378
|
});
|
|
6252
6379
|
});
|
|
6253
6380
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6254
|
-
if (colIndex <
|
|
6255
|
-
|
|
6381
|
+
if (colIndex < _this38.pinnedColumns) {
|
|
6382
|
+
_this38.sizes.scrollableWidth -= col.actualWidth;
|
|
6256
6383
|
}
|
|
6257
6384
|
});
|
|
6258
6385
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6259
6386
|
return a + (b.width || b.actualWidth);
|
|
6260
6387
|
}, 0);
|
|
6261
6388
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6262
|
-
return i >=
|
|
6389
|
+
return i >= _this38.pinnedColumns;
|
|
6263
6390
|
}).reduce(function (a, b) {
|
|
6264
6391
|
return a + (b.width || b.actualWidth);
|
|
6265
6392
|
}, 0);
|
|
@@ -6280,10 +6407,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6280
6407
|
c.actualWidth += equalWidth; // }
|
|
6281
6408
|
// }
|
|
6282
6409
|
|
|
6283
|
-
|
|
6410
|
+
_this38.sizes.totalWidth += c.width || c.actualWidth;
|
|
6284
6411
|
|
|
6285
|
-
if (i <
|
|
6286
|
-
|
|
6412
|
+
if (i < _this38.pinnedColumns) {
|
|
6413
|
+
_this38.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6287
6414
|
} // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6288
6415
|
|
|
6289
6416
|
});
|
|
@@ -6741,7 +6868,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6741
6868
|
|
|
6742
6869
|
var WebsyChart = /*#__PURE__*/function () {
|
|
6743
6870
|
function WebsyChart(elementId, options) {
|
|
6744
|
-
var
|
|
6871
|
+
var _this39 = this;
|
|
6745
6872
|
|
|
6746
6873
|
_classCallCheck(this, WebsyChart);
|
|
6747
6874
|
|
|
@@ -6782,6 +6909,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6782
6909
|
this.rightAxis = null;
|
|
6783
6910
|
this.topAxis = null;
|
|
6784
6911
|
this.bottomAxis = null;
|
|
6912
|
+
this.renderedKeys = {};
|
|
6785
6913
|
|
|
6786
6914
|
if (!elementId) {
|
|
6787
6915
|
console.log('No element Id provided for Websy Chart');
|
|
@@ -6791,22 +6919,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6791
6919
|
this.invertOverride = function (input, input2) {
|
|
6792
6920
|
var xAxis = 'bottomAxis';
|
|
6793
6921
|
|
|
6794
|
-
if (
|
|
6922
|
+
if (_this39.options.orientation === 'horizontal') {
|
|
6795
6923
|
xAxis = 'leftAxis';
|
|
6796
6924
|
}
|
|
6797
6925
|
|
|
6798
|
-
var width =
|
|
6926
|
+
var width = _this39[xAxis].step();
|
|
6799
6927
|
|
|
6800
6928
|
var output;
|
|
6801
6929
|
|
|
6802
|
-
var domain = _toConsumableArray(
|
|
6930
|
+
var domain = _toConsumableArray(_this39[xAxis].domain());
|
|
6803
6931
|
|
|
6804
|
-
if (
|
|
6932
|
+
if (_this39.options.orientation === 'horizontal') {
|
|
6805
6933
|
domain = domain.reverse();
|
|
6806
6934
|
}
|
|
6807
6935
|
|
|
6808
6936
|
for (var j = 0; j < domain.length; j++) {
|
|
6809
|
-
var breakA =
|
|
6937
|
+
var breakA = _this39[xAxis](domain[j]) - width / 2;
|
|
6810
6938
|
var breakB = breakA + width;
|
|
6811
6939
|
|
|
6812
6940
|
if (input > breakA && input <= breakB) {
|
|
@@ -6906,10 +7034,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6906
7034
|
}, {
|
|
6907
7035
|
key: "handleEventMouseMove",
|
|
6908
7036
|
value: function handleEventMouseMove(event, d) {
|
|
6909
|
-
var
|
|
7037
|
+
var _this40 = this;
|
|
6910
7038
|
|
|
6911
7039
|
var bisectDate = d3.bisector(function (d) {
|
|
6912
|
-
return
|
|
7040
|
+
return _this40.parseX(d.x.value);
|
|
6913
7041
|
}).left;
|
|
6914
7042
|
|
|
6915
7043
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -6948,8 +7076,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6948
7076
|
}
|
|
6949
7077
|
|
|
6950
7078
|
this.options.data.series.forEach(function (s) {
|
|
6951
|
-
if (
|
|
6952
|
-
xPoint =
|
|
7079
|
+
if (_this40.options.data[xData].scale !== 'Time') {
|
|
7080
|
+
xPoint = _this40[xAxis](_this40.parseX(xLabel));
|
|
6953
7081
|
s.data.forEach(function (d) {
|
|
6954
7082
|
if (d.x.value === xLabel) {
|
|
6955
7083
|
if (!tooltipTitle) {
|
|
@@ -6968,13 +7096,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6968
7096
|
var pointA = s.data[index - 1];
|
|
6969
7097
|
var pointB = s.data[index];
|
|
6970
7098
|
|
|
6971
|
-
if (
|
|
7099
|
+
if (_this40.options.orientation === 'horizontal') {
|
|
6972
7100
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
6973
7101
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
6974
7102
|
}
|
|
6975
7103
|
|
|
6976
7104
|
if (pointA && !pointB) {
|
|
6977
|
-
xPoint =
|
|
7105
|
+
xPoint = _this40[xAxis](_this40.parseX(pointA.x.value));
|
|
6978
7106
|
tooltipTitle = pointA.x.value;
|
|
6979
7107
|
|
|
6980
7108
|
if (!pointA.y.color) {
|
|
@@ -6984,12 +7112,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6984
7112
|
tooltipData.push(pointA.y);
|
|
6985
7113
|
|
|
6986
7114
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
6987
|
-
tooltipTitle = d3.timeFormat(
|
|
7115
|
+
tooltipTitle = d3.timeFormat(_this40.options.dateFormat || _this40.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
6988
7116
|
}
|
|
6989
7117
|
}
|
|
6990
7118
|
|
|
6991
7119
|
if (pointB && !pointA) {
|
|
6992
|
-
xPoint =
|
|
7120
|
+
xPoint = _this40[xAxis](_this40.parseX(pointB.x.value));
|
|
6993
7121
|
tooltipTitle = pointB.x.value;
|
|
6994
7122
|
|
|
6995
7123
|
if (!pointB.y.color) {
|
|
@@ -6999,14 +7127,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6999
7127
|
tooltipData.push(pointB.y);
|
|
7000
7128
|
|
|
7001
7129
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7002
|
-
tooltipTitle = d3.timeFormat(
|
|
7130
|
+
tooltipTitle = d3.timeFormat(_this40.options.dateFormat || _this40.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7003
7131
|
}
|
|
7004
7132
|
}
|
|
7005
7133
|
|
|
7006
7134
|
if (pointA && pointB) {
|
|
7007
|
-
var d0 =
|
|
7135
|
+
var d0 = _this40[xAxis](_this40.parseX(pointA.x.value));
|
|
7008
7136
|
|
|
7009
|
-
var d1 =
|
|
7137
|
+
var d1 = _this40[xAxis](_this40.parseX(pointB.x.value));
|
|
7010
7138
|
|
|
7011
7139
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7012
7140
|
|
|
@@ -7015,7 +7143,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7015
7143
|
tooltipTitle = pointB.x.value;
|
|
7016
7144
|
|
|
7017
7145
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7018
|
-
tooltipTitle = d3.timeFormat(
|
|
7146
|
+
tooltipTitle = d3.timeFormat(_this40.options.dateFormat || _this40.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7019
7147
|
}
|
|
7020
7148
|
|
|
7021
7149
|
if (!pointB.y.color) {
|
|
@@ -7028,7 +7156,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7028
7156
|
tooltipTitle = pointA.x.value;
|
|
7029
7157
|
|
|
7030
7158
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7031
|
-
tooltipTitle = d3.timeFormat(
|
|
7159
|
+
tooltipTitle = d3.timeFormat(_this40.options.dateFormat || _this40.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7032
7160
|
}
|
|
7033
7161
|
|
|
7034
7162
|
if (!pointA.y.color) {
|
|
@@ -7142,7 +7270,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7142
7270
|
}, {
|
|
7143
7271
|
key: "render",
|
|
7144
7272
|
value: function render(options) {
|
|
7145
|
-
var
|
|
7273
|
+
var _this41 = this;
|
|
7146
7274
|
|
|
7147
7275
|
/* global d3 options WebsyUtils */
|
|
7148
7276
|
if (typeof options !== 'undefined') {
|
|
@@ -7211,7 +7339,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7211
7339
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
7212
7340
|
return {
|
|
7213
7341
|
value: s.label || s.key,
|
|
7214
|
-
color: s.color ||
|
|
7342
|
+
color: s.color || _this41.options.colors[i % _this41.options.colors.length]
|
|
7215
7343
|
};
|
|
7216
7344
|
});
|
|
7217
7345
|
|
|
@@ -7493,7 +7621,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7493
7621
|
|
|
7494
7622
|
if (this.options.data.bottom.formatter) {
|
|
7495
7623
|
bAxisFunc.tickFormat(function (d) {
|
|
7496
|
-
return
|
|
7624
|
+
return _this41.options.data.bottom.formatter(d);
|
|
7497
7625
|
});
|
|
7498
7626
|
}
|
|
7499
7627
|
|
|
@@ -7519,8 +7647,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7519
7647
|
|
|
7520
7648
|
if (this.options.margin.axisLeft > 0) {
|
|
7521
7649
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7522
|
-
if (
|
|
7523
|
-
d =
|
|
7650
|
+
if (_this41.options.data.left.formatter) {
|
|
7651
|
+
d = _this41.options.data.left.formatter(d);
|
|
7524
7652
|
}
|
|
7525
7653
|
|
|
7526
7654
|
return d;
|
|
@@ -7557,8 +7685,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7557
7685
|
|
|
7558
7686
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
7559
7687
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7560
|
-
if (
|
|
7561
|
-
d =
|
|
7688
|
+
if (_this41.options.data.right.formatter) {
|
|
7689
|
+
d = _this41.options.data.right.formatter(d);
|
|
7562
7690
|
}
|
|
7563
7691
|
|
|
7564
7692
|
return d;
|
|
@@ -7579,21 +7707,36 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7579
7707
|
}
|
|
7580
7708
|
} else {// put the title horizontally on the top
|
|
7581
7709
|
}
|
|
7710
|
+
} // Remove the unnecessary series
|
|
7711
|
+
|
|
7712
|
+
|
|
7713
|
+
var newKeys = this.options.data.series.map(function (s) {
|
|
7714
|
+
return s.key;
|
|
7715
|
+
});
|
|
7716
|
+
|
|
7717
|
+
for (var key in this.renderedKeys) {
|
|
7718
|
+
if (newKeys.indexOf(key) === -1) {
|
|
7719
|
+
// remove the components
|
|
7720
|
+
this["remove".concat(this.renderedKeys[key])](key);
|
|
7721
|
+
}
|
|
7582
7722
|
} // Draw the series data
|
|
7583
7723
|
|
|
7584
7724
|
|
|
7725
|
+
this.renderedKeys = {};
|
|
7585
7726
|
this.options.data.series.forEach(function (series, index) {
|
|
7586
7727
|
if (!series.key) {
|
|
7587
|
-
series.key =
|
|
7728
|
+
series.key = _this41.createIdentity();
|
|
7588
7729
|
}
|
|
7589
7730
|
|
|
7590
7731
|
if (!series.color) {
|
|
7591
|
-
series.color =
|
|
7732
|
+
series.color = _this41.options.colors[index % _this41.options.colors.length];
|
|
7592
7733
|
}
|
|
7593
7734
|
|
|
7594
|
-
|
|
7735
|
+
_this41["render".concat(series.type || 'bar')](series, index);
|
|
7736
|
+
|
|
7737
|
+
_this41.renderLabels(series, index);
|
|
7595
7738
|
|
|
7596
|
-
|
|
7739
|
+
_this41.renderedKeys[series.key] = series.type;
|
|
7597
7740
|
});
|
|
7598
7741
|
}
|
|
7599
7742
|
}
|
|
@@ -7601,17 +7744,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7601
7744
|
}, {
|
|
7602
7745
|
key: "renderarea",
|
|
7603
7746
|
value: function renderarea(series, index) {
|
|
7604
|
-
var
|
|
7747
|
+
var _this42 = this;
|
|
7605
7748
|
|
|
7606
7749
|
/* global d3 series index */
|
|
7607
7750
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
7608
7751
|
return d3.area().x(function (d) {
|
|
7609
|
-
return
|
|
7752
|
+
return _this42[xAxis](_this42.parseX(d.x.value));
|
|
7610
7753
|
}).y0(function (d) {
|
|
7611
|
-
return
|
|
7754
|
+
return _this42[yAxis](0);
|
|
7612
7755
|
}).y1(function (d) {
|
|
7613
|
-
return
|
|
7614
|
-
}).curve(d3[curveStyle ||
|
|
7756
|
+
return _this42[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7757
|
+
}).curve(d3[curveStyle || _this42.options.curveStyle]);
|
|
7615
7758
|
};
|
|
7616
7759
|
|
|
7617
7760
|
var xAxis = 'bottomAxis';
|
|
@@ -7734,7 +7877,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7734
7877
|
}, {
|
|
7735
7878
|
key: "renderLabels",
|
|
7736
7879
|
value: function renderLabels(series, index) {
|
|
7737
|
-
var
|
|
7880
|
+
var _this43 = this;
|
|
7738
7881
|
|
|
7739
7882
|
/* global series index d3 WebsyDesigns */
|
|
7740
7883
|
var xAxis = 'bottomAxis';
|
|
@@ -7753,11 +7896,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7753
7896
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
7754
7897
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
7755
7898
|
labels.attr('x', function (d) {
|
|
7756
|
-
return getLabelX.call(
|
|
7899
|
+
return getLabelX.call(_this43, d, series.labelPosition);
|
|
7757
7900
|
}).attr('y', function (d) {
|
|
7758
|
-
return getLabelY.call(
|
|
7901
|
+
return getLabelY.call(_this43, d, series.labelPosition);
|
|
7759
7902
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
7760
|
-
return
|
|
7903
|
+
return _this43.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7761
7904
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
7762
7905
|
return d.y.label || d.y.value;
|
|
7763
7906
|
}).each(function (d, i) {
|
|
@@ -7782,11 +7925,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7782
7925
|
}
|
|
7783
7926
|
});
|
|
7784
7927
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
7785
|
-
return getLabelX.call(
|
|
7928
|
+
return getLabelX.call(_this43, d, series.labelPosition);
|
|
7786
7929
|
}).attr('y', function (d) {
|
|
7787
|
-
return getLabelY.call(
|
|
7930
|
+
return getLabelY.call(_this43, d, series.labelPosition);
|
|
7788
7931
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
7789
|
-
return
|
|
7932
|
+
return _this43.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7790
7933
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
7791
7934
|
return d.y.label || d.y.value;
|
|
7792
7935
|
}).each(function (d, i) {
|
|
@@ -7843,16 +7986,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7843
7986
|
}, {
|
|
7844
7987
|
key: "renderline",
|
|
7845
7988
|
value: function renderline(series, index) {
|
|
7846
|
-
var
|
|
7989
|
+
var _this44 = this;
|
|
7847
7990
|
|
|
7848
7991
|
/* global series index d3 */
|
|
7849
7992
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
7850
7993
|
return d3.line().x(function (d) {
|
|
7851
|
-
var adjustment =
|
|
7852
|
-
return
|
|
7994
|
+
var adjustment = _this44.options.data[xAxis].scale === 'Time' ? 0 : _this44["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
7995
|
+
return _this44["".concat(xAxis, "Axis")](_this44.parseX(d.x.value)) + adjustment;
|
|
7853
7996
|
}).y(function (d) {
|
|
7854
|
-
return
|
|
7855
|
-
}).curve(d3[curveStyle ||
|
|
7997
|
+
return _this44["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7998
|
+
}).curve(d3[curveStyle || _this44.options.curveStyle]);
|
|
7856
7999
|
};
|
|
7857
8000
|
|
|
7858
8001
|
var xAxis = 'bottom';
|
|
@@ -7887,17 +8030,23 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7887
8030
|
this.rendersymbol(series, index);
|
|
7888
8031
|
}
|
|
7889
8032
|
}
|
|
8033
|
+
}, {
|
|
8034
|
+
key: "removeline",
|
|
8035
|
+
value: function removeline(key) {
|
|
8036
|
+
/* global key d3 */
|
|
8037
|
+
var lines = this.lineLayer.selectAll(".line_".concat(key)).transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
8038
|
+
}
|
|
7890
8039
|
}, {
|
|
7891
8040
|
key: "rendersymbol",
|
|
7892
8041
|
value: function rendersymbol(series, index) {
|
|
7893
|
-
var
|
|
8042
|
+
var _this45 = this;
|
|
7894
8043
|
|
|
7895
8044
|
/* global d3 series index series.key */
|
|
7896
8045
|
var drawSymbol = function drawSymbol(size) {
|
|
7897
8046
|
return d3.symbol() // .type(d => {
|
|
7898
8047
|
// return d3.symbols[0]
|
|
7899
8048
|
// })
|
|
7900
|
-
.size(size ||
|
|
8049
|
+
.size(size || _this45.options.symbolSize);
|
|
7901
8050
|
};
|
|
7902
8051
|
|
|
7903
8052
|
var xAxis = 'bottomAxis';
|
|
@@ -7915,7 +8064,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7915
8064
|
symbols.attr('d', function (d) {
|
|
7916
8065
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
7917
8066
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
7918
|
-
return "translate(".concat(
|
|
8067
|
+
return "translate(".concat(_this45[xAxis](_this45.parseX(d.x.value)), ", ").concat(_this45[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
7919
8068
|
}); // Enter
|
|
7920
8069
|
|
|
7921
8070
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -7924,7 +8073,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7924
8073
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
7925
8074
|
return "symbol symbol_".concat(series.key);
|
|
7926
8075
|
}).attr('transform', function (d) {
|
|
7927
|
-
return "translate(".concat(
|
|
8076
|
+
return "translate(".concat(_this45[xAxis](_this45.parseX(d.x.value)), ", ").concat(_this45[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
7928
8077
|
});
|
|
7929
8078
|
}
|
|
7930
8079
|
}, {
|
|
@@ -8079,7 +8228,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8079
8228
|
}, {
|
|
8080
8229
|
key: "resize",
|
|
8081
8230
|
value: function resize() {
|
|
8082
|
-
var
|
|
8231
|
+
var _this46 = this;
|
|
8083
8232
|
|
|
8084
8233
|
var el = document.getElementById(this.elementId);
|
|
8085
8234
|
|
|
@@ -8092,7 +8241,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8092
8241
|
// }
|
|
8093
8242
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
8094
8243
|
html += this._data.map(function (d, i) {
|
|
8095
|
-
return
|
|
8244
|
+
return _this46.getLegendItemHTML(d);
|
|
8096
8245
|
}).join('');
|
|
8097
8246
|
html += "\n <div>\n ";
|
|
8098
8247
|
el.innerHTML = html;
|
|
@@ -8264,7 +8413,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8264
8413
|
}, {
|
|
8265
8414
|
key: "render",
|
|
8266
8415
|
value: function render() {
|
|
8267
|
-
var
|
|
8416
|
+
var _this47 = this;
|
|
8268
8417
|
|
|
8269
8418
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
8270
8419
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -8273,7 +8422,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8273
8422
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
8274
8423
|
return {
|
|
8275
8424
|
value: s.label || s.key,
|
|
8276
|
-
color: s.color ||
|
|
8425
|
+
color: s.color || _this47.options.colors[i % _this47.options.colors.length]
|
|
8277
8426
|
};
|
|
8278
8427
|
});
|
|
8279
8428
|
var longestValue = legendData.map(function (s) {
|
|
@@ -8337,7 +8486,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8337
8486
|
|
|
8338
8487
|
if (this.polygons) {
|
|
8339
8488
|
this.polygons.forEach(function (p) {
|
|
8340
|
-
return
|
|
8489
|
+
return _this47.map.removeLayer(p);
|
|
8341
8490
|
});
|
|
8342
8491
|
}
|
|
8343
8492
|
|
|
@@ -8395,18 +8544,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8395
8544
|
}
|
|
8396
8545
|
|
|
8397
8546
|
if (!p.options.color) {
|
|
8398
|
-
p.options.color =
|
|
8547
|
+
p.options.color = _this47.options.colors[i % _this47.options.colors.length];
|
|
8399
8548
|
}
|
|
8400
8549
|
|
|
8401
8550
|
var pol = L.polygon(p.data.map(function (c) {
|
|
8402
8551
|
return c.map(function (d) {
|
|
8403
8552
|
return [d.Latitude, d.Longitude];
|
|
8404
8553
|
});
|
|
8405
|
-
}), p.options).addTo(
|
|
8554
|
+
}), p.options).addTo(_this47.map);
|
|
8406
8555
|
|
|
8407
|
-
|
|
8556
|
+
_this47.polygons.push(pol);
|
|
8408
8557
|
|
|
8409
|
-
|
|
8558
|
+
_this47.map.fitBounds(pol.getBounds());
|
|
8410
8559
|
});
|
|
8411
8560
|
} // if (this.data.markers.length > 0) {
|
|
8412
8561
|
// el.classList.remove('hidden')
|