@websy/websy-designs 1.2.6 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/websy-designs-es6.debug.js +84 -22
- package/dist/websy-designs-es6.js +312 -230
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +84 -22
- package/dist/websy-designs.js +312 -230
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
package/dist/websy-designs.js
CHANGED
|
@@ -490,11 +490,13 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
490
490
|
this.currentselection = [];
|
|
491
491
|
this.validDates = [];
|
|
492
492
|
this.validYears = [];
|
|
493
|
+
this.validHours = [];
|
|
493
494
|
this.customRangeSelected = true;
|
|
494
495
|
this.shiftPressed = false;
|
|
495
496
|
var DEFAULTS = {
|
|
496
497
|
defaultRange: 0,
|
|
497
498
|
allowClear: true,
|
|
499
|
+
hideRanges: false,
|
|
498
500
|
minAllowedDate: this.floorDate(new Date(new Date(new Date().setFullYear(new Date().getFullYear() - 1)).setDate(1))),
|
|
499
501
|
maxAllowedDate: this.floorDate(new Date(new Date())),
|
|
500
502
|
minAllowedYear: 1970,
|
|
@@ -502,7 +504,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
502
504
|
daysOfWeek: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
|
|
503
505
|
monthsOfYear: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
504
506
|
hours: new Array(24).fill(0).map(function (d, i) {
|
|
505
|
-
return
|
|
507
|
+
return {
|
|
508
|
+
text: (i < 10 ? '0' : '') + i + ':00',
|
|
509
|
+
num: 1 / 24 * i
|
|
510
|
+
};
|
|
506
511
|
}),
|
|
507
512
|
mode: 'date',
|
|
508
513
|
monthMap: {
|
|
@@ -570,7 +575,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
570
575
|
label: 'Last 24 Months',
|
|
571
576
|
range: [this.floorDate(new Date(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() - 24))), this.floorDate(new Date(new Date().setDate(1)))]
|
|
572
577
|
}],
|
|
573
|
-
hour: [
|
|
578
|
+
hour: [{
|
|
579
|
+
label: 'All',
|
|
580
|
+
range: ['00:00', '23:00']
|
|
581
|
+
}]
|
|
574
582
|
};
|
|
575
583
|
this.options = _extends({}, DEFAULTS, options);
|
|
576
584
|
this.selectedRange = this.options.defaultRange || 0;
|
|
@@ -600,7 +608,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
600
608
|
html += "\n <svg class='clear-selection' xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 512 512\"><title>ionicons-v5-l</title><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>\n ";
|
|
601
609
|
}
|
|
602
610
|
|
|
603
|
-
html += "\n </div>\n <div id='".concat(this.elementId, "_mask' class='websy-date-picker-mask'></div>\n <div id='").concat(this.elementId, "_content' class='websy-date-picker-content'>\n <div class='websy-date-picker-ranges'>\n <ul id='").concat(this.elementId, "_rangelist'>\n ").concat(this.renderRanges(), "\n </ul>\n </div><!--\n --><div id='").concat(this.elementId, "_datelist' class='websy-date-picker-custom'>").concat(this.renderDates(), "</div>\n <div class='websy-dp-button-container'>\n <span class=\"dp-footnote\">Click and drag or hold Shift and click to select a range of values</span>\n <button class='").concat(this.options.cancelBtnClasses || '', " websy-btn websy-dp-cancel'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 512 512\"><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>\n </button>\n <button class='").concat(this.options.confirmBtnClasses || '', " websy-btn websy-dp-confirm'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 512 512\"><polyline points=\"416 128 192 384 96 288\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>\n </button>\n </div>\n </div> \n </div>\n ");
|
|
611
|
+
html += "\n </div>\n <div id='".concat(this.elementId, "_mask' class='websy-date-picker-mask'></div>\n <div id='").concat(this.elementId, "_content' class='websy-date-picker-content ").concat(this.options.hideRanges === true ? 'hide-ranges' : '', "'>\n <div class='websy-date-picker-ranges' >\n <ul id='").concat(this.elementId, "_rangelist'>\n ").concat(this.renderRanges(), "\n </ul>\n </div><!--\n --><div id='").concat(this.elementId, "_datelist' class='websy-date-picker-custom'>").concat(this.renderDates(), "</div>\n <div class='websy-dp-button-container'>\n <span class=\"dp-footnote\">Click and drag or hold Shift and click to select a range of values</span>\n <button class='").concat(this.options.cancelBtnClasses || '', " websy-btn websy-dp-cancel'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 512 512\"><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>\n </button>\n <button class='").concat(this.options.confirmBtnClasses || '', " websy-btn websy-dp-confirm'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 512 512\"><polyline points=\"416 128 192 384 96 288\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>\n </button>\n </div>\n </div> \n </div>\n ");
|
|
604
612
|
el.innerHTML = html;
|
|
605
613
|
this.render();
|
|
606
614
|
} else {
|
|
@@ -611,6 +619,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
611
619
|
_createClass(WebsyDatePicker, [{
|
|
612
620
|
key: "close",
|
|
613
621
|
value: function close(confirm) {
|
|
622
|
+
var _this4 = this;
|
|
623
|
+
|
|
614
624
|
var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
|
|
615
625
|
var contentEl = document.getElementById("".concat(this.elementId, "_content"));
|
|
616
626
|
var el = document.getElementById(this.elementId);
|
|
@@ -628,9 +638,27 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
628
638
|
console.log('confirm', this.currentselection);
|
|
629
639
|
|
|
630
640
|
if (this.customRangeSelected === true) {
|
|
631
|
-
this.options.
|
|
641
|
+
if (this.options.mode === 'hour') {
|
|
642
|
+
var hoursOut = [];
|
|
643
|
+
|
|
644
|
+
for (var i = this.selectedRangeDates[0]; i < this.selectedRangeDates[1] + 1; i++) {
|
|
645
|
+
hoursOut.push(this.options.hours[i]);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
this.options.onChange(hoursOut, true);
|
|
649
|
+
} else {
|
|
650
|
+
this.options.onChange(this.selectedRangeDates, true);
|
|
651
|
+
}
|
|
632
652
|
} else {
|
|
633
|
-
this.options.
|
|
653
|
+
if (this.options.mode === 'hour') {
|
|
654
|
+
var _hoursOut = this.selectedRangeDates.map(function (h) {
|
|
655
|
+
return _this4.options.hours[h];
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
this.options.onChange(_hoursOut, true);
|
|
659
|
+
} else {
|
|
660
|
+
this.options.onChange(this.currentselection, false);
|
|
661
|
+
}
|
|
634
662
|
}
|
|
635
663
|
}
|
|
636
664
|
|
|
@@ -746,7 +774,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
746
774
|
}, {
|
|
747
775
|
key: "highlightRange",
|
|
748
776
|
value: function highlightRange() {
|
|
749
|
-
var
|
|
777
|
+
var _this5 = this;
|
|
750
778
|
|
|
751
779
|
var el = document.getElementById("".concat(this.elementId, "_dateList"));
|
|
752
780
|
var dateEls = el.querySelectorAll('.websy-dp-date');
|
|
@@ -782,7 +810,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
782
810
|
diff = Math.floor(this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth() - this.selectedRangeDates[0].getMonth()) + yearDiff;
|
|
783
811
|
console.log('year diff', yearDiff);
|
|
784
812
|
console.log('diff', diff);
|
|
785
|
-
} else if (this.options.mode === 'hour') {
|
|
813
|
+
} else if (this.options.mode === 'hour') {
|
|
814
|
+
diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
|
|
786
815
|
}
|
|
787
816
|
|
|
788
817
|
for (var _i = 0; _i < diff + 1; _i++) {
|
|
@@ -803,7 +832,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
803
832
|
d = new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + _i);
|
|
804
833
|
rangeStart = this.selectedRangeDates[0].getTime();
|
|
805
834
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
806
|
-
} else if (this.options.mode === 'hour') {
|
|
835
|
+
} else if (this.options.mode === 'hour') {
|
|
836
|
+
d = this.selectedRangeDates[0] + _i;
|
|
837
|
+
rangeStart = this.selectedRangeDates[0];
|
|
838
|
+
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
807
839
|
}
|
|
808
840
|
|
|
809
841
|
var dateEl = void 0;
|
|
@@ -817,7 +849,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
817
849
|
console.log(this.selectedRangeDates);
|
|
818
850
|
console.log(rangeStart, rangeEnd);
|
|
819
851
|
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_monthyear"));
|
|
820
|
-
} else if (this.options.mode === 'hour') {
|
|
852
|
+
} else if (this.options.mode === 'hour') {
|
|
853
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_hour"));
|
|
821
854
|
}
|
|
822
855
|
|
|
823
856
|
if (dateEl) {
|
|
@@ -836,13 +869,14 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
836
869
|
this.currentselection.forEach(function (d) {
|
|
837
870
|
var dateEl;
|
|
838
871
|
|
|
839
|
-
if (
|
|
840
|
-
dateEl = document.getElementById("".concat(
|
|
841
|
-
} else if (
|
|
842
|
-
dateEl = document.getElementById("".concat(
|
|
843
|
-
} else if (
|
|
844
|
-
dateEl = document.getElementById("".concat(
|
|
845
|
-
} else if (
|
|
872
|
+
if (_this5.options.mode === 'date') {
|
|
873
|
+
dateEl = document.getElementById("".concat(_this5.elementId, "_").concat(d, "_date"));
|
|
874
|
+
} else if (_this5.options.mode === 'year') {
|
|
875
|
+
dateEl = document.getElementById("".concat(_this5.elementId, "_").concat(d, "_year"));
|
|
876
|
+
} else if (_this5.options.mode === 'monthyear') {
|
|
877
|
+
dateEl = document.getElementById("".concat(_this5.elementId, "_").concat(d, "_monthyear"));
|
|
878
|
+
} else if (_this5.options.mode === 'hour') {
|
|
879
|
+
dateEl = document.getElementById("".concat(_this5.elementId, "_").concat(d, "_hour"));
|
|
846
880
|
}
|
|
847
881
|
|
|
848
882
|
dateEl.classList.add('selected');
|
|
@@ -896,22 +930,24 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
896
930
|
}, {
|
|
897
931
|
key: "renderDates",
|
|
898
932
|
value: function renderDates(disabledDates) {
|
|
899
|
-
var
|
|
933
|
+
var _this6 = this;
|
|
900
934
|
|
|
901
935
|
var disabled = [];
|
|
902
936
|
this.validDates = [];
|
|
903
937
|
this.validYears = [];
|
|
938
|
+
this.validHours = [];
|
|
904
939
|
this.monthYears = {};
|
|
905
940
|
this.monthYearMonths = [];
|
|
906
941
|
|
|
907
942
|
if (disabledDates) {
|
|
908
943
|
disabled = disabledDates.map(function (d) {
|
|
909
|
-
if (
|
|
944
|
+
if (_this6.options.mode === 'date') {
|
|
910
945
|
return d.getTime();
|
|
911
|
-
} else if (
|
|
946
|
+
} else if (_this6.options.mode === 'year') {
|
|
947
|
+
return d;
|
|
948
|
+
} else if (_this6.options.mode === 'monthyear') {//
|
|
949
|
+
} else if (_this6.options.mode === 'hour') {
|
|
912
950
|
return d;
|
|
913
|
-
} else if (_this5.options.mode === 'monthyear') {//
|
|
914
|
-
} else if (_this5.options.mode === 'hour') {//
|
|
915
951
|
}
|
|
916
952
|
|
|
917
953
|
return d.getTime();
|
|
@@ -930,7 +966,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
930
966
|
diff = this.options.maxAllowedYear - this.options.minAllowedYear + 1;
|
|
931
967
|
} else if (this.options.mode === 'monthyear') {
|
|
932
968
|
diff = Math.ceil((this.options.maxAllowedDate.getTime() - this.options.minAllowedDate.getTime()) / this.oneDay) + 1;
|
|
933
|
-
} else if (this.options.mode === 'hour') {
|
|
969
|
+
} else if (this.options.mode === 'hour') {
|
|
970
|
+
diff = 24;
|
|
934
971
|
}
|
|
935
972
|
|
|
936
973
|
var months = {};
|
|
@@ -951,12 +988,13 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
951
988
|
|
|
952
989
|
if (this.monthYearMonths.indexOf("".concat(d.getMonth(), "-").concat(d.getFullYear())) === -1) {
|
|
953
990
|
this.monthYearMonths.push("".concat(d.getMonth(), "-").concat(d.getFullYear()));
|
|
991
|
+
var firstOfMonth = new Date(new Date(d).setDate(1));
|
|
954
992
|
this.monthYears[d.getFullYear()].push({
|
|
955
|
-
date:
|
|
993
|
+
date: firstOfMonth,
|
|
956
994
|
month: this.options.monthMap[d.getMonth()],
|
|
957
995
|
monthNum: d.getMonth(),
|
|
958
996
|
year: d.getFullYear(),
|
|
959
|
-
id:
|
|
997
|
+
id: firstOfMonth.getTime()
|
|
960
998
|
});
|
|
961
999
|
}
|
|
962
1000
|
|
|
@@ -983,8 +1021,16 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
983
1021
|
if (disabled.indexOf(_d) === -1) {
|
|
984
1022
|
this.validYears.push(_d);
|
|
985
1023
|
}
|
|
986
|
-
} else if (this.options.mode === 'hour') {//
|
|
1024
|
+
} else if (this.options.mode === 'hour') {//
|
|
987
1025
|
}
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
if (this.options.mode === 'hour') {
|
|
1029
|
+
this.options.hours.forEach(function (h) {
|
|
1030
|
+
if (disabled.indexOf(h.text) === -1) {
|
|
1031
|
+
_this6.validHours.push(h);
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
988
1034
|
} // check each range to see if it can be enabled
|
|
989
1035
|
|
|
990
1036
|
|
|
@@ -1028,7 +1074,22 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1028
1074
|
}
|
|
1029
1075
|
}
|
|
1030
1076
|
} else if (this.options.mode === 'monthyear') {//
|
|
1031
|
-
} else if (this.options.mode === 'hour') {
|
|
1077
|
+
} else if (this.options.mode === 'hour') {
|
|
1078
|
+
if (this.validDates.indexOf(r.range[0]) !== -1) {
|
|
1079
|
+
r.disabled = false;
|
|
1080
|
+
} else if (r.range[1]) {
|
|
1081
|
+
if (this.validDates.indexOf(r.range[1]) !== -1) {
|
|
1082
|
+
r.disabled = false;
|
|
1083
|
+
} else {
|
|
1084
|
+
// check the full range until a match is found
|
|
1085
|
+
for (var _i5 = r.range[0]; _i5 <= r.range[1]; _i5++) {
|
|
1086
|
+
if (this.validDates.indexOf(r.range[0] + _i5) !== -1) {
|
|
1087
|
+
r.disabled = false;
|
|
1088
|
+
break;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1032
1093
|
}
|
|
1033
1094
|
}
|
|
1034
1095
|
|
|
@@ -1047,7 +1108,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1047
1108
|
if (months[key][0].dayOfWeek > 0) {
|
|
1048
1109
|
var paddedDays = [];
|
|
1049
1110
|
|
|
1050
|
-
for (var
|
|
1111
|
+
for (var _i6 = 0; _i6 < months[key][0].dayOfWeek; _i6++) {
|
|
1051
1112
|
paddedDays.push("<li> </li>");
|
|
1052
1113
|
}
|
|
1053
1114
|
|
|
@@ -1055,7 +1116,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1055
1116
|
}
|
|
1056
1117
|
|
|
1057
1118
|
html += months[key].map(function (d) {
|
|
1058
|
-
return "<li id='".concat(
|
|
1119
|
+
return "<li id='".concat(_this6.elementId, "_").concat(d.id, "_date' class='websy-dp-date ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.dayOfMonth, "</li>");
|
|
1059
1120
|
}).join('');
|
|
1060
1121
|
html += "\n </ul>\n </div>\n ";
|
|
1061
1122
|
}
|
|
@@ -1068,7 +1129,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1068
1129
|
|
|
1069
1130
|
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'><ul>");
|
|
1070
1131
|
html += yearList.map(function (d) {
|
|
1071
|
-
return "<li id='".concat(
|
|
1132
|
+
return "<li id='".concat(_this6.elementId, "_").concat(d.id, "_year' class='websy-dp-date websy-dp-year ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.year, "</li>");
|
|
1072
1133
|
}).join('');
|
|
1073
1134
|
html += "</ul></div>";
|
|
1074
1135
|
} else if (this.options.mode === 'monthyear') {
|
|
@@ -1080,7 +1141,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1080
1141
|
if (this.monthYears[year][0].monthNum > 0) {
|
|
1081
1142
|
var paddedMonths = [];
|
|
1082
1143
|
|
|
1083
|
-
for (var
|
|
1144
|
+
for (var _i7 = 0; _i7 < this.monthYears[year][0].monthNum; _i7++) {
|
|
1084
1145
|
paddedMonths.push("<li> </li>");
|
|
1085
1146
|
}
|
|
1086
1147
|
|
|
@@ -1088,13 +1149,18 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1088
1149
|
}
|
|
1089
1150
|
|
|
1090
1151
|
html += this.monthYears[year].map(function (d) {
|
|
1091
|
-
return "<li id='".concat(
|
|
1152
|
+
return "<li id='".concat(_this6.elementId, "_").concat(d.id, "_monthyear' data-year='").concat(d.year, "' class='websy-dp-date websy-dp-monthyear'>").concat(d.month, "</li>");
|
|
1092
1153
|
}).join('');
|
|
1093
1154
|
html += "</ul>";
|
|
1094
1155
|
}
|
|
1095
1156
|
|
|
1096
1157
|
html += "</div>";
|
|
1097
|
-
} else if (this.options.mode === 'hour') {
|
|
1158
|
+
} else if (this.options.mode === 'hour') {
|
|
1159
|
+
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'><ul>");
|
|
1160
|
+
html += this.options.hours.map(function (h) {
|
|
1161
|
+
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>");
|
|
1162
|
+
}).join('');
|
|
1163
|
+
html += "</ul></div>";
|
|
1098
1164
|
}
|
|
1099
1165
|
|
|
1100
1166
|
return html;
|
|
@@ -1102,10 +1168,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1102
1168
|
}, {
|
|
1103
1169
|
key: "renderRanges",
|
|
1104
1170
|
value: function renderRanges() {
|
|
1105
|
-
var
|
|
1171
|
+
var _this7 = this;
|
|
1106
1172
|
|
|
1107
1173
|
return this.options.ranges[this.options.mode].map(function (r, i) {
|
|
1108
|
-
return "\n <li data-index='".concat(i, "' class='websy-date-picker-range ").concat(i ===
|
|
1174
|
+
return "\n <li data-index='".concat(i, "' class='websy-date-picker-range ").concat(i === _this7.selectedRange ? 'active' : '', " ").concat(r.disabled === true ? 'websy-disabled-range' : '', "'>").concat(r.label, "</li>\n ");
|
|
1109
1175
|
}).join('') + "<li data-index='-1' class='websy-date-picker-range ".concat(this.selectedRange === -1 ? 'active' : '', "'>Custom</li>");
|
|
1110
1176
|
}
|
|
1111
1177
|
}, {
|
|
@@ -1151,7 +1217,14 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1151
1217
|
this.customRangeSelected = true;
|
|
1152
1218
|
console.log('current selection', this.currentselection);
|
|
1153
1219
|
} else {
|
|
1154
|
-
this.currentselection.
|
|
1220
|
+
var index = this.currentselection.indexOf(timestamp);
|
|
1221
|
+
|
|
1222
|
+
if (index !== -1) {
|
|
1223
|
+
this.currentselection.splice(index, 1);
|
|
1224
|
+
} else {
|
|
1225
|
+
this.currentselection.push(timestamp);
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1155
1228
|
this.currentselection.sort(function (a, b) {
|
|
1156
1229
|
return a - b;
|
|
1157
1230
|
});
|
|
@@ -1165,7 +1238,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1165
1238
|
} else if (this.options.mode === 'year') {
|
|
1166
1239
|
this.selectedRangeDates = [this.currentselection[0], this.currentselection[1] || this.currentselection[0]];
|
|
1167
1240
|
} else if (this.options.mode === 'monthyear') {//
|
|
1168
|
-
} else if (this.options.mode === 'hour') {
|
|
1241
|
+
} else if (this.options.mode === 'hour') {
|
|
1242
|
+
this.selectedRangeDates = [this.currentselection[0], this.currentselection[1] || this.currentselection[0]];
|
|
1169
1243
|
} // if (this.currentselection.length === 2) {
|
|
1170
1244
|
// this.currentselection = []
|
|
1171
1245
|
// }
|
|
@@ -1234,33 +1308,36 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1234
1308
|
} else if (this.options.mode === 'monthyear') {
|
|
1235
1309
|
this.options.minAllowedDate = range[0];
|
|
1236
1310
|
this.options.maxAllowedDate = range[1] || range[0];
|
|
1237
|
-
} else if (this.options.mode === 'hour') {
|
|
1311
|
+
} else if (this.options.mode === 'hour') {
|
|
1312
|
+
this.options.minAllowedHour = range[0];
|
|
1313
|
+
this.options.maxAllowedHour = range[1] || range[0];
|
|
1238
1314
|
}
|
|
1239
1315
|
}
|
|
1240
1316
|
}, {
|
|
1241
1317
|
key: "updateRange",
|
|
1242
1318
|
value: function updateRange() {
|
|
1243
|
-
var
|
|
1319
|
+
var _this8 = this;
|
|
1244
1320
|
|
|
1245
1321
|
var range;
|
|
1246
1322
|
|
|
1247
1323
|
if (this.selectedRange === -1) {
|
|
1248
1324
|
var list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(function (d) {
|
|
1249
|
-
if (
|
|
1325
|
+
if (_this8.options.mode === 'date') {
|
|
1250
1326
|
if (!d.toLocaleDateString) {
|
|
1251
1327
|
d = new Date(d);
|
|
1252
1328
|
}
|
|
1253
1329
|
|
|
1254
1330
|
return d.toLocaleDateString();
|
|
1255
|
-
} else if (
|
|
1331
|
+
} else if (_this8.options.mode === 'year') {
|
|
1256
1332
|
return d;
|
|
1257
|
-
} else if (
|
|
1333
|
+
} else if (_this8.options.mode === 'monthyear') {
|
|
1258
1334
|
if (!d.getMonth) {
|
|
1259
1335
|
d = new Date(d);
|
|
1260
1336
|
}
|
|
1261
1337
|
|
|
1262
|
-
return "".concat(
|
|
1263
|
-
} else if (
|
|
1338
|
+
return "".concat(_this8.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
1339
|
+
} else if (_this8.options.mode === 'hour') {
|
|
1340
|
+
return d;
|
|
1264
1341
|
}
|
|
1265
1342
|
});
|
|
1266
1343
|
var start = list[0];
|
|
@@ -1272,6 +1349,11 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1272
1349
|
start = "".concat(list.length, " selected");
|
|
1273
1350
|
}
|
|
1274
1351
|
|
|
1352
|
+
if (this.options.mode === 'hour') {
|
|
1353
|
+
start = this.options.hours[start].text;
|
|
1354
|
+
end = "".concat(this.customRangeSelected === true ? ' - ' : '').concat(this.options.hours[list[list.length - 1]].text);
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1275
1357
|
range = {
|
|
1276
1358
|
label: "".concat(start).concat(end)
|
|
1277
1359
|
};
|
|
@@ -1308,7 +1390,7 @@ Date.prototype.floor = function () {
|
|
|
1308
1390
|
|
|
1309
1391
|
var WebsyDropdown = /*#__PURE__*/function () {
|
|
1310
1392
|
function WebsyDropdown(elementId, options) {
|
|
1311
|
-
var
|
|
1393
|
+
var _this9 = this;
|
|
1312
1394
|
|
|
1313
1395
|
_classCallCheck(this, WebsyDropdown);
|
|
1314
1396
|
|
|
@@ -1352,10 +1434,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1352
1434
|
el.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
1353
1435
|
el.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
1354
1436
|
var headerLabel = this.selectedItems.map(function (s) {
|
|
1355
|
-
return
|
|
1437
|
+
return _this9.options.items[s].label || _this9.options.items[s].value;
|
|
1356
1438
|
}).join(this.options.multiValueDelimiter);
|
|
1357
1439
|
var headerValue = this.selectedItems.map(function (s) {
|
|
1358
|
-
return
|
|
1440
|
+
return _this9.options.items[s].value || _this9.options.items[s].label;
|
|
1359
1441
|
}).join(this.options.multiValueDelimiter);
|
|
1360
1442
|
var html = "\n <div id='".concat(this.elementId, "_container' class='websy-dropdown-container ").concat(this.options.disabled ? 'disabled' : '', " ").concat(this.options.disableSearch !== true ? 'with-search' : '', " ").concat(this.options.style, " ").concat(this.options.customActions.length > 0 ? 'with-actions' : '', "'>\n <div id='").concat(this.elementId, "_header' class='websy-dropdown-header ").concat(this.selectedItems.length === 1 ? 'one-selected' : '', " ").concat(this.options.allowClear === true ? 'allow-clear' : '', "'>\n <svg class='search' width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>\n <span id='").concat(this.elementId, "_headerLabel' class='websy-dropdown-header-label'>").concat(this.options.label, "</span>\n <span data-info='").concat(headerLabel, "' class='websy-dropdown-header-value' id='").concat(this.elementId, "_selectedItems'>").concat(headerLabel, "</span>\n <input class='dropdown-input' id='").concat(this.elementId, "_input' name='").concat(this.options.field || this.options.label, "' value='").concat(headerValue, "'>\n <svg class='arrow' xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M23.677 18.52c.914 1.523-.183 3.472-1.967 3.472h-19.414c-1.784 0-2.881-1.949-1.967-3.472l9.709-16.18c.891-1.483 3.041-1.48 3.93 0l9.709 16.18z\"/></svg> \n ");
|
|
1361
1443
|
|
|
@@ -1638,10 +1720,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1638
1720
|
}, {
|
|
1639
1721
|
key: "renderItems",
|
|
1640
1722
|
value: function renderItems() {
|
|
1641
|
-
var
|
|
1723
|
+
var _this10 = this;
|
|
1642
1724
|
|
|
1643
1725
|
var html = this.options.items.map(function (r, i) {
|
|
1644
|
-
return "\n <li data-index='".concat(r.index, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(
|
|
1726
|
+
return "\n <li data-index='".concat(r.index, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(_this10.selectedItems.indexOf(r.index) !== -1 ? 'active' : '', "'>").concat(r.label, "</li>\n ");
|
|
1645
1727
|
}).join('');
|
|
1646
1728
|
var el = document.getElementById("".concat(this.elementId, "_items"));
|
|
1647
1729
|
|
|
@@ -1660,7 +1742,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1660
1742
|
}, {
|
|
1661
1743
|
key: "updateHeader",
|
|
1662
1744
|
value: function updateHeader(item) {
|
|
1663
|
-
var
|
|
1745
|
+
var _this11 = this;
|
|
1664
1746
|
|
|
1665
1747
|
var el = document.getElementById(this.elementId);
|
|
1666
1748
|
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
@@ -1707,17 +1789,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1707
1789
|
} else if (this.selectedItems.length > 1) {
|
|
1708
1790
|
if (this.options.showCompleteSelectedList === true) {
|
|
1709
1791
|
var selectedLabels = this.selectedItems.map(function (s) {
|
|
1710
|
-
return
|
|
1792
|
+
return _this11.options.items[s].label || _this11.options.items[s].value;
|
|
1711
1793
|
}).join(this.options.multiValueDelimiter);
|
|
1712
1794
|
var selectedValues = this.selectedItems.map(function (s) {
|
|
1713
|
-
return
|
|
1795
|
+
return _this11.options.items[s].value || _this11.options.items[s].label;
|
|
1714
1796
|
}).join(this.options.multiValueDelimiter);
|
|
1715
1797
|
labelEl.innerHTML = selectedLabels;
|
|
1716
1798
|
labelEl.setAttribute('data-info', selectedLabels);
|
|
1717
1799
|
inputEl.value = selectedValues;
|
|
1718
1800
|
} else {
|
|
1719
1801
|
var _selectedValues = this.selectedItems.map(function (s) {
|
|
1720
|
-
return
|
|
1802
|
+
return _this11.options.items[s].value || _this11.options.items[s].label;
|
|
1721
1803
|
}).join(this.options.multiValueDelimiter);
|
|
1722
1804
|
|
|
1723
1805
|
labelEl.innerHTML = "".concat(this.selectedItems.length, " selected");
|
|
@@ -1854,16 +1936,16 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1854
1936
|
}, {
|
|
1855
1937
|
key: "checkRecaptcha",
|
|
1856
1938
|
value: function checkRecaptcha() {
|
|
1857
|
-
var
|
|
1939
|
+
var _this12 = this;
|
|
1858
1940
|
|
|
1859
1941
|
return new Promise(function (resolve, reject) {
|
|
1860
|
-
if (
|
|
1942
|
+
if (_this12.options.useRecaptcha === true) {
|
|
1861
1943
|
// if (this.recaptchaValue) {
|
|
1862
1944
|
grecaptcha.ready(function () {
|
|
1863
1945
|
grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
|
|
1864
1946
|
action: 'submit'
|
|
1865
1947
|
}).then(function (token) {
|
|
1866
|
-
|
|
1948
|
+
_this12.apiService.add('google/checkrecaptcha', {
|
|
1867
1949
|
grecaptcharesponse: token
|
|
1868
1950
|
}).then(function (response) {
|
|
1869
1951
|
if (response.success && response.success === true) {
|
|
@@ -1926,14 +2008,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1926
2008
|
}, {
|
|
1927
2009
|
key: "processComponents",
|
|
1928
2010
|
value: function processComponents(components, callbackFn) {
|
|
1929
|
-
var
|
|
2011
|
+
var _this13 = this;
|
|
1930
2012
|
|
|
1931
2013
|
if (components.length === 0) {
|
|
1932
2014
|
callbackFn();
|
|
1933
2015
|
} else {
|
|
1934
2016
|
components.forEach(function (c) {
|
|
1935
2017
|
if (typeof WebsyDesigns[c.component] !== 'undefined') {
|
|
1936
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
2018
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this13.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
1937
2019
|
} else {// some user feedback here
|
|
1938
2020
|
}
|
|
1939
2021
|
});
|
|
@@ -1954,7 +2036,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1954
2036
|
}, {
|
|
1955
2037
|
key: "render",
|
|
1956
2038
|
value: function render(update, data) {
|
|
1957
|
-
var
|
|
2039
|
+
var _this14 = this;
|
|
1958
2040
|
|
|
1959
2041
|
var el = document.getElementById(this.elementId);
|
|
1960
2042
|
var componentsToProcess = [];
|
|
@@ -1964,11 +2046,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1964
2046
|
this.options.fields.forEach(function (f, i) {
|
|
1965
2047
|
if (f.component) {
|
|
1966
2048
|
componentsToProcess.push(f);
|
|
1967
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(
|
|
2049
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(_this14.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
|
|
1968
2050
|
} else if (f.type === 'longtext') {
|
|
1969
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(
|
|
2051
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(_this14.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n ></textarea>\n </div><!--\n ");
|
|
1970
2052
|
} else {
|
|
1971
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(
|
|
2053
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(_this14.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n </div><!--\n ");
|
|
1972
2054
|
}
|
|
1973
2055
|
});
|
|
1974
2056
|
html += "\n --><button class=\"websy-btn submit ".concat(this.options.submit.classes || '', "\">").concat(this.options.submit.text || 'Save', "</button>").concat(this.options.cancel ? '<!--' : '', "\n ");
|
|
@@ -1985,7 +2067,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1985
2067
|
|
|
1986
2068
|
el.innerHTML = html;
|
|
1987
2069
|
this.processComponents(componentsToProcess, function () {
|
|
1988
|
-
if (
|
|
2070
|
+
if (_this14.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
|
|
1989
2071
|
}
|
|
1990
2072
|
});
|
|
1991
2073
|
}
|
|
@@ -1993,7 +2075,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1993
2075
|
}, {
|
|
1994
2076
|
key: "submitForm",
|
|
1995
2077
|
value: function submitForm() {
|
|
1996
|
-
var
|
|
2078
|
+
var _this15 = this;
|
|
1997
2079
|
|
|
1998
2080
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
1999
2081
|
|
|
@@ -2007,32 +2089,32 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2007
2089
|
data[key] = value;
|
|
2008
2090
|
});
|
|
2009
2091
|
|
|
2010
|
-
if (
|
|
2011
|
-
var
|
|
2092
|
+
if (_this15.options.url) {
|
|
2093
|
+
var _this15$apiService;
|
|
2012
2094
|
|
|
2013
|
-
var params = [
|
|
2095
|
+
var params = [_this15.options.url];
|
|
2014
2096
|
|
|
2015
|
-
if (
|
|
2016
|
-
params.push(
|
|
2097
|
+
if (_this15.options.mode === 'update') {
|
|
2098
|
+
params.push(_this15.options.id);
|
|
2017
2099
|
}
|
|
2018
2100
|
|
|
2019
2101
|
params.push(data);
|
|
2020
2102
|
|
|
2021
|
-
(
|
|
2022
|
-
if (
|
|
2103
|
+
(_this15$apiService = _this15.apiService)[_this15.options.mode].apply(_this15$apiService, params).then(function (result) {
|
|
2104
|
+
if (_this15.options.clearAfterSave === true) {
|
|
2023
2105
|
// this.render()
|
|
2024
2106
|
formEl.reset();
|
|
2025
2107
|
}
|
|
2026
2108
|
|
|
2027
|
-
|
|
2109
|
+
_this15.options.onSuccess.call(_this15, result);
|
|
2028
2110
|
}, function (err) {
|
|
2029
2111
|
console.log('Error submitting form data:', err);
|
|
2030
2112
|
|
|
2031
|
-
|
|
2113
|
+
_this15.options.onError.call(_this15, err);
|
|
2032
2114
|
});
|
|
2033
|
-
} else if (
|
|
2034
|
-
|
|
2035
|
-
if (
|
|
2115
|
+
} else if (_this15.options.submitFn) {
|
|
2116
|
+
_this15.options.submitFn(data, function () {
|
|
2117
|
+
if (_this15.options.clearAfterSave === true) {
|
|
2036
2118
|
// this.render()
|
|
2037
2119
|
formEl.reset();
|
|
2038
2120
|
}
|
|
@@ -2052,17 +2134,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2052
2134
|
}, {
|
|
2053
2135
|
key: "data",
|
|
2054
2136
|
set: function set(d) {
|
|
2055
|
-
var
|
|
2137
|
+
var _this16 = this;
|
|
2056
2138
|
|
|
2057
2139
|
if (!this.options.fields) {
|
|
2058
2140
|
this.options.fields = [];
|
|
2059
2141
|
}
|
|
2060
2142
|
|
|
2061
2143
|
var _loop = function _loop(key) {
|
|
2062
|
-
|
|
2144
|
+
_this16.options.fields.forEach(function (f) {
|
|
2063
2145
|
if (f.field === key) {
|
|
2064
2146
|
f.value = d[key];
|
|
2065
|
-
var el = document.getElementById("".concat(
|
|
2147
|
+
var el = document.getElementById("".concat(_this16.elementId, "_input_").concat(f.field));
|
|
2066
2148
|
el.value = f.value;
|
|
2067
2149
|
}
|
|
2068
2150
|
});
|
|
@@ -2441,7 +2523,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2441
2523
|
|
|
2442
2524
|
var Pager = /*#__PURE__*/function () {
|
|
2443
2525
|
function Pager(elementId, options) {
|
|
2444
|
-
var
|
|
2526
|
+
var _this17 = this;
|
|
2445
2527
|
|
|
2446
2528
|
_classCallCheck(this, Pager);
|
|
2447
2529
|
|
|
@@ -2494,8 +2576,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2494
2576
|
allowClear: false,
|
|
2495
2577
|
disableSearch: true,
|
|
2496
2578
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
2497
|
-
if (
|
|
2498
|
-
|
|
2579
|
+
if (_this17.options.onChangePageSize) {
|
|
2580
|
+
_this17.options.onChangePageSize(selectedItem.value);
|
|
2499
2581
|
}
|
|
2500
2582
|
}
|
|
2501
2583
|
});
|
|
@@ -2519,13 +2601,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2519
2601
|
}, {
|
|
2520
2602
|
key: "render",
|
|
2521
2603
|
value: function render() {
|
|
2522
|
-
var
|
|
2604
|
+
var _this18 = this;
|
|
2523
2605
|
|
|
2524
2606
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
2525
2607
|
|
|
2526
2608
|
if (el) {
|
|
2527
2609
|
var pages = this.options.pages.map(function (item, index) {
|
|
2528
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
2610
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this18.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
2529
2611
|
});
|
|
2530
2612
|
var startIndex = 0;
|
|
2531
2613
|
|
|
@@ -2593,58 +2675,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2593
2675
|
_createClass(WebsyPDFButton, [{
|
|
2594
2676
|
key: "handleClick",
|
|
2595
2677
|
value: function handleClick(event) {
|
|
2596
|
-
var
|
|
2678
|
+
var _this19 = this;
|
|
2597
2679
|
|
|
2598
2680
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
2599
2681
|
this.loader.show();
|
|
2600
2682
|
setTimeout(function () {
|
|
2601
|
-
if (
|
|
2602
|
-
var el = document.getElementById(
|
|
2683
|
+
if (_this19.options.targetId) {
|
|
2684
|
+
var el = document.getElementById(_this19.options.targetId);
|
|
2603
2685
|
|
|
2604
2686
|
if (el) {
|
|
2605
2687
|
var pdfData = {
|
|
2606
2688
|
options: {}
|
|
2607
2689
|
};
|
|
2608
2690
|
|
|
2609
|
-
if (
|
|
2610
|
-
pdfData.options = _extends({},
|
|
2691
|
+
if (_this19.options.pdfOptions) {
|
|
2692
|
+
pdfData.options = _extends({}, _this19.options.pdfOptions);
|
|
2611
2693
|
}
|
|
2612
2694
|
|
|
2613
|
-
if (
|
|
2614
|
-
if (
|
|
2615
|
-
var headerEl = document.getElementById(
|
|
2695
|
+
if (_this19.options.header) {
|
|
2696
|
+
if (_this19.options.header.elementId) {
|
|
2697
|
+
var headerEl = document.getElementById(_this19.options.header.elementId);
|
|
2616
2698
|
|
|
2617
2699
|
if (headerEl) {
|
|
2618
2700
|
pdfData.header = headerEl.outerHTML;
|
|
2619
2701
|
|
|
2620
|
-
if (
|
|
2621
|
-
pdfData.options.headerCSS =
|
|
2702
|
+
if (_this19.options.header.css) {
|
|
2703
|
+
pdfData.options.headerCSS = _this19.options.header.css;
|
|
2622
2704
|
}
|
|
2623
2705
|
}
|
|
2624
|
-
} else if (
|
|
2625
|
-
pdfData.header =
|
|
2706
|
+
} else if (_this19.options.header.html) {
|
|
2707
|
+
pdfData.header = _this19.options.header.html;
|
|
2626
2708
|
|
|
2627
|
-
if (
|
|
2628
|
-
pdfData.options.headerCSS =
|
|
2709
|
+
if (_this19.options.header.css) {
|
|
2710
|
+
pdfData.options.headerCSS = _this19.options.header.css;
|
|
2629
2711
|
}
|
|
2630
2712
|
} else {
|
|
2631
|
-
pdfData.header =
|
|
2713
|
+
pdfData.header = _this19.options.header;
|
|
2632
2714
|
}
|
|
2633
2715
|
}
|
|
2634
2716
|
|
|
2635
|
-
if (
|
|
2636
|
-
if (
|
|
2637
|
-
var footerEl = document.getElementById(
|
|
2717
|
+
if (_this19.options.footer) {
|
|
2718
|
+
if (_this19.options.footer.elementId) {
|
|
2719
|
+
var footerEl = document.getElementById(_this19.options.footer.elementId);
|
|
2638
2720
|
|
|
2639
2721
|
if (footerEl) {
|
|
2640
2722
|
pdfData.footer = footerEl.outerHTML;
|
|
2641
2723
|
|
|
2642
|
-
if (
|
|
2643
|
-
pdfData.options.footerCSS =
|
|
2724
|
+
if (_this19.options.footer.css) {
|
|
2725
|
+
pdfData.options.footerCSS = _this19.options.footer.css;
|
|
2644
2726
|
}
|
|
2645
2727
|
}
|
|
2646
2728
|
} else {
|
|
2647
|
-
pdfData.footer =
|
|
2729
|
+
pdfData.footer = _this19.options.footer;
|
|
2648
2730
|
}
|
|
2649
2731
|
}
|
|
2650
2732
|
|
|
@@ -2653,31 +2735,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2653
2735
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
2654
2736
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
2655
2737
|
|
|
2656
|
-
|
|
2738
|
+
_this19.service.add('', pdfData, {
|
|
2657
2739
|
responseType: 'blob'
|
|
2658
2740
|
}).then(function (response) {
|
|
2659
|
-
|
|
2741
|
+
_this19.loader.hide();
|
|
2660
2742
|
|
|
2661
2743
|
var blob = new Blob([response], {
|
|
2662
2744
|
type: 'application/pdf'
|
|
2663
2745
|
});
|
|
2664
2746
|
var msg = "\n <div class='text-center websy-pdf-download'>\n <div>Your file is ready to download</div>\n <a href='".concat(URL.createObjectURL(blob), "' target='_blank'\n ");
|
|
2665
2747
|
|
|
2666
|
-
if (
|
|
2748
|
+
if (_this19.options.directDownload === true) {
|
|
2667
2749
|
var fileName;
|
|
2668
2750
|
|
|
2669
|
-
if (typeof
|
|
2670
|
-
fileName =
|
|
2751
|
+
if (typeof _this19.options.fileName === 'function') {
|
|
2752
|
+
fileName = _this19.options.fileName() || 'Export';
|
|
2671
2753
|
} else {
|
|
2672
|
-
fileName =
|
|
2754
|
+
fileName = _this19.options.fileName || 'Export';
|
|
2673
2755
|
}
|
|
2674
2756
|
|
|
2675
2757
|
msg += "download='".concat(fileName, ".pdf'");
|
|
2676
2758
|
}
|
|
2677
2759
|
|
|
2678
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
2760
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this19.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
2679
2761
|
|
|
2680
|
-
|
|
2762
|
+
_this19.popup.show({
|
|
2681
2763
|
message: msg,
|
|
2682
2764
|
mask: true
|
|
2683
2765
|
});
|
|
@@ -2862,7 +2944,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
2862
2944
|
|
|
2863
2945
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
2864
2946
|
function ResponsiveText(elementId, options) {
|
|
2865
|
-
var
|
|
2947
|
+
var _this20 = this;
|
|
2866
2948
|
|
|
2867
2949
|
_classCallCheck(this, ResponsiveText);
|
|
2868
2950
|
|
|
@@ -2875,7 +2957,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
2875
2957
|
this.elementId = elementId;
|
|
2876
2958
|
this.canvas = document.createElement('canvas');
|
|
2877
2959
|
window.addEventListener('resize', function () {
|
|
2878
|
-
return
|
|
2960
|
+
return _this20.render();
|
|
2879
2961
|
});
|
|
2880
2962
|
var el = document.getElementById(this.elementId);
|
|
2881
2963
|
|
|
@@ -3094,7 +3176,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3094
3176
|
|
|
3095
3177
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3096
3178
|
function WebsyResultList(elementId, options) {
|
|
3097
|
-
var
|
|
3179
|
+
var _this21 = this;
|
|
3098
3180
|
|
|
3099
3181
|
_classCallCheck(this, WebsyResultList);
|
|
3100
3182
|
|
|
@@ -3122,9 +3204,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3122
3204
|
|
|
3123
3205
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3124
3206
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3125
|
-
|
|
3207
|
+
_this21.options.template = templateString;
|
|
3126
3208
|
|
|
3127
|
-
|
|
3209
|
+
_this21.render();
|
|
3128
3210
|
});
|
|
3129
3211
|
} else {
|
|
3130
3212
|
this.render();
|
|
@@ -3143,7 +3225,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3143
3225
|
}, {
|
|
3144
3226
|
key: "buildHTML",
|
|
3145
3227
|
value: function buildHTML(d) {
|
|
3146
|
-
var
|
|
3228
|
+
var _this22 = this;
|
|
3147
3229
|
|
|
3148
3230
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3149
3231
|
var html = "";
|
|
@@ -3151,7 +3233,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3151
3233
|
if (this.options.template) {
|
|
3152
3234
|
if (d.length > 0) {
|
|
3153
3235
|
d.forEach(function (row, ix) {
|
|
3154
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(
|
|
3236
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(_this22.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3155
3237
|
|
|
3156
3238
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3157
3239
|
|
|
@@ -3271,7 +3353,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3271
3353
|
}, {
|
|
3272
3354
|
key: "handleClick",
|
|
3273
3355
|
value: function handleClick(event) {
|
|
3274
|
-
var
|
|
3356
|
+
var _this23 = this;
|
|
3275
3357
|
|
|
3276
3358
|
if (event.target.classList.contains('clickable')) {
|
|
3277
3359
|
var l = event.target.getAttribute('data-event');
|
|
@@ -3289,8 +3371,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3289
3371
|
l = l[0];
|
|
3290
3372
|
params = params.map(function (p) {
|
|
3291
3373
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
3292
|
-
if (
|
|
3293
|
-
p =
|
|
3374
|
+
if (_this23.rows[+id]) {
|
|
3375
|
+
p = _this23.rows[+id][p];
|
|
3294
3376
|
}
|
|
3295
3377
|
} else if (typeof p === 'string') {
|
|
3296
3378
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -3312,13 +3394,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3312
3394
|
}, {
|
|
3313
3395
|
key: "render",
|
|
3314
3396
|
value: function render() {
|
|
3315
|
-
var
|
|
3397
|
+
var _this24 = this;
|
|
3316
3398
|
|
|
3317
3399
|
if (this.options.entity) {
|
|
3318
3400
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3319
|
-
|
|
3401
|
+
_this24.rows = results.rows;
|
|
3320
3402
|
|
|
3321
|
-
|
|
3403
|
+
_this24.resize();
|
|
3322
3404
|
});
|
|
3323
3405
|
} else {
|
|
3324
3406
|
this.resize();
|
|
@@ -3397,14 +3479,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3397
3479
|
_createClass(WebsyRouter, [{
|
|
3398
3480
|
key: "addGroup",
|
|
3399
3481
|
value: function addGroup(group) {
|
|
3400
|
-
var
|
|
3482
|
+
var _this25 = this;
|
|
3401
3483
|
|
|
3402
3484
|
if (!this.groups[group]) {
|
|
3403
3485
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3404
3486
|
|
|
3405
3487
|
if (els) {
|
|
3406
3488
|
this.getClosestParent(els[0], function (parent) {
|
|
3407
|
-
|
|
3489
|
+
_this25.groups[group] = {
|
|
3408
3490
|
activeView: '',
|
|
3409
3491
|
views: [],
|
|
3410
3492
|
parent: parent.getAttribute('data-view')
|
|
@@ -3729,12 +3811,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3729
3811
|
}, {
|
|
3730
3812
|
key: "showComponents",
|
|
3731
3813
|
value: function showComponents(view) {
|
|
3732
|
-
var
|
|
3814
|
+
var _this26 = this;
|
|
3733
3815
|
|
|
3734
3816
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
3735
3817
|
this.options.views[view].components.forEach(function (c) {
|
|
3736
3818
|
if (typeof c.instance === 'undefined') {
|
|
3737
|
-
|
|
3819
|
+
_this26.prepComponent(c.elementId, c.options);
|
|
3738
3820
|
|
|
3739
3821
|
c.instance = new c.Component(c.elementId, c.options);
|
|
3740
3822
|
} else if (c.instance.render) {
|
|
@@ -4162,7 +4244,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4162
4244
|
|
|
4163
4245
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4164
4246
|
function WebsyTemplate(elementId, options) {
|
|
4165
|
-
var
|
|
4247
|
+
var _this27 = this;
|
|
4166
4248
|
|
|
4167
4249
|
_classCallCheck(this, WebsyTemplate);
|
|
4168
4250
|
|
|
@@ -4188,9 +4270,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4188
4270
|
|
|
4189
4271
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4190
4272
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4191
|
-
|
|
4273
|
+
_this27.options.template = templateString;
|
|
4192
4274
|
|
|
4193
|
-
|
|
4275
|
+
_this27.render();
|
|
4194
4276
|
});
|
|
4195
4277
|
} else {
|
|
4196
4278
|
this.render();
|
|
@@ -4200,7 +4282,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4200
4282
|
_createClass(WebsyTemplate, [{
|
|
4201
4283
|
key: "buildHTML",
|
|
4202
4284
|
value: function buildHTML() {
|
|
4203
|
-
var
|
|
4285
|
+
var _this28 = this;
|
|
4204
4286
|
|
|
4205
4287
|
var html = "";
|
|
4206
4288
|
|
|
@@ -4262,14 +4344,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4262
4344
|
}
|
|
4263
4345
|
|
|
4264
4346
|
if (polarity === true) {
|
|
4265
|
-
if (typeof
|
|
4347
|
+
if (typeof _this28.options.data[parts[0]] !== 'undefined' && _this28.options.data[parts[0]] === parts[1]) {
|
|
4266
4348
|
// remove the <if> tags
|
|
4267
4349
|
removeAll = false;
|
|
4268
4350
|
} else if (parts[0] === parts[1]) {
|
|
4269
4351
|
removeAll = false;
|
|
4270
4352
|
}
|
|
4271
4353
|
} else if (polarity === false) {
|
|
4272
|
-
if (typeof
|
|
4354
|
+
if (typeof _this28.options.data[parts[0]] !== 'undefined' && _this28.options.data[parts[0]] !== parts[1]) {
|
|
4273
4355
|
// remove the <if> tags
|
|
4274
4356
|
removeAll = false;
|
|
4275
4357
|
}
|
|
@@ -4515,10 +4597,10 @@ var WebsyUtils = {
|
|
|
4515
4597
|
var s = '';
|
|
4516
4598
|
var d = 1; // let out
|
|
4517
4599
|
|
|
4518
|
-
for (var
|
|
4519
|
-
if (n >= ranges[
|
|
4520
|
-
d = ranges[
|
|
4521
|
-
s = ranges[
|
|
4600
|
+
for (var _i8 = 0; _i8 < ranges.length; _i8++) {
|
|
4601
|
+
if (n >= ranges[_i8].divider) {
|
|
4602
|
+
d = ranges[_i8].divider;
|
|
4603
|
+
s = ranges[_i8].suffix; // out = (n / ranges[i].divider).toFixed(decimals).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$100,')
|
|
4522
4604
|
|
|
4523
4605
|
break;
|
|
4524
4606
|
}
|
|
@@ -4556,7 +4638,7 @@ var WebsyUtils = {
|
|
|
4556
4638
|
|
|
4557
4639
|
var WebsyTable = /*#__PURE__*/function () {
|
|
4558
4640
|
function WebsyTable(elementId, options) {
|
|
4559
|
-
var
|
|
4641
|
+
var _this29 = this;
|
|
4560
4642
|
|
|
4561
4643
|
_classCallCheck(this, WebsyTable);
|
|
4562
4644
|
|
|
@@ -4594,8 +4676,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4594
4676
|
allowClear: false,
|
|
4595
4677
|
disableSearch: true,
|
|
4596
4678
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4597
|
-
if (
|
|
4598
|
-
|
|
4679
|
+
if (_this29.options.onChangePageSize) {
|
|
4680
|
+
_this29.options.onChangePageSize(selectedItem.value);
|
|
4599
4681
|
}
|
|
4600
4682
|
}
|
|
4601
4683
|
});
|
|
@@ -4616,7 +4698,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4616
4698
|
_createClass(WebsyTable, [{
|
|
4617
4699
|
key: "appendRows",
|
|
4618
4700
|
value: function appendRows(data) {
|
|
4619
|
-
var
|
|
4701
|
+
var _this30 = this;
|
|
4620
4702
|
|
|
4621
4703
|
this.hideError();
|
|
4622
4704
|
var bodyHTML = '';
|
|
@@ -4624,15 +4706,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4624
4706
|
if (data) {
|
|
4625
4707
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4626
4708
|
return '<tr>' + r.map(function (c, i) {
|
|
4627
|
-
if (
|
|
4709
|
+
if (_this30.options.columns[i].show !== false) {
|
|
4628
4710
|
var style = '';
|
|
4629
4711
|
|
|
4630
4712
|
if (c.style) {
|
|
4631
4713
|
style += c.style;
|
|
4632
4714
|
}
|
|
4633
4715
|
|
|
4634
|
-
if (
|
|
4635
|
-
style += "width: ".concat(
|
|
4716
|
+
if (_this30.options.columns[i].width) {
|
|
4717
|
+
style += "width: ".concat(_this30.options.columns[i].width, "; ");
|
|
4636
4718
|
}
|
|
4637
4719
|
|
|
4638
4720
|
if (c.backgroundColor) {
|
|
@@ -4647,18 +4729,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4647
4729
|
style += "color: ".concat(c.color, "; ");
|
|
4648
4730
|
}
|
|
4649
4731
|
|
|
4650
|
-
if (
|
|
4651
|
-
return "\n <td \n data-row-index='".concat(
|
|
4652
|
-
} else if ((
|
|
4653
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
4732
|
+
if (_this30.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
4733
|
+
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 ");
|
|
4734
|
+
} else if ((_this30.options.columns[i].showAsNavigatorLink === true || _this30.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
4735
|
+
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 ");
|
|
4654
4736
|
} else {
|
|
4655
4737
|
var info = c.value;
|
|
4656
4738
|
|
|
4657
|
-
if (
|
|
4739
|
+
if (_this30.options.columns[i].showAsImage === true) {
|
|
4658
4740
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4659
4741
|
}
|
|
4660
4742
|
|
|
4661
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
4743
|
+
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 ");
|
|
4662
4744
|
}
|
|
4663
4745
|
}
|
|
4664
4746
|
}).join('') + '</tr>';
|
|
@@ -4830,7 +4912,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4830
4912
|
}, {
|
|
4831
4913
|
key: "render",
|
|
4832
4914
|
value: function render(data) {
|
|
4833
|
-
var
|
|
4915
|
+
var _this31 = this;
|
|
4834
4916
|
|
|
4835
4917
|
if (!this.options.columns) {
|
|
4836
4918
|
return;
|
|
@@ -4855,7 +4937,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4855
4937
|
|
|
4856
4938
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
4857
4939
|
if (c.show !== false) {
|
|
4858
|
-
return "\n <th ".concat(c.width ? 'style="width: ' + (c.width || 'auto') + ';"' : '', ">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-index=\"").concat(i, "\" \n data-sort=\"").concat(c.sort, "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n <!--").concat(c.searchable === true ?
|
|
4940
|
+
return "\n <th ".concat(c.width ? 'style="width: ' + (c.width || 'auto') + ';"' : '', ">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-index=\"").concat(i, "\" \n data-sort=\"").concat(c.sort, "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n <!--").concat(c.searchable === true ? _this31.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
4859
4941
|
}
|
|
4860
4942
|
}).join('') + '</tr>';
|
|
4861
4943
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -4874,7 +4956,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4874
4956
|
|
|
4875
4957
|
if (pagingEl) {
|
|
4876
4958
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
4877
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
4959
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this31.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
4878
4960
|
});
|
|
4879
4961
|
var startIndex = 0;
|
|
4880
4962
|
|
|
@@ -4942,7 +5024,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4942
5024
|
|
|
4943
5025
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
4944
5026
|
function WebsyTable2(elementId, options) {
|
|
4945
|
-
var
|
|
5027
|
+
var _this32 = this;
|
|
4946
5028
|
|
|
4947
5029
|
_classCallCheck(this, WebsyTable2);
|
|
4948
5030
|
|
|
@@ -4983,8 +5065,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4983
5065
|
allowClear: false,
|
|
4984
5066
|
disableSearch: true,
|
|
4985
5067
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4986
|
-
if (
|
|
4987
|
-
|
|
5068
|
+
if (_this32.options.onChangePageSize) {
|
|
5069
|
+
_this32.options.onChangePageSize(selectedItem.value);
|
|
4988
5070
|
}
|
|
4989
5071
|
}
|
|
4990
5072
|
});
|
|
@@ -5008,7 +5090,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5008
5090
|
_createClass(WebsyTable2, [{
|
|
5009
5091
|
key: "appendRows",
|
|
5010
5092
|
value: function appendRows(data) {
|
|
5011
|
-
var
|
|
5093
|
+
var _this33 = this;
|
|
5012
5094
|
|
|
5013
5095
|
this.hideError();
|
|
5014
5096
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -5017,15 +5099,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5017
5099
|
if (data) {
|
|
5018
5100
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5019
5101
|
return '<tr>' + r.map(function (c, i) {
|
|
5020
|
-
if (
|
|
5021
|
-
var style = "height: ".concat(
|
|
5102
|
+
if (_this33.options.columns[i].show !== false) {
|
|
5103
|
+
var style = "height: ".concat(_this33.options.cellSize, "px; line-height: ").concat(_this33.options.cellSize, "px;");
|
|
5022
5104
|
|
|
5023
5105
|
if (c.style) {
|
|
5024
5106
|
style += c.style;
|
|
5025
5107
|
}
|
|
5026
5108
|
|
|
5027
|
-
if (
|
|
5028
|
-
style += "width: ".concat(
|
|
5109
|
+
if (_this33.options.columns[i].width) {
|
|
5110
|
+
style += "width: ".concat(_this33.options.columns[i].width, "; ");
|
|
5029
5111
|
}
|
|
5030
5112
|
|
|
5031
5113
|
if (c.backgroundColor) {
|
|
@@ -5040,18 +5122,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5040
5122
|
style += "color: ".concat(c.color, "; ");
|
|
5041
5123
|
}
|
|
5042
5124
|
|
|
5043
|
-
if (
|
|
5044
|
-
return "\n <td \n data-row-index='".concat(
|
|
5045
|
-
} else if ((
|
|
5046
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5125
|
+
if (_this33.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5126
|
+
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 ");
|
|
5127
|
+
} else if ((_this33.options.columns[i].showAsNavigatorLink === true || _this33.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5128
|
+
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 ");
|
|
5047
5129
|
} else {
|
|
5048
5130
|
var info = c.value;
|
|
5049
5131
|
|
|
5050
|
-
if (
|
|
5132
|
+
if (_this33.options.columns[i].showAsImage === true) {
|
|
5051
5133
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5052
5134
|
}
|
|
5053
5135
|
|
|
5054
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5136
|
+
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 ");
|
|
5055
5137
|
}
|
|
5056
5138
|
}
|
|
5057
5139
|
}).join('') + '</tr>';
|
|
@@ -5309,7 +5391,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5309
5391
|
}, {
|
|
5310
5392
|
key: "render",
|
|
5311
5393
|
value: function render(data) {
|
|
5312
|
-
var
|
|
5394
|
+
var _this34 = this;
|
|
5313
5395
|
|
|
5314
5396
|
if (!this.options.columns) {
|
|
5315
5397
|
return;
|
|
@@ -5345,7 +5427,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5345
5427
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5346
5428
|
}
|
|
5347
5429
|
|
|
5348
|
-
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 ?
|
|
5430
|
+
return "\n <th style=\"".concat(style, "\">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-index=\"").concat(i, "\" \n data-sort=\"").concat(c.sort, "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n ").concat(c.searchable === true ? _this34.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5349
5431
|
}
|
|
5350
5432
|
}).join('') + '</tr>';
|
|
5351
5433
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5356,7 +5438,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5356
5438
|
var dropdownHTML = "";
|
|
5357
5439
|
this.options.columns.forEach(function (c, i) {
|
|
5358
5440
|
if (c.searchable && c.searchField) {
|
|
5359
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5441
|
+
dropdownHTML += "\n <div id=\"".concat(_this34.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
5360
5442
|
}
|
|
5361
5443
|
});
|
|
5362
5444
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5378,7 +5460,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5378
5460
|
|
|
5379
5461
|
if (pagingEl) {
|
|
5380
5462
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5381
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5463
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this34.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5382
5464
|
});
|
|
5383
5465
|
var startIndex = 0;
|
|
5384
5466
|
|
|
@@ -5465,7 +5547,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5465
5547
|
}, {
|
|
5466
5548
|
key: "getColumnParameters",
|
|
5467
5549
|
value: function getColumnParameters(values) {
|
|
5468
|
-
var
|
|
5550
|
+
var _this35 = this;
|
|
5469
5551
|
|
|
5470
5552
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
5471
5553
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -5473,10 +5555,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5473
5555
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
5474
5556
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5475
5557
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
5476
|
-
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 ?
|
|
5558
|
+
return "\n <th>\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField\" \n >\n ".concat(c.value || 'nbsp;', "\n </div>\n </div> \n ").concat(c.searchable === true ? _this35.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5477
5559
|
}).join('') + '</tr>';
|
|
5478
5560
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
5479
|
-
return "\n <td \n style='height: ".concat(
|
|
5561
|
+
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 ");
|
|
5480
5562
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
5481
5563
|
|
|
5482
5564
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -5497,8 +5579,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5497
5579
|
|
|
5498
5580
|
|
|
5499
5581
|
if (accWidth < (tableContainerEl.offsetWidth || tableContainerEl.clientWidth) - nonScrollableWidth) {
|
|
5500
|
-
for (var
|
|
5501
|
-
cellWidths[
|
|
5582
|
+
for (var _i9 = this.options.leftColumns; _i9 < cellWidths.length; _i9++) {
|
|
5583
|
+
cellWidths[_i9] = ((tableContainerEl.offsetWidth || tableContainerEl.clientWidth) - nonScrollableWidth) / (cellWidths.length - this.options.leftColumns);
|
|
5502
5584
|
}
|
|
5503
5585
|
} // const cellWidth = firstDataCell.offsetWidth || firstDataCell.clientWidth
|
|
5504
5586
|
// tableEl.style.width = ''
|
|
@@ -5526,7 +5608,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5526
5608
|
|
|
5527
5609
|
var WebsyChart = /*#__PURE__*/function () {
|
|
5528
5610
|
function WebsyChart(elementId, options) {
|
|
5529
|
-
var
|
|
5611
|
+
var _this36 = this;
|
|
5530
5612
|
|
|
5531
5613
|
_classCallCheck(this, WebsyChart);
|
|
5532
5614
|
|
|
@@ -5575,22 +5657,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5575
5657
|
this.invertOverride = function (input, input2) {
|
|
5576
5658
|
var xAxis = 'bottomAxis';
|
|
5577
5659
|
|
|
5578
|
-
if (
|
|
5660
|
+
if (_this36.options.orientation === 'horizontal') {
|
|
5579
5661
|
xAxis = 'leftAxis';
|
|
5580
5662
|
}
|
|
5581
5663
|
|
|
5582
|
-
var width =
|
|
5664
|
+
var width = _this36[xAxis].step();
|
|
5583
5665
|
|
|
5584
5666
|
var output;
|
|
5585
5667
|
|
|
5586
|
-
var domain = _toConsumableArray(
|
|
5668
|
+
var domain = _toConsumableArray(_this36[xAxis].domain());
|
|
5587
5669
|
|
|
5588
|
-
if (
|
|
5670
|
+
if (_this36.options.orientation === 'horizontal') {
|
|
5589
5671
|
domain = domain.reverse();
|
|
5590
5672
|
}
|
|
5591
5673
|
|
|
5592
5674
|
for (var j = 0; j < domain.length; j++) {
|
|
5593
|
-
var breakA =
|
|
5675
|
+
var breakA = _this36[xAxis](domain[j]) - width / 2;
|
|
5594
5676
|
var breakB = breakA + width;
|
|
5595
5677
|
|
|
5596
5678
|
if (input > breakA && input <= breakB) {
|
|
@@ -5690,10 +5772,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5690
5772
|
}, {
|
|
5691
5773
|
key: "handleEventMouseMove",
|
|
5692
5774
|
value: function handleEventMouseMove(event, d) {
|
|
5693
|
-
var
|
|
5775
|
+
var _this37 = this;
|
|
5694
5776
|
|
|
5695
5777
|
var bisectDate = d3.bisector(function (d) {
|
|
5696
|
-
return
|
|
5778
|
+
return _this37.parseX(d.x.value);
|
|
5697
5779
|
}).left;
|
|
5698
5780
|
|
|
5699
5781
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -5732,8 +5814,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5732
5814
|
}
|
|
5733
5815
|
|
|
5734
5816
|
this.options.data.series.forEach(function (s) {
|
|
5735
|
-
if (
|
|
5736
|
-
xPoint =
|
|
5817
|
+
if (_this37.options.data[xData].scale !== 'Time') {
|
|
5818
|
+
xPoint = _this37[xAxis](_this37.parseX(xLabel));
|
|
5737
5819
|
s.data.forEach(function (d) {
|
|
5738
5820
|
if (d.x.value === xLabel) {
|
|
5739
5821
|
if (!tooltipTitle) {
|
|
@@ -5752,13 +5834,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5752
5834
|
var pointA = s.data[index - 1];
|
|
5753
5835
|
var pointB = s.data[index];
|
|
5754
5836
|
|
|
5755
|
-
if (
|
|
5837
|
+
if (_this37.options.orientation === 'horizontal') {
|
|
5756
5838
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
5757
5839
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
5758
5840
|
}
|
|
5759
5841
|
|
|
5760
5842
|
if (pointA && !pointB) {
|
|
5761
|
-
xPoint =
|
|
5843
|
+
xPoint = _this37[xAxis](_this37.parseX(pointA.x.value));
|
|
5762
5844
|
tooltipTitle = pointA.x.value;
|
|
5763
5845
|
|
|
5764
5846
|
if (!pointA.y.color) {
|
|
@@ -5768,12 +5850,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5768
5850
|
tooltipData.push(pointA.y);
|
|
5769
5851
|
|
|
5770
5852
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
5771
|
-
tooltipTitle = d3.timeFormat(
|
|
5853
|
+
tooltipTitle = d3.timeFormat(_this37.options.dateFormat || _this37.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
5772
5854
|
}
|
|
5773
5855
|
}
|
|
5774
5856
|
|
|
5775
5857
|
if (pointB && !pointA) {
|
|
5776
|
-
xPoint =
|
|
5858
|
+
xPoint = _this37[xAxis](_this37.parseX(pointB.x.value));
|
|
5777
5859
|
tooltipTitle = pointB.x.value;
|
|
5778
5860
|
|
|
5779
5861
|
if (!pointB.y.color) {
|
|
@@ -5783,14 +5865,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5783
5865
|
tooltipData.push(pointB.y);
|
|
5784
5866
|
|
|
5785
5867
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5786
|
-
tooltipTitle = d3.timeFormat(
|
|
5868
|
+
tooltipTitle = d3.timeFormat(_this37.options.dateFormat || _this37.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5787
5869
|
}
|
|
5788
5870
|
}
|
|
5789
5871
|
|
|
5790
5872
|
if (pointA && pointB) {
|
|
5791
|
-
var d0 =
|
|
5873
|
+
var d0 = _this37[xAxis](_this37.parseX(pointA.x.value));
|
|
5792
5874
|
|
|
5793
|
-
var d1 =
|
|
5875
|
+
var d1 = _this37[xAxis](_this37.parseX(pointB.x.value));
|
|
5794
5876
|
|
|
5795
5877
|
var mid = Math.abs(d0 - d1) / 2;
|
|
5796
5878
|
|
|
@@ -5799,7 +5881,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5799
5881
|
tooltipTitle = pointB.x.value;
|
|
5800
5882
|
|
|
5801
5883
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5802
|
-
tooltipTitle = d3.timeFormat(
|
|
5884
|
+
tooltipTitle = d3.timeFormat(_this37.options.dateFormat || _this37.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5803
5885
|
}
|
|
5804
5886
|
|
|
5805
5887
|
if (!pointB.y.color) {
|
|
@@ -5812,7 +5894,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5812
5894
|
tooltipTitle = pointA.x.value;
|
|
5813
5895
|
|
|
5814
5896
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5815
|
-
tooltipTitle = d3.timeFormat(
|
|
5897
|
+
tooltipTitle = d3.timeFormat(_this37.options.dateFormat || _this37.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5816
5898
|
}
|
|
5817
5899
|
|
|
5818
5900
|
if (!pointA.y.color) {
|
|
@@ -5917,7 +5999,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5917
5999
|
}, {
|
|
5918
6000
|
key: "render",
|
|
5919
6001
|
value: function render(options) {
|
|
5920
|
-
var
|
|
6002
|
+
var _this38 = this;
|
|
5921
6003
|
|
|
5922
6004
|
/* global d3 options WebsyUtils */
|
|
5923
6005
|
if (typeof options !== 'undefined') {
|
|
@@ -5986,7 +6068,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5986
6068
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
5987
6069
|
return {
|
|
5988
6070
|
value: s.label || s.key,
|
|
5989
|
-
color: s.color ||
|
|
6071
|
+
color: s.color || _this38.options.colors[i % _this38.options.colors.length]
|
|
5990
6072
|
};
|
|
5991
6073
|
});
|
|
5992
6074
|
|
|
@@ -6238,7 +6320,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6238
6320
|
|
|
6239
6321
|
if (this.options.data.bottom.formatter) {
|
|
6240
6322
|
bAxisFunc.tickFormat(function (d) {
|
|
6241
|
-
return
|
|
6323
|
+
return _this38.options.data.bottom.formatter(d);
|
|
6242
6324
|
});
|
|
6243
6325
|
}
|
|
6244
6326
|
|
|
@@ -6264,8 +6346,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6264
6346
|
|
|
6265
6347
|
if (this.options.margin.axisLeft > 0) {
|
|
6266
6348
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
6267
|
-
if (
|
|
6268
|
-
d =
|
|
6349
|
+
if (_this38.options.data.left.formatter) {
|
|
6350
|
+
d = _this38.options.data.left.formatter(d);
|
|
6269
6351
|
}
|
|
6270
6352
|
|
|
6271
6353
|
return d;
|
|
@@ -6302,8 +6384,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6302
6384
|
|
|
6303
6385
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
6304
6386
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
6305
|
-
if (
|
|
6306
|
-
d =
|
|
6387
|
+
if (_this38.options.data.right.formatter) {
|
|
6388
|
+
d = _this38.options.data.right.formatter(d);
|
|
6307
6389
|
}
|
|
6308
6390
|
|
|
6309
6391
|
return d;
|
|
@@ -6329,16 +6411,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6329
6411
|
|
|
6330
6412
|
this.options.data.series.forEach(function (series, index) {
|
|
6331
6413
|
if (!series.key) {
|
|
6332
|
-
series.key =
|
|
6414
|
+
series.key = _this38.createIdentity();
|
|
6333
6415
|
}
|
|
6334
6416
|
|
|
6335
6417
|
if (!series.color) {
|
|
6336
|
-
series.color =
|
|
6418
|
+
series.color = _this38.options.colors[index % _this38.options.colors.length];
|
|
6337
6419
|
}
|
|
6338
6420
|
|
|
6339
|
-
|
|
6421
|
+
_this38["render".concat(series.type || 'bar')](series, index);
|
|
6340
6422
|
|
|
6341
|
-
|
|
6423
|
+
_this38.renderLabels(series, index);
|
|
6342
6424
|
});
|
|
6343
6425
|
}
|
|
6344
6426
|
}
|
|
@@ -6346,17 +6428,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6346
6428
|
}, {
|
|
6347
6429
|
key: "renderarea",
|
|
6348
6430
|
value: function renderarea(series, index) {
|
|
6349
|
-
var
|
|
6431
|
+
var _this39 = this;
|
|
6350
6432
|
|
|
6351
6433
|
/* global d3 series index */
|
|
6352
6434
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
6353
6435
|
return d3.area().x(function (d) {
|
|
6354
|
-
return
|
|
6436
|
+
return _this39[xAxis](_this39.parseX(d.x.value));
|
|
6355
6437
|
}).y0(function (d) {
|
|
6356
|
-
return
|
|
6438
|
+
return _this39[yAxis](0);
|
|
6357
6439
|
}).y1(function (d) {
|
|
6358
|
-
return
|
|
6359
|
-
}).curve(d3[curveStyle ||
|
|
6440
|
+
return _this39[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6441
|
+
}).curve(d3[curveStyle || _this39.options.curveStyle]);
|
|
6360
6442
|
};
|
|
6361
6443
|
|
|
6362
6444
|
var xAxis = 'bottomAxis';
|
|
@@ -6531,15 +6613,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6531
6613
|
}, {
|
|
6532
6614
|
key: "renderline",
|
|
6533
6615
|
value: function renderline(series, index) {
|
|
6534
|
-
var
|
|
6616
|
+
var _this40 = this;
|
|
6535
6617
|
|
|
6536
6618
|
/* global series index d3 */
|
|
6537
6619
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
6538
6620
|
return d3.line().x(function (d) {
|
|
6539
|
-
return
|
|
6621
|
+
return _this40[xAxis](_this40.parseX(d.x.value));
|
|
6540
6622
|
}).y(function (d) {
|
|
6541
|
-
return
|
|
6542
|
-
}).curve(d3[curveStyle ||
|
|
6623
|
+
return _this40[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6624
|
+
}).curve(d3[curveStyle || _this40.options.curveStyle]);
|
|
6543
6625
|
};
|
|
6544
6626
|
|
|
6545
6627
|
var xAxis = 'bottomAxis';
|
|
@@ -6577,14 +6659,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6577
6659
|
}, {
|
|
6578
6660
|
key: "rendersymbol",
|
|
6579
6661
|
value: function rendersymbol(series, index) {
|
|
6580
|
-
var
|
|
6662
|
+
var _this41 = this;
|
|
6581
6663
|
|
|
6582
6664
|
/* global d3 series index series.key */
|
|
6583
6665
|
var drawSymbol = function drawSymbol(size) {
|
|
6584
6666
|
return d3.symbol() // .type(d => {
|
|
6585
6667
|
// return d3.symbols[0]
|
|
6586
6668
|
// })
|
|
6587
|
-
.size(size ||
|
|
6669
|
+
.size(size || _this41.options.symbolSize);
|
|
6588
6670
|
};
|
|
6589
6671
|
|
|
6590
6672
|
var xAxis = 'bottomAxis';
|
|
@@ -6602,7 +6684,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6602
6684
|
symbols.attr('d', function (d) {
|
|
6603
6685
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
6604
6686
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
6605
|
-
return "translate(".concat(
|
|
6687
|
+
return "translate(".concat(_this41[xAxis](_this41.parseX(d.x.value)), ", ").concat(_this41[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
6606
6688
|
}); // Enter
|
|
6607
6689
|
|
|
6608
6690
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -6611,7 +6693,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6611
6693
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
6612
6694
|
return "symbol symbol_".concat(series.key);
|
|
6613
6695
|
}).attr('transform', function (d) {
|
|
6614
|
-
return "translate(".concat(
|
|
6696
|
+
return "translate(".concat(_this41[xAxis](_this41.parseX(d.x.value)), ", ").concat(_this41[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
6615
6697
|
});
|
|
6616
6698
|
}
|
|
6617
6699
|
}, {
|
|
@@ -6766,7 +6848,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6766
6848
|
}, {
|
|
6767
6849
|
key: "resize",
|
|
6768
6850
|
value: function resize() {
|
|
6769
|
-
var
|
|
6851
|
+
var _this42 = this;
|
|
6770
6852
|
|
|
6771
6853
|
var el = document.getElementById(this.elementId);
|
|
6772
6854
|
|
|
@@ -6779,7 +6861,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6779
6861
|
// }
|
|
6780
6862
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
6781
6863
|
html += this._data.map(function (d, i) {
|
|
6782
|
-
return
|
|
6864
|
+
return _this42.getLegendItemHTML(d);
|
|
6783
6865
|
}).join('');
|
|
6784
6866
|
html += "\n <div>\n ";
|
|
6785
6867
|
el.innerHTML = html;
|
|
@@ -6951,7 +7033,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6951
7033
|
}, {
|
|
6952
7034
|
key: "render",
|
|
6953
7035
|
value: function render() {
|
|
6954
|
-
var
|
|
7036
|
+
var _this43 = this;
|
|
6955
7037
|
|
|
6956
7038
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
6957
7039
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -6960,7 +7042,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6960
7042
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
6961
7043
|
return {
|
|
6962
7044
|
value: s.label || s.key,
|
|
6963
|
-
color: s.color ||
|
|
7045
|
+
color: s.color || _this43.options.colors[i % _this43.options.colors.length]
|
|
6964
7046
|
};
|
|
6965
7047
|
});
|
|
6966
7048
|
var longestValue = legendData.map(function (s) {
|
|
@@ -7024,7 +7106,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7024
7106
|
|
|
7025
7107
|
if (this.polygons) {
|
|
7026
7108
|
this.polygons.forEach(function (p) {
|
|
7027
|
-
return
|
|
7109
|
+
return _this43.map.removeLayer(p);
|
|
7028
7110
|
});
|
|
7029
7111
|
}
|
|
7030
7112
|
|
|
@@ -7082,18 +7164,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7082
7164
|
}
|
|
7083
7165
|
|
|
7084
7166
|
if (!p.options.color) {
|
|
7085
|
-
p.options.color =
|
|
7167
|
+
p.options.color = _this43.options.colors[i % _this43.options.colors.length];
|
|
7086
7168
|
}
|
|
7087
7169
|
|
|
7088
7170
|
var pol = L.polygon(p.data.map(function (c) {
|
|
7089
7171
|
return c.map(function (d) {
|
|
7090
7172
|
return [d.Latitude, d.Longitude];
|
|
7091
7173
|
});
|
|
7092
|
-
}), p.options).addTo(
|
|
7174
|
+
}), p.options).addTo(_this43.map);
|
|
7093
7175
|
|
|
7094
|
-
|
|
7176
|
+
_this43.polygons.push(pol);
|
|
7095
7177
|
|
|
7096
|
-
|
|
7178
|
+
_this43.map.fitBounds(pol.getBounds());
|
|
7097
7179
|
});
|
|
7098
7180
|
} // if (this.data.markers.length > 0) {
|
|
7099
7181
|
// el.classList.remove('hidden')
|