@websy/websy-designs 1.2.6 → 1.2.7
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 +81 -20
- package/dist/websy-designs-es6.js +309 -228
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +81 -20
- package/dist/websy-designs.js +309 -228
- 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 = {};
|
|
@@ -983,8 +1020,16 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
983
1020
|
if (disabled.indexOf(_d) === -1) {
|
|
984
1021
|
this.validYears.push(_d);
|
|
985
1022
|
}
|
|
986
|
-
} else if (this.options.mode === 'hour') {//
|
|
1023
|
+
} else if (this.options.mode === 'hour') {//
|
|
987
1024
|
}
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
if (this.options.mode === 'hour') {
|
|
1028
|
+
this.options.hours.forEach(function (h) {
|
|
1029
|
+
if (disabled.indexOf(h.text) === -1) {
|
|
1030
|
+
_this6.validHours.push(h);
|
|
1031
|
+
}
|
|
1032
|
+
});
|
|
988
1033
|
} // check each range to see if it can be enabled
|
|
989
1034
|
|
|
990
1035
|
|
|
@@ -1028,7 +1073,22 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1028
1073
|
}
|
|
1029
1074
|
}
|
|
1030
1075
|
} else if (this.options.mode === 'monthyear') {//
|
|
1031
|
-
} else if (this.options.mode === 'hour') {
|
|
1076
|
+
} else if (this.options.mode === 'hour') {
|
|
1077
|
+
if (this.validDates.indexOf(r.range[0]) !== -1) {
|
|
1078
|
+
r.disabled = false;
|
|
1079
|
+
} else if (r.range[1]) {
|
|
1080
|
+
if (this.validDates.indexOf(r.range[1]) !== -1) {
|
|
1081
|
+
r.disabled = false;
|
|
1082
|
+
} else {
|
|
1083
|
+
// check the full range until a match is found
|
|
1084
|
+
for (var _i5 = r.range[0]; _i5 <= r.range[1]; _i5++) {
|
|
1085
|
+
if (this.validDates.indexOf(r.range[0] + _i5) !== -1) {
|
|
1086
|
+
r.disabled = false;
|
|
1087
|
+
break;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1032
1092
|
}
|
|
1033
1093
|
}
|
|
1034
1094
|
|
|
@@ -1047,7 +1107,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1047
1107
|
if (months[key][0].dayOfWeek > 0) {
|
|
1048
1108
|
var paddedDays = [];
|
|
1049
1109
|
|
|
1050
|
-
for (var
|
|
1110
|
+
for (var _i6 = 0; _i6 < months[key][0].dayOfWeek; _i6++) {
|
|
1051
1111
|
paddedDays.push("<li> </li>");
|
|
1052
1112
|
}
|
|
1053
1113
|
|
|
@@ -1055,7 +1115,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1055
1115
|
}
|
|
1056
1116
|
|
|
1057
1117
|
html += months[key].map(function (d) {
|
|
1058
|
-
return "<li id='".concat(
|
|
1118
|
+
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
1119
|
}).join('');
|
|
1060
1120
|
html += "\n </ul>\n </div>\n ";
|
|
1061
1121
|
}
|
|
@@ -1068,7 +1128,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1068
1128
|
|
|
1069
1129
|
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'><ul>");
|
|
1070
1130
|
html += yearList.map(function (d) {
|
|
1071
|
-
return "<li id='".concat(
|
|
1131
|
+
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
1132
|
}).join('');
|
|
1073
1133
|
html += "</ul></div>";
|
|
1074
1134
|
} else if (this.options.mode === 'monthyear') {
|
|
@@ -1080,7 +1140,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1080
1140
|
if (this.monthYears[year][0].monthNum > 0) {
|
|
1081
1141
|
var paddedMonths = [];
|
|
1082
1142
|
|
|
1083
|
-
for (var
|
|
1143
|
+
for (var _i7 = 0; _i7 < this.monthYears[year][0].monthNum; _i7++) {
|
|
1084
1144
|
paddedMonths.push("<li> </li>");
|
|
1085
1145
|
}
|
|
1086
1146
|
|
|
@@ -1088,13 +1148,18 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1088
1148
|
}
|
|
1089
1149
|
|
|
1090
1150
|
html += this.monthYears[year].map(function (d) {
|
|
1091
|
-
return "<li id='".concat(
|
|
1151
|
+
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
1152
|
}).join('');
|
|
1093
1153
|
html += "</ul>";
|
|
1094
1154
|
}
|
|
1095
1155
|
|
|
1096
1156
|
html += "</div>";
|
|
1097
|
-
} else if (this.options.mode === 'hour') {
|
|
1157
|
+
} else if (this.options.mode === 'hour') {
|
|
1158
|
+
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'><ul>");
|
|
1159
|
+
html += this.options.hours.map(function (h) {
|
|
1160
|
+
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>");
|
|
1161
|
+
}).join('');
|
|
1162
|
+
html += "</ul></div>";
|
|
1098
1163
|
}
|
|
1099
1164
|
|
|
1100
1165
|
return html;
|
|
@@ -1102,10 +1167,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1102
1167
|
}, {
|
|
1103
1168
|
key: "renderRanges",
|
|
1104
1169
|
value: function renderRanges() {
|
|
1105
|
-
var
|
|
1170
|
+
var _this7 = this;
|
|
1106
1171
|
|
|
1107
1172
|
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 ===
|
|
1173
|
+
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
1174
|
}).join('') + "<li data-index='-1' class='websy-date-picker-range ".concat(this.selectedRange === -1 ? 'active' : '', "'>Custom</li>");
|
|
1110
1175
|
}
|
|
1111
1176
|
}, {
|
|
@@ -1151,7 +1216,14 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1151
1216
|
this.customRangeSelected = true;
|
|
1152
1217
|
console.log('current selection', this.currentselection);
|
|
1153
1218
|
} else {
|
|
1154
|
-
this.currentselection.
|
|
1219
|
+
var index = this.currentselection.indexOf(timestamp);
|
|
1220
|
+
|
|
1221
|
+
if (index !== -1) {
|
|
1222
|
+
this.currentselection.splice(index, 1);
|
|
1223
|
+
} else {
|
|
1224
|
+
this.currentselection.push(timestamp);
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1155
1227
|
this.currentselection.sort(function (a, b) {
|
|
1156
1228
|
return a - b;
|
|
1157
1229
|
});
|
|
@@ -1165,7 +1237,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1165
1237
|
} else if (this.options.mode === 'year') {
|
|
1166
1238
|
this.selectedRangeDates = [this.currentselection[0], this.currentselection[1] || this.currentselection[0]];
|
|
1167
1239
|
} else if (this.options.mode === 'monthyear') {//
|
|
1168
|
-
} else if (this.options.mode === 'hour') {
|
|
1240
|
+
} else if (this.options.mode === 'hour') {
|
|
1241
|
+
this.selectedRangeDates = [this.currentselection[0], this.currentselection[1] || this.currentselection[0]];
|
|
1169
1242
|
} // if (this.currentselection.length === 2) {
|
|
1170
1243
|
// this.currentselection = []
|
|
1171
1244
|
// }
|
|
@@ -1234,33 +1307,36 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1234
1307
|
} else if (this.options.mode === 'monthyear') {
|
|
1235
1308
|
this.options.minAllowedDate = range[0];
|
|
1236
1309
|
this.options.maxAllowedDate = range[1] || range[0];
|
|
1237
|
-
} else if (this.options.mode === 'hour') {
|
|
1310
|
+
} else if (this.options.mode === 'hour') {
|
|
1311
|
+
this.options.minAllowedHour = range[0];
|
|
1312
|
+
this.options.maxAllowedHour = range[1] || range[0];
|
|
1238
1313
|
}
|
|
1239
1314
|
}
|
|
1240
1315
|
}, {
|
|
1241
1316
|
key: "updateRange",
|
|
1242
1317
|
value: function updateRange() {
|
|
1243
|
-
var
|
|
1318
|
+
var _this8 = this;
|
|
1244
1319
|
|
|
1245
1320
|
var range;
|
|
1246
1321
|
|
|
1247
1322
|
if (this.selectedRange === -1) {
|
|
1248
1323
|
var list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(function (d) {
|
|
1249
|
-
if (
|
|
1324
|
+
if (_this8.options.mode === 'date') {
|
|
1250
1325
|
if (!d.toLocaleDateString) {
|
|
1251
1326
|
d = new Date(d);
|
|
1252
1327
|
}
|
|
1253
1328
|
|
|
1254
1329
|
return d.toLocaleDateString();
|
|
1255
|
-
} else if (
|
|
1330
|
+
} else if (_this8.options.mode === 'year') {
|
|
1256
1331
|
return d;
|
|
1257
|
-
} else if (
|
|
1332
|
+
} else if (_this8.options.mode === 'monthyear') {
|
|
1258
1333
|
if (!d.getMonth) {
|
|
1259
1334
|
d = new Date(d);
|
|
1260
1335
|
}
|
|
1261
1336
|
|
|
1262
|
-
return "".concat(
|
|
1263
|
-
} else if (
|
|
1337
|
+
return "".concat(_this8.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
1338
|
+
} else if (_this8.options.mode === 'hour') {
|
|
1339
|
+
return d;
|
|
1264
1340
|
}
|
|
1265
1341
|
});
|
|
1266
1342
|
var start = list[0];
|
|
@@ -1272,6 +1348,11 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1272
1348
|
start = "".concat(list.length, " selected");
|
|
1273
1349
|
}
|
|
1274
1350
|
|
|
1351
|
+
if (this.options.mode === 'hour') {
|
|
1352
|
+
start = this.options.hours[start].text;
|
|
1353
|
+
end = "".concat(this.customRangeSelected === true ? ' - ' : '').concat(this.options.hours[list[list.length - 1]].text);
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1275
1356
|
range = {
|
|
1276
1357
|
label: "".concat(start).concat(end)
|
|
1277
1358
|
};
|
|
@@ -1308,7 +1389,7 @@ Date.prototype.floor = function () {
|
|
|
1308
1389
|
|
|
1309
1390
|
var WebsyDropdown = /*#__PURE__*/function () {
|
|
1310
1391
|
function WebsyDropdown(elementId, options) {
|
|
1311
|
-
var
|
|
1392
|
+
var _this9 = this;
|
|
1312
1393
|
|
|
1313
1394
|
_classCallCheck(this, WebsyDropdown);
|
|
1314
1395
|
|
|
@@ -1352,10 +1433,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1352
1433
|
el.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
1353
1434
|
el.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
1354
1435
|
var headerLabel = this.selectedItems.map(function (s) {
|
|
1355
|
-
return
|
|
1436
|
+
return _this9.options.items[s].label || _this9.options.items[s].value;
|
|
1356
1437
|
}).join(this.options.multiValueDelimiter);
|
|
1357
1438
|
var headerValue = this.selectedItems.map(function (s) {
|
|
1358
|
-
return
|
|
1439
|
+
return _this9.options.items[s].value || _this9.options.items[s].label;
|
|
1359
1440
|
}).join(this.options.multiValueDelimiter);
|
|
1360
1441
|
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
1442
|
|
|
@@ -1638,10 +1719,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1638
1719
|
}, {
|
|
1639
1720
|
key: "renderItems",
|
|
1640
1721
|
value: function renderItems() {
|
|
1641
|
-
var
|
|
1722
|
+
var _this10 = this;
|
|
1642
1723
|
|
|
1643
1724
|
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(
|
|
1725
|
+
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
1726
|
}).join('');
|
|
1646
1727
|
var el = document.getElementById("".concat(this.elementId, "_items"));
|
|
1647
1728
|
|
|
@@ -1660,7 +1741,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1660
1741
|
}, {
|
|
1661
1742
|
key: "updateHeader",
|
|
1662
1743
|
value: function updateHeader(item) {
|
|
1663
|
-
var
|
|
1744
|
+
var _this11 = this;
|
|
1664
1745
|
|
|
1665
1746
|
var el = document.getElementById(this.elementId);
|
|
1666
1747
|
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
@@ -1707,17 +1788,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1707
1788
|
} else if (this.selectedItems.length > 1) {
|
|
1708
1789
|
if (this.options.showCompleteSelectedList === true) {
|
|
1709
1790
|
var selectedLabels = this.selectedItems.map(function (s) {
|
|
1710
|
-
return
|
|
1791
|
+
return _this11.options.items[s].label || _this11.options.items[s].value;
|
|
1711
1792
|
}).join(this.options.multiValueDelimiter);
|
|
1712
1793
|
var selectedValues = this.selectedItems.map(function (s) {
|
|
1713
|
-
return
|
|
1794
|
+
return _this11.options.items[s].value || _this11.options.items[s].label;
|
|
1714
1795
|
}).join(this.options.multiValueDelimiter);
|
|
1715
1796
|
labelEl.innerHTML = selectedLabels;
|
|
1716
1797
|
labelEl.setAttribute('data-info', selectedLabels);
|
|
1717
1798
|
inputEl.value = selectedValues;
|
|
1718
1799
|
} else {
|
|
1719
1800
|
var _selectedValues = this.selectedItems.map(function (s) {
|
|
1720
|
-
return
|
|
1801
|
+
return _this11.options.items[s].value || _this11.options.items[s].label;
|
|
1721
1802
|
}).join(this.options.multiValueDelimiter);
|
|
1722
1803
|
|
|
1723
1804
|
labelEl.innerHTML = "".concat(this.selectedItems.length, " selected");
|
|
@@ -1854,16 +1935,16 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1854
1935
|
}, {
|
|
1855
1936
|
key: "checkRecaptcha",
|
|
1856
1937
|
value: function checkRecaptcha() {
|
|
1857
|
-
var
|
|
1938
|
+
var _this12 = this;
|
|
1858
1939
|
|
|
1859
1940
|
return new Promise(function (resolve, reject) {
|
|
1860
|
-
if (
|
|
1941
|
+
if (_this12.options.useRecaptcha === true) {
|
|
1861
1942
|
// if (this.recaptchaValue) {
|
|
1862
1943
|
grecaptcha.ready(function () {
|
|
1863
1944
|
grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
|
|
1864
1945
|
action: 'submit'
|
|
1865
1946
|
}).then(function (token) {
|
|
1866
|
-
|
|
1947
|
+
_this12.apiService.add('google/checkrecaptcha', {
|
|
1867
1948
|
grecaptcharesponse: token
|
|
1868
1949
|
}).then(function (response) {
|
|
1869
1950
|
if (response.success && response.success === true) {
|
|
@@ -1926,14 +2007,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1926
2007
|
}, {
|
|
1927
2008
|
key: "processComponents",
|
|
1928
2009
|
value: function processComponents(components, callbackFn) {
|
|
1929
|
-
var
|
|
2010
|
+
var _this13 = this;
|
|
1930
2011
|
|
|
1931
2012
|
if (components.length === 0) {
|
|
1932
2013
|
callbackFn();
|
|
1933
2014
|
} else {
|
|
1934
2015
|
components.forEach(function (c) {
|
|
1935
2016
|
if (typeof WebsyDesigns[c.component] !== 'undefined') {
|
|
1936
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
2017
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this13.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
1937
2018
|
} else {// some user feedback here
|
|
1938
2019
|
}
|
|
1939
2020
|
});
|
|
@@ -1954,7 +2035,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1954
2035
|
}, {
|
|
1955
2036
|
key: "render",
|
|
1956
2037
|
value: function render(update, data) {
|
|
1957
|
-
var
|
|
2038
|
+
var _this14 = this;
|
|
1958
2039
|
|
|
1959
2040
|
var el = document.getElementById(this.elementId);
|
|
1960
2041
|
var componentsToProcess = [];
|
|
@@ -1964,11 +2045,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1964
2045
|
this.options.fields.forEach(function (f, i) {
|
|
1965
2046
|
if (f.component) {
|
|
1966
2047
|
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(
|
|
2048
|
+
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
2049
|
} 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(
|
|
2050
|
+
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
2051
|
} 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(
|
|
2052
|
+
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
2053
|
}
|
|
1973
2054
|
});
|
|
1974
2055
|
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 +2066,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1985
2066
|
|
|
1986
2067
|
el.innerHTML = html;
|
|
1987
2068
|
this.processComponents(componentsToProcess, function () {
|
|
1988
|
-
if (
|
|
2069
|
+
if (_this14.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
|
|
1989
2070
|
}
|
|
1990
2071
|
});
|
|
1991
2072
|
}
|
|
@@ -1993,7 +2074,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1993
2074
|
}, {
|
|
1994
2075
|
key: "submitForm",
|
|
1995
2076
|
value: function submitForm() {
|
|
1996
|
-
var
|
|
2077
|
+
var _this15 = this;
|
|
1997
2078
|
|
|
1998
2079
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
1999
2080
|
|
|
@@ -2007,32 +2088,32 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2007
2088
|
data[key] = value;
|
|
2008
2089
|
});
|
|
2009
2090
|
|
|
2010
|
-
if (
|
|
2011
|
-
var
|
|
2091
|
+
if (_this15.options.url) {
|
|
2092
|
+
var _this15$apiService;
|
|
2012
2093
|
|
|
2013
|
-
var params = [
|
|
2094
|
+
var params = [_this15.options.url];
|
|
2014
2095
|
|
|
2015
|
-
if (
|
|
2016
|
-
params.push(
|
|
2096
|
+
if (_this15.options.mode === 'update') {
|
|
2097
|
+
params.push(_this15.options.id);
|
|
2017
2098
|
}
|
|
2018
2099
|
|
|
2019
2100
|
params.push(data);
|
|
2020
2101
|
|
|
2021
|
-
(
|
|
2022
|
-
if (
|
|
2102
|
+
(_this15$apiService = _this15.apiService)[_this15.options.mode].apply(_this15$apiService, params).then(function (result) {
|
|
2103
|
+
if (_this15.options.clearAfterSave === true) {
|
|
2023
2104
|
// this.render()
|
|
2024
2105
|
formEl.reset();
|
|
2025
2106
|
}
|
|
2026
2107
|
|
|
2027
|
-
|
|
2108
|
+
_this15.options.onSuccess.call(_this15, result);
|
|
2028
2109
|
}, function (err) {
|
|
2029
2110
|
console.log('Error submitting form data:', err);
|
|
2030
2111
|
|
|
2031
|
-
|
|
2112
|
+
_this15.options.onError.call(_this15, err);
|
|
2032
2113
|
});
|
|
2033
|
-
} else if (
|
|
2034
|
-
|
|
2035
|
-
if (
|
|
2114
|
+
} else if (_this15.options.submitFn) {
|
|
2115
|
+
_this15.options.submitFn(data, function () {
|
|
2116
|
+
if (_this15.options.clearAfterSave === true) {
|
|
2036
2117
|
// this.render()
|
|
2037
2118
|
formEl.reset();
|
|
2038
2119
|
}
|
|
@@ -2052,17 +2133,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2052
2133
|
}, {
|
|
2053
2134
|
key: "data",
|
|
2054
2135
|
set: function set(d) {
|
|
2055
|
-
var
|
|
2136
|
+
var _this16 = this;
|
|
2056
2137
|
|
|
2057
2138
|
if (!this.options.fields) {
|
|
2058
2139
|
this.options.fields = [];
|
|
2059
2140
|
}
|
|
2060
2141
|
|
|
2061
2142
|
var _loop = function _loop(key) {
|
|
2062
|
-
|
|
2143
|
+
_this16.options.fields.forEach(function (f) {
|
|
2063
2144
|
if (f.field === key) {
|
|
2064
2145
|
f.value = d[key];
|
|
2065
|
-
var el = document.getElementById("".concat(
|
|
2146
|
+
var el = document.getElementById("".concat(_this16.elementId, "_input_").concat(f.field));
|
|
2066
2147
|
el.value = f.value;
|
|
2067
2148
|
}
|
|
2068
2149
|
});
|
|
@@ -2441,7 +2522,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2441
2522
|
|
|
2442
2523
|
var Pager = /*#__PURE__*/function () {
|
|
2443
2524
|
function Pager(elementId, options) {
|
|
2444
|
-
var
|
|
2525
|
+
var _this17 = this;
|
|
2445
2526
|
|
|
2446
2527
|
_classCallCheck(this, Pager);
|
|
2447
2528
|
|
|
@@ -2494,8 +2575,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2494
2575
|
allowClear: false,
|
|
2495
2576
|
disableSearch: true,
|
|
2496
2577
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
2497
|
-
if (
|
|
2498
|
-
|
|
2578
|
+
if (_this17.options.onChangePageSize) {
|
|
2579
|
+
_this17.options.onChangePageSize(selectedItem.value);
|
|
2499
2580
|
}
|
|
2500
2581
|
}
|
|
2501
2582
|
});
|
|
@@ -2519,13 +2600,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2519
2600
|
}, {
|
|
2520
2601
|
key: "render",
|
|
2521
2602
|
value: function render() {
|
|
2522
|
-
var
|
|
2603
|
+
var _this18 = this;
|
|
2523
2604
|
|
|
2524
2605
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
2525
2606
|
|
|
2526
2607
|
if (el) {
|
|
2527
2608
|
var pages = this.options.pages.map(function (item, index) {
|
|
2528
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
2609
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this18.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
2529
2610
|
});
|
|
2530
2611
|
var startIndex = 0;
|
|
2531
2612
|
|
|
@@ -2593,58 +2674,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2593
2674
|
_createClass(WebsyPDFButton, [{
|
|
2594
2675
|
key: "handleClick",
|
|
2595
2676
|
value: function handleClick(event) {
|
|
2596
|
-
var
|
|
2677
|
+
var _this19 = this;
|
|
2597
2678
|
|
|
2598
2679
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
2599
2680
|
this.loader.show();
|
|
2600
2681
|
setTimeout(function () {
|
|
2601
|
-
if (
|
|
2602
|
-
var el = document.getElementById(
|
|
2682
|
+
if (_this19.options.targetId) {
|
|
2683
|
+
var el = document.getElementById(_this19.options.targetId);
|
|
2603
2684
|
|
|
2604
2685
|
if (el) {
|
|
2605
2686
|
var pdfData = {
|
|
2606
2687
|
options: {}
|
|
2607
2688
|
};
|
|
2608
2689
|
|
|
2609
|
-
if (
|
|
2610
|
-
pdfData.options = _extends({},
|
|
2690
|
+
if (_this19.options.pdfOptions) {
|
|
2691
|
+
pdfData.options = _extends({}, _this19.options.pdfOptions);
|
|
2611
2692
|
}
|
|
2612
2693
|
|
|
2613
|
-
if (
|
|
2614
|
-
if (
|
|
2615
|
-
var headerEl = document.getElementById(
|
|
2694
|
+
if (_this19.options.header) {
|
|
2695
|
+
if (_this19.options.header.elementId) {
|
|
2696
|
+
var headerEl = document.getElementById(_this19.options.header.elementId);
|
|
2616
2697
|
|
|
2617
2698
|
if (headerEl) {
|
|
2618
2699
|
pdfData.header = headerEl.outerHTML;
|
|
2619
2700
|
|
|
2620
|
-
if (
|
|
2621
|
-
pdfData.options.headerCSS =
|
|
2701
|
+
if (_this19.options.header.css) {
|
|
2702
|
+
pdfData.options.headerCSS = _this19.options.header.css;
|
|
2622
2703
|
}
|
|
2623
2704
|
}
|
|
2624
|
-
} else if (
|
|
2625
|
-
pdfData.header =
|
|
2705
|
+
} else if (_this19.options.header.html) {
|
|
2706
|
+
pdfData.header = _this19.options.header.html;
|
|
2626
2707
|
|
|
2627
|
-
if (
|
|
2628
|
-
pdfData.options.headerCSS =
|
|
2708
|
+
if (_this19.options.header.css) {
|
|
2709
|
+
pdfData.options.headerCSS = _this19.options.header.css;
|
|
2629
2710
|
}
|
|
2630
2711
|
} else {
|
|
2631
|
-
pdfData.header =
|
|
2712
|
+
pdfData.header = _this19.options.header;
|
|
2632
2713
|
}
|
|
2633
2714
|
}
|
|
2634
2715
|
|
|
2635
|
-
if (
|
|
2636
|
-
if (
|
|
2637
|
-
var footerEl = document.getElementById(
|
|
2716
|
+
if (_this19.options.footer) {
|
|
2717
|
+
if (_this19.options.footer.elementId) {
|
|
2718
|
+
var footerEl = document.getElementById(_this19.options.footer.elementId);
|
|
2638
2719
|
|
|
2639
2720
|
if (footerEl) {
|
|
2640
2721
|
pdfData.footer = footerEl.outerHTML;
|
|
2641
2722
|
|
|
2642
|
-
if (
|
|
2643
|
-
pdfData.options.footerCSS =
|
|
2723
|
+
if (_this19.options.footer.css) {
|
|
2724
|
+
pdfData.options.footerCSS = _this19.options.footer.css;
|
|
2644
2725
|
}
|
|
2645
2726
|
}
|
|
2646
2727
|
} else {
|
|
2647
|
-
pdfData.footer =
|
|
2728
|
+
pdfData.footer = _this19.options.footer;
|
|
2648
2729
|
}
|
|
2649
2730
|
}
|
|
2650
2731
|
|
|
@@ -2653,31 +2734,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2653
2734
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
2654
2735
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
2655
2736
|
|
|
2656
|
-
|
|
2737
|
+
_this19.service.add('', pdfData, {
|
|
2657
2738
|
responseType: 'blob'
|
|
2658
2739
|
}).then(function (response) {
|
|
2659
|
-
|
|
2740
|
+
_this19.loader.hide();
|
|
2660
2741
|
|
|
2661
2742
|
var blob = new Blob([response], {
|
|
2662
2743
|
type: 'application/pdf'
|
|
2663
2744
|
});
|
|
2664
2745
|
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
2746
|
|
|
2666
|
-
if (
|
|
2747
|
+
if (_this19.options.directDownload === true) {
|
|
2667
2748
|
var fileName;
|
|
2668
2749
|
|
|
2669
|
-
if (typeof
|
|
2670
|
-
fileName =
|
|
2750
|
+
if (typeof _this19.options.fileName === 'function') {
|
|
2751
|
+
fileName = _this19.options.fileName() || 'Export';
|
|
2671
2752
|
} else {
|
|
2672
|
-
fileName =
|
|
2753
|
+
fileName = _this19.options.fileName || 'Export';
|
|
2673
2754
|
}
|
|
2674
2755
|
|
|
2675
2756
|
msg += "download='".concat(fileName, ".pdf'");
|
|
2676
2757
|
}
|
|
2677
2758
|
|
|
2678
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
2759
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this19.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
2679
2760
|
|
|
2680
|
-
|
|
2761
|
+
_this19.popup.show({
|
|
2681
2762
|
message: msg,
|
|
2682
2763
|
mask: true
|
|
2683
2764
|
});
|
|
@@ -2862,7 +2943,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
2862
2943
|
|
|
2863
2944
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
2864
2945
|
function ResponsiveText(elementId, options) {
|
|
2865
|
-
var
|
|
2946
|
+
var _this20 = this;
|
|
2866
2947
|
|
|
2867
2948
|
_classCallCheck(this, ResponsiveText);
|
|
2868
2949
|
|
|
@@ -2875,7 +2956,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
2875
2956
|
this.elementId = elementId;
|
|
2876
2957
|
this.canvas = document.createElement('canvas');
|
|
2877
2958
|
window.addEventListener('resize', function () {
|
|
2878
|
-
return
|
|
2959
|
+
return _this20.render();
|
|
2879
2960
|
});
|
|
2880
2961
|
var el = document.getElementById(this.elementId);
|
|
2881
2962
|
|
|
@@ -3094,7 +3175,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3094
3175
|
|
|
3095
3176
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3096
3177
|
function WebsyResultList(elementId, options) {
|
|
3097
|
-
var
|
|
3178
|
+
var _this21 = this;
|
|
3098
3179
|
|
|
3099
3180
|
_classCallCheck(this, WebsyResultList);
|
|
3100
3181
|
|
|
@@ -3122,9 +3203,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3122
3203
|
|
|
3123
3204
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3124
3205
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3125
|
-
|
|
3206
|
+
_this21.options.template = templateString;
|
|
3126
3207
|
|
|
3127
|
-
|
|
3208
|
+
_this21.render();
|
|
3128
3209
|
});
|
|
3129
3210
|
} else {
|
|
3130
3211
|
this.render();
|
|
@@ -3143,7 +3224,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3143
3224
|
}, {
|
|
3144
3225
|
key: "buildHTML",
|
|
3145
3226
|
value: function buildHTML(d) {
|
|
3146
|
-
var
|
|
3227
|
+
var _this22 = this;
|
|
3147
3228
|
|
|
3148
3229
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3149
3230
|
var html = "";
|
|
@@ -3151,7 +3232,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3151
3232
|
if (this.options.template) {
|
|
3152
3233
|
if (d.length > 0) {
|
|
3153
3234
|
d.forEach(function (row, ix) {
|
|
3154
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(
|
|
3235
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(_this22.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3155
3236
|
|
|
3156
3237
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3157
3238
|
|
|
@@ -3271,7 +3352,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3271
3352
|
}, {
|
|
3272
3353
|
key: "handleClick",
|
|
3273
3354
|
value: function handleClick(event) {
|
|
3274
|
-
var
|
|
3355
|
+
var _this23 = this;
|
|
3275
3356
|
|
|
3276
3357
|
if (event.target.classList.contains('clickable')) {
|
|
3277
3358
|
var l = event.target.getAttribute('data-event');
|
|
@@ -3289,8 +3370,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3289
3370
|
l = l[0];
|
|
3290
3371
|
params = params.map(function (p) {
|
|
3291
3372
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
3292
|
-
if (
|
|
3293
|
-
p =
|
|
3373
|
+
if (_this23.rows[+id]) {
|
|
3374
|
+
p = _this23.rows[+id][p];
|
|
3294
3375
|
}
|
|
3295
3376
|
} else if (typeof p === 'string') {
|
|
3296
3377
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -3312,13 +3393,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3312
3393
|
}, {
|
|
3313
3394
|
key: "render",
|
|
3314
3395
|
value: function render() {
|
|
3315
|
-
var
|
|
3396
|
+
var _this24 = this;
|
|
3316
3397
|
|
|
3317
3398
|
if (this.options.entity) {
|
|
3318
3399
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3319
|
-
|
|
3400
|
+
_this24.rows = results.rows;
|
|
3320
3401
|
|
|
3321
|
-
|
|
3402
|
+
_this24.resize();
|
|
3322
3403
|
});
|
|
3323
3404
|
} else {
|
|
3324
3405
|
this.resize();
|
|
@@ -3397,14 +3478,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3397
3478
|
_createClass(WebsyRouter, [{
|
|
3398
3479
|
key: "addGroup",
|
|
3399
3480
|
value: function addGroup(group) {
|
|
3400
|
-
var
|
|
3481
|
+
var _this25 = this;
|
|
3401
3482
|
|
|
3402
3483
|
if (!this.groups[group]) {
|
|
3403
3484
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3404
3485
|
|
|
3405
3486
|
if (els) {
|
|
3406
3487
|
this.getClosestParent(els[0], function (parent) {
|
|
3407
|
-
|
|
3488
|
+
_this25.groups[group] = {
|
|
3408
3489
|
activeView: '',
|
|
3409
3490
|
views: [],
|
|
3410
3491
|
parent: parent.getAttribute('data-view')
|
|
@@ -3729,12 +3810,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3729
3810
|
}, {
|
|
3730
3811
|
key: "showComponents",
|
|
3731
3812
|
value: function showComponents(view) {
|
|
3732
|
-
var
|
|
3813
|
+
var _this26 = this;
|
|
3733
3814
|
|
|
3734
3815
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
3735
3816
|
this.options.views[view].components.forEach(function (c) {
|
|
3736
3817
|
if (typeof c.instance === 'undefined') {
|
|
3737
|
-
|
|
3818
|
+
_this26.prepComponent(c.elementId, c.options);
|
|
3738
3819
|
|
|
3739
3820
|
c.instance = new c.Component(c.elementId, c.options);
|
|
3740
3821
|
} else if (c.instance.render) {
|
|
@@ -4162,7 +4243,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4162
4243
|
|
|
4163
4244
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4164
4245
|
function WebsyTemplate(elementId, options) {
|
|
4165
|
-
var
|
|
4246
|
+
var _this27 = this;
|
|
4166
4247
|
|
|
4167
4248
|
_classCallCheck(this, WebsyTemplate);
|
|
4168
4249
|
|
|
@@ -4188,9 +4269,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4188
4269
|
|
|
4189
4270
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4190
4271
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4191
|
-
|
|
4272
|
+
_this27.options.template = templateString;
|
|
4192
4273
|
|
|
4193
|
-
|
|
4274
|
+
_this27.render();
|
|
4194
4275
|
});
|
|
4195
4276
|
} else {
|
|
4196
4277
|
this.render();
|
|
@@ -4200,7 +4281,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4200
4281
|
_createClass(WebsyTemplate, [{
|
|
4201
4282
|
key: "buildHTML",
|
|
4202
4283
|
value: function buildHTML() {
|
|
4203
|
-
var
|
|
4284
|
+
var _this28 = this;
|
|
4204
4285
|
|
|
4205
4286
|
var html = "";
|
|
4206
4287
|
|
|
@@ -4262,14 +4343,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4262
4343
|
}
|
|
4263
4344
|
|
|
4264
4345
|
if (polarity === true) {
|
|
4265
|
-
if (typeof
|
|
4346
|
+
if (typeof _this28.options.data[parts[0]] !== 'undefined' && _this28.options.data[parts[0]] === parts[1]) {
|
|
4266
4347
|
// remove the <if> tags
|
|
4267
4348
|
removeAll = false;
|
|
4268
4349
|
} else if (parts[0] === parts[1]) {
|
|
4269
4350
|
removeAll = false;
|
|
4270
4351
|
}
|
|
4271
4352
|
} else if (polarity === false) {
|
|
4272
|
-
if (typeof
|
|
4353
|
+
if (typeof _this28.options.data[parts[0]] !== 'undefined' && _this28.options.data[parts[0]] !== parts[1]) {
|
|
4273
4354
|
// remove the <if> tags
|
|
4274
4355
|
removeAll = false;
|
|
4275
4356
|
}
|
|
@@ -4515,10 +4596,10 @@ var WebsyUtils = {
|
|
|
4515
4596
|
var s = '';
|
|
4516
4597
|
var d = 1; // let out
|
|
4517
4598
|
|
|
4518
|
-
for (var
|
|
4519
|
-
if (n >= ranges[
|
|
4520
|
-
d = ranges[
|
|
4521
|
-
s = ranges[
|
|
4599
|
+
for (var _i8 = 0; _i8 < ranges.length; _i8++) {
|
|
4600
|
+
if (n >= ranges[_i8].divider) {
|
|
4601
|
+
d = ranges[_i8].divider;
|
|
4602
|
+
s = ranges[_i8].suffix; // out = (n / ranges[i].divider).toFixed(decimals).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$100,')
|
|
4522
4603
|
|
|
4523
4604
|
break;
|
|
4524
4605
|
}
|
|
@@ -4556,7 +4637,7 @@ var WebsyUtils = {
|
|
|
4556
4637
|
|
|
4557
4638
|
var WebsyTable = /*#__PURE__*/function () {
|
|
4558
4639
|
function WebsyTable(elementId, options) {
|
|
4559
|
-
var
|
|
4640
|
+
var _this29 = this;
|
|
4560
4641
|
|
|
4561
4642
|
_classCallCheck(this, WebsyTable);
|
|
4562
4643
|
|
|
@@ -4594,8 +4675,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4594
4675
|
allowClear: false,
|
|
4595
4676
|
disableSearch: true,
|
|
4596
4677
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4597
|
-
if (
|
|
4598
|
-
|
|
4678
|
+
if (_this29.options.onChangePageSize) {
|
|
4679
|
+
_this29.options.onChangePageSize(selectedItem.value);
|
|
4599
4680
|
}
|
|
4600
4681
|
}
|
|
4601
4682
|
});
|
|
@@ -4616,7 +4697,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4616
4697
|
_createClass(WebsyTable, [{
|
|
4617
4698
|
key: "appendRows",
|
|
4618
4699
|
value: function appendRows(data) {
|
|
4619
|
-
var
|
|
4700
|
+
var _this30 = this;
|
|
4620
4701
|
|
|
4621
4702
|
this.hideError();
|
|
4622
4703
|
var bodyHTML = '';
|
|
@@ -4624,15 +4705,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4624
4705
|
if (data) {
|
|
4625
4706
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4626
4707
|
return '<tr>' + r.map(function (c, i) {
|
|
4627
|
-
if (
|
|
4708
|
+
if (_this30.options.columns[i].show !== false) {
|
|
4628
4709
|
var style = '';
|
|
4629
4710
|
|
|
4630
4711
|
if (c.style) {
|
|
4631
4712
|
style += c.style;
|
|
4632
4713
|
}
|
|
4633
4714
|
|
|
4634
|
-
if (
|
|
4635
|
-
style += "width: ".concat(
|
|
4715
|
+
if (_this30.options.columns[i].width) {
|
|
4716
|
+
style += "width: ".concat(_this30.options.columns[i].width, "; ");
|
|
4636
4717
|
}
|
|
4637
4718
|
|
|
4638
4719
|
if (c.backgroundColor) {
|
|
@@ -4647,18 +4728,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4647
4728
|
style += "color: ".concat(c.color, "; ");
|
|
4648
4729
|
}
|
|
4649
4730
|
|
|
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(
|
|
4731
|
+
if (_this30.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
4732
|
+
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 ");
|
|
4733
|
+
} else if ((_this30.options.columns[i].showAsNavigatorLink === true || _this30.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
4734
|
+
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
4735
|
} else {
|
|
4655
4736
|
var info = c.value;
|
|
4656
4737
|
|
|
4657
|
-
if (
|
|
4738
|
+
if (_this30.options.columns[i].showAsImage === true) {
|
|
4658
4739
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4659
4740
|
}
|
|
4660
4741
|
|
|
4661
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
4742
|
+
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
4743
|
}
|
|
4663
4744
|
}
|
|
4664
4745
|
}).join('') + '</tr>';
|
|
@@ -4830,7 +4911,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4830
4911
|
}, {
|
|
4831
4912
|
key: "render",
|
|
4832
4913
|
value: function render(data) {
|
|
4833
|
-
var
|
|
4914
|
+
var _this31 = this;
|
|
4834
4915
|
|
|
4835
4916
|
if (!this.options.columns) {
|
|
4836
4917
|
return;
|
|
@@ -4855,7 +4936,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4855
4936
|
|
|
4856
4937
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
4857
4938
|
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 ?
|
|
4939
|
+
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
4940
|
}
|
|
4860
4941
|
}).join('') + '</tr>';
|
|
4861
4942
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -4874,7 +4955,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4874
4955
|
|
|
4875
4956
|
if (pagingEl) {
|
|
4876
4957
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
4877
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
4958
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this31.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
4878
4959
|
});
|
|
4879
4960
|
var startIndex = 0;
|
|
4880
4961
|
|
|
@@ -4942,7 +5023,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4942
5023
|
|
|
4943
5024
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
4944
5025
|
function WebsyTable2(elementId, options) {
|
|
4945
|
-
var
|
|
5026
|
+
var _this32 = this;
|
|
4946
5027
|
|
|
4947
5028
|
_classCallCheck(this, WebsyTable2);
|
|
4948
5029
|
|
|
@@ -4983,8 +5064,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4983
5064
|
allowClear: false,
|
|
4984
5065
|
disableSearch: true,
|
|
4985
5066
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4986
|
-
if (
|
|
4987
|
-
|
|
5067
|
+
if (_this32.options.onChangePageSize) {
|
|
5068
|
+
_this32.options.onChangePageSize(selectedItem.value);
|
|
4988
5069
|
}
|
|
4989
5070
|
}
|
|
4990
5071
|
});
|
|
@@ -5008,7 +5089,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5008
5089
|
_createClass(WebsyTable2, [{
|
|
5009
5090
|
key: "appendRows",
|
|
5010
5091
|
value: function appendRows(data) {
|
|
5011
|
-
var
|
|
5092
|
+
var _this33 = this;
|
|
5012
5093
|
|
|
5013
5094
|
this.hideError();
|
|
5014
5095
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -5017,15 +5098,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5017
5098
|
if (data) {
|
|
5018
5099
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5019
5100
|
return '<tr>' + r.map(function (c, i) {
|
|
5020
|
-
if (
|
|
5021
|
-
var style = "height: ".concat(
|
|
5101
|
+
if (_this33.options.columns[i].show !== false) {
|
|
5102
|
+
var style = "height: ".concat(_this33.options.cellSize, "px; line-height: ").concat(_this33.options.cellSize, "px;");
|
|
5022
5103
|
|
|
5023
5104
|
if (c.style) {
|
|
5024
5105
|
style += c.style;
|
|
5025
5106
|
}
|
|
5026
5107
|
|
|
5027
|
-
if (
|
|
5028
|
-
style += "width: ".concat(
|
|
5108
|
+
if (_this33.options.columns[i].width) {
|
|
5109
|
+
style += "width: ".concat(_this33.options.columns[i].width, "; ");
|
|
5029
5110
|
}
|
|
5030
5111
|
|
|
5031
5112
|
if (c.backgroundColor) {
|
|
@@ -5040,18 +5121,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5040
5121
|
style += "color: ".concat(c.color, "; ");
|
|
5041
5122
|
}
|
|
5042
5123
|
|
|
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(
|
|
5124
|
+
if (_this33.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5125
|
+
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 ");
|
|
5126
|
+
} else if ((_this33.options.columns[i].showAsNavigatorLink === true || _this33.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5127
|
+
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
5128
|
} else {
|
|
5048
5129
|
var info = c.value;
|
|
5049
5130
|
|
|
5050
|
-
if (
|
|
5131
|
+
if (_this33.options.columns[i].showAsImage === true) {
|
|
5051
5132
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5052
5133
|
}
|
|
5053
5134
|
|
|
5054
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5135
|
+
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
5136
|
}
|
|
5056
5137
|
}
|
|
5057
5138
|
}).join('') + '</tr>';
|
|
@@ -5309,7 +5390,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5309
5390
|
}, {
|
|
5310
5391
|
key: "render",
|
|
5311
5392
|
value: function render(data) {
|
|
5312
|
-
var
|
|
5393
|
+
var _this34 = this;
|
|
5313
5394
|
|
|
5314
5395
|
if (!this.options.columns) {
|
|
5315
5396
|
return;
|
|
@@ -5345,7 +5426,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5345
5426
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5346
5427
|
}
|
|
5347
5428
|
|
|
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 ?
|
|
5429
|
+
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
5430
|
}
|
|
5350
5431
|
}).join('') + '</tr>';
|
|
5351
5432
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5356,7 +5437,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5356
5437
|
var dropdownHTML = "";
|
|
5357
5438
|
this.options.columns.forEach(function (c, i) {
|
|
5358
5439
|
if (c.searchable && c.searchField) {
|
|
5359
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5440
|
+
dropdownHTML += "\n <div id=\"".concat(_this34.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
5360
5441
|
}
|
|
5361
5442
|
});
|
|
5362
5443
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5378,7 +5459,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5378
5459
|
|
|
5379
5460
|
if (pagingEl) {
|
|
5380
5461
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5381
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5462
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this34.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5382
5463
|
});
|
|
5383
5464
|
var startIndex = 0;
|
|
5384
5465
|
|
|
@@ -5465,7 +5546,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5465
5546
|
}, {
|
|
5466
5547
|
key: "getColumnParameters",
|
|
5467
5548
|
value: function getColumnParameters(values) {
|
|
5468
|
-
var
|
|
5549
|
+
var _this35 = this;
|
|
5469
5550
|
|
|
5470
5551
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
5471
5552
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -5473,10 +5554,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5473
5554
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
5474
5555
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5475
5556
|
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 ?
|
|
5557
|
+
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
5558
|
}).join('') + '</tr>';
|
|
5478
5559
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
5479
|
-
return "\n <td \n style='height: ".concat(
|
|
5560
|
+
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
5561
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
5481
5562
|
|
|
5482
5563
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -5497,8 +5578,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5497
5578
|
|
|
5498
5579
|
|
|
5499
5580
|
if (accWidth < (tableContainerEl.offsetWidth || tableContainerEl.clientWidth) - nonScrollableWidth) {
|
|
5500
|
-
for (var
|
|
5501
|
-
cellWidths[
|
|
5581
|
+
for (var _i9 = this.options.leftColumns; _i9 < cellWidths.length; _i9++) {
|
|
5582
|
+
cellWidths[_i9] = ((tableContainerEl.offsetWidth || tableContainerEl.clientWidth) - nonScrollableWidth) / (cellWidths.length - this.options.leftColumns);
|
|
5502
5583
|
}
|
|
5503
5584
|
} // const cellWidth = firstDataCell.offsetWidth || firstDataCell.clientWidth
|
|
5504
5585
|
// tableEl.style.width = ''
|
|
@@ -5526,7 +5607,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5526
5607
|
|
|
5527
5608
|
var WebsyChart = /*#__PURE__*/function () {
|
|
5528
5609
|
function WebsyChart(elementId, options) {
|
|
5529
|
-
var
|
|
5610
|
+
var _this36 = this;
|
|
5530
5611
|
|
|
5531
5612
|
_classCallCheck(this, WebsyChart);
|
|
5532
5613
|
|
|
@@ -5575,22 +5656,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5575
5656
|
this.invertOverride = function (input, input2) {
|
|
5576
5657
|
var xAxis = 'bottomAxis';
|
|
5577
5658
|
|
|
5578
|
-
if (
|
|
5659
|
+
if (_this36.options.orientation === 'horizontal') {
|
|
5579
5660
|
xAxis = 'leftAxis';
|
|
5580
5661
|
}
|
|
5581
5662
|
|
|
5582
|
-
var width =
|
|
5663
|
+
var width = _this36[xAxis].step();
|
|
5583
5664
|
|
|
5584
5665
|
var output;
|
|
5585
5666
|
|
|
5586
|
-
var domain = _toConsumableArray(
|
|
5667
|
+
var domain = _toConsumableArray(_this36[xAxis].domain());
|
|
5587
5668
|
|
|
5588
|
-
if (
|
|
5669
|
+
if (_this36.options.orientation === 'horizontal') {
|
|
5589
5670
|
domain = domain.reverse();
|
|
5590
5671
|
}
|
|
5591
5672
|
|
|
5592
5673
|
for (var j = 0; j < domain.length; j++) {
|
|
5593
|
-
var breakA =
|
|
5674
|
+
var breakA = _this36[xAxis](domain[j]) - width / 2;
|
|
5594
5675
|
var breakB = breakA + width;
|
|
5595
5676
|
|
|
5596
5677
|
if (input > breakA && input <= breakB) {
|
|
@@ -5690,10 +5771,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5690
5771
|
}, {
|
|
5691
5772
|
key: "handleEventMouseMove",
|
|
5692
5773
|
value: function handleEventMouseMove(event, d) {
|
|
5693
|
-
var
|
|
5774
|
+
var _this37 = this;
|
|
5694
5775
|
|
|
5695
5776
|
var bisectDate = d3.bisector(function (d) {
|
|
5696
|
-
return
|
|
5777
|
+
return _this37.parseX(d.x.value);
|
|
5697
5778
|
}).left;
|
|
5698
5779
|
|
|
5699
5780
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -5732,8 +5813,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5732
5813
|
}
|
|
5733
5814
|
|
|
5734
5815
|
this.options.data.series.forEach(function (s) {
|
|
5735
|
-
if (
|
|
5736
|
-
xPoint =
|
|
5816
|
+
if (_this37.options.data[xData].scale !== 'Time') {
|
|
5817
|
+
xPoint = _this37[xAxis](_this37.parseX(xLabel));
|
|
5737
5818
|
s.data.forEach(function (d) {
|
|
5738
5819
|
if (d.x.value === xLabel) {
|
|
5739
5820
|
if (!tooltipTitle) {
|
|
@@ -5752,13 +5833,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5752
5833
|
var pointA = s.data[index - 1];
|
|
5753
5834
|
var pointB = s.data[index];
|
|
5754
5835
|
|
|
5755
|
-
if (
|
|
5836
|
+
if (_this37.options.orientation === 'horizontal') {
|
|
5756
5837
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
5757
5838
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
5758
5839
|
}
|
|
5759
5840
|
|
|
5760
5841
|
if (pointA && !pointB) {
|
|
5761
|
-
xPoint =
|
|
5842
|
+
xPoint = _this37[xAxis](_this37.parseX(pointA.x.value));
|
|
5762
5843
|
tooltipTitle = pointA.x.value;
|
|
5763
5844
|
|
|
5764
5845
|
if (!pointA.y.color) {
|
|
@@ -5768,12 +5849,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5768
5849
|
tooltipData.push(pointA.y);
|
|
5769
5850
|
|
|
5770
5851
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
5771
|
-
tooltipTitle = d3.timeFormat(
|
|
5852
|
+
tooltipTitle = d3.timeFormat(_this37.options.dateFormat || _this37.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
5772
5853
|
}
|
|
5773
5854
|
}
|
|
5774
5855
|
|
|
5775
5856
|
if (pointB && !pointA) {
|
|
5776
|
-
xPoint =
|
|
5857
|
+
xPoint = _this37[xAxis](_this37.parseX(pointB.x.value));
|
|
5777
5858
|
tooltipTitle = pointB.x.value;
|
|
5778
5859
|
|
|
5779
5860
|
if (!pointB.y.color) {
|
|
@@ -5783,14 +5864,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5783
5864
|
tooltipData.push(pointB.y);
|
|
5784
5865
|
|
|
5785
5866
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5786
|
-
tooltipTitle = d3.timeFormat(
|
|
5867
|
+
tooltipTitle = d3.timeFormat(_this37.options.dateFormat || _this37.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5787
5868
|
}
|
|
5788
5869
|
}
|
|
5789
5870
|
|
|
5790
5871
|
if (pointA && pointB) {
|
|
5791
|
-
var d0 =
|
|
5872
|
+
var d0 = _this37[xAxis](_this37.parseX(pointA.x.value));
|
|
5792
5873
|
|
|
5793
|
-
var d1 =
|
|
5874
|
+
var d1 = _this37[xAxis](_this37.parseX(pointB.x.value));
|
|
5794
5875
|
|
|
5795
5876
|
var mid = Math.abs(d0 - d1) / 2;
|
|
5796
5877
|
|
|
@@ -5799,7 +5880,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5799
5880
|
tooltipTitle = pointB.x.value;
|
|
5800
5881
|
|
|
5801
5882
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5802
|
-
tooltipTitle = d3.timeFormat(
|
|
5883
|
+
tooltipTitle = d3.timeFormat(_this37.options.dateFormat || _this37.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5803
5884
|
}
|
|
5804
5885
|
|
|
5805
5886
|
if (!pointB.y.color) {
|
|
@@ -5812,7 +5893,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5812
5893
|
tooltipTitle = pointA.x.value;
|
|
5813
5894
|
|
|
5814
5895
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5815
|
-
tooltipTitle = d3.timeFormat(
|
|
5896
|
+
tooltipTitle = d3.timeFormat(_this37.options.dateFormat || _this37.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5816
5897
|
}
|
|
5817
5898
|
|
|
5818
5899
|
if (!pointA.y.color) {
|
|
@@ -5917,7 +5998,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5917
5998
|
}, {
|
|
5918
5999
|
key: "render",
|
|
5919
6000
|
value: function render(options) {
|
|
5920
|
-
var
|
|
6001
|
+
var _this38 = this;
|
|
5921
6002
|
|
|
5922
6003
|
/* global d3 options WebsyUtils */
|
|
5923
6004
|
if (typeof options !== 'undefined') {
|
|
@@ -5986,7 +6067,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5986
6067
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
5987
6068
|
return {
|
|
5988
6069
|
value: s.label || s.key,
|
|
5989
|
-
color: s.color ||
|
|
6070
|
+
color: s.color || _this38.options.colors[i % _this38.options.colors.length]
|
|
5990
6071
|
};
|
|
5991
6072
|
});
|
|
5992
6073
|
|
|
@@ -6238,7 +6319,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6238
6319
|
|
|
6239
6320
|
if (this.options.data.bottom.formatter) {
|
|
6240
6321
|
bAxisFunc.tickFormat(function (d) {
|
|
6241
|
-
return
|
|
6322
|
+
return _this38.options.data.bottom.formatter(d);
|
|
6242
6323
|
});
|
|
6243
6324
|
}
|
|
6244
6325
|
|
|
@@ -6264,8 +6345,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6264
6345
|
|
|
6265
6346
|
if (this.options.margin.axisLeft > 0) {
|
|
6266
6347
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
6267
|
-
if (
|
|
6268
|
-
d =
|
|
6348
|
+
if (_this38.options.data.left.formatter) {
|
|
6349
|
+
d = _this38.options.data.left.formatter(d);
|
|
6269
6350
|
}
|
|
6270
6351
|
|
|
6271
6352
|
return d;
|
|
@@ -6302,8 +6383,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6302
6383
|
|
|
6303
6384
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
6304
6385
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
6305
|
-
if (
|
|
6306
|
-
d =
|
|
6386
|
+
if (_this38.options.data.right.formatter) {
|
|
6387
|
+
d = _this38.options.data.right.formatter(d);
|
|
6307
6388
|
}
|
|
6308
6389
|
|
|
6309
6390
|
return d;
|
|
@@ -6329,16 +6410,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6329
6410
|
|
|
6330
6411
|
this.options.data.series.forEach(function (series, index) {
|
|
6331
6412
|
if (!series.key) {
|
|
6332
|
-
series.key =
|
|
6413
|
+
series.key = _this38.createIdentity();
|
|
6333
6414
|
}
|
|
6334
6415
|
|
|
6335
6416
|
if (!series.color) {
|
|
6336
|
-
series.color =
|
|
6417
|
+
series.color = _this38.options.colors[index % _this38.options.colors.length];
|
|
6337
6418
|
}
|
|
6338
6419
|
|
|
6339
|
-
|
|
6420
|
+
_this38["render".concat(series.type || 'bar')](series, index);
|
|
6340
6421
|
|
|
6341
|
-
|
|
6422
|
+
_this38.renderLabels(series, index);
|
|
6342
6423
|
});
|
|
6343
6424
|
}
|
|
6344
6425
|
}
|
|
@@ -6346,17 +6427,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6346
6427
|
}, {
|
|
6347
6428
|
key: "renderarea",
|
|
6348
6429
|
value: function renderarea(series, index) {
|
|
6349
|
-
var
|
|
6430
|
+
var _this39 = this;
|
|
6350
6431
|
|
|
6351
6432
|
/* global d3 series index */
|
|
6352
6433
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
6353
6434
|
return d3.area().x(function (d) {
|
|
6354
|
-
return
|
|
6435
|
+
return _this39[xAxis](_this39.parseX(d.x.value));
|
|
6355
6436
|
}).y0(function (d) {
|
|
6356
|
-
return
|
|
6437
|
+
return _this39[yAxis](0);
|
|
6357
6438
|
}).y1(function (d) {
|
|
6358
|
-
return
|
|
6359
|
-
}).curve(d3[curveStyle ||
|
|
6439
|
+
return _this39[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6440
|
+
}).curve(d3[curveStyle || _this39.options.curveStyle]);
|
|
6360
6441
|
};
|
|
6361
6442
|
|
|
6362
6443
|
var xAxis = 'bottomAxis';
|
|
@@ -6531,15 +6612,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6531
6612
|
}, {
|
|
6532
6613
|
key: "renderline",
|
|
6533
6614
|
value: function renderline(series, index) {
|
|
6534
|
-
var
|
|
6615
|
+
var _this40 = this;
|
|
6535
6616
|
|
|
6536
6617
|
/* global series index d3 */
|
|
6537
6618
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
6538
6619
|
return d3.line().x(function (d) {
|
|
6539
|
-
return
|
|
6620
|
+
return _this40[xAxis](_this40.parseX(d.x.value));
|
|
6540
6621
|
}).y(function (d) {
|
|
6541
|
-
return
|
|
6542
|
-
}).curve(d3[curveStyle ||
|
|
6622
|
+
return _this40[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6623
|
+
}).curve(d3[curveStyle || _this40.options.curveStyle]);
|
|
6543
6624
|
};
|
|
6544
6625
|
|
|
6545
6626
|
var xAxis = 'bottomAxis';
|
|
@@ -6577,14 +6658,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6577
6658
|
}, {
|
|
6578
6659
|
key: "rendersymbol",
|
|
6579
6660
|
value: function rendersymbol(series, index) {
|
|
6580
|
-
var
|
|
6661
|
+
var _this41 = this;
|
|
6581
6662
|
|
|
6582
6663
|
/* global d3 series index series.key */
|
|
6583
6664
|
var drawSymbol = function drawSymbol(size) {
|
|
6584
6665
|
return d3.symbol() // .type(d => {
|
|
6585
6666
|
// return d3.symbols[0]
|
|
6586
6667
|
// })
|
|
6587
|
-
.size(size ||
|
|
6668
|
+
.size(size || _this41.options.symbolSize);
|
|
6588
6669
|
};
|
|
6589
6670
|
|
|
6590
6671
|
var xAxis = 'bottomAxis';
|
|
@@ -6602,7 +6683,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6602
6683
|
symbols.attr('d', function (d) {
|
|
6603
6684
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
6604
6685
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
6605
|
-
return "translate(".concat(
|
|
6686
|
+
return "translate(".concat(_this41[xAxis](_this41.parseX(d.x.value)), ", ").concat(_this41[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
6606
6687
|
}); // Enter
|
|
6607
6688
|
|
|
6608
6689
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -6611,7 +6692,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6611
6692
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
6612
6693
|
return "symbol symbol_".concat(series.key);
|
|
6613
6694
|
}).attr('transform', function (d) {
|
|
6614
|
-
return "translate(".concat(
|
|
6695
|
+
return "translate(".concat(_this41[xAxis](_this41.parseX(d.x.value)), ", ").concat(_this41[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
6615
6696
|
});
|
|
6616
6697
|
}
|
|
6617
6698
|
}, {
|
|
@@ -6766,7 +6847,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6766
6847
|
}, {
|
|
6767
6848
|
key: "resize",
|
|
6768
6849
|
value: function resize() {
|
|
6769
|
-
var
|
|
6850
|
+
var _this42 = this;
|
|
6770
6851
|
|
|
6771
6852
|
var el = document.getElementById(this.elementId);
|
|
6772
6853
|
|
|
@@ -6779,7 +6860,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6779
6860
|
// }
|
|
6780
6861
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
6781
6862
|
html += this._data.map(function (d, i) {
|
|
6782
|
-
return
|
|
6863
|
+
return _this42.getLegendItemHTML(d);
|
|
6783
6864
|
}).join('');
|
|
6784
6865
|
html += "\n <div>\n ";
|
|
6785
6866
|
el.innerHTML = html;
|
|
@@ -6951,7 +7032,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6951
7032
|
}, {
|
|
6952
7033
|
key: "render",
|
|
6953
7034
|
value: function render() {
|
|
6954
|
-
var
|
|
7035
|
+
var _this43 = this;
|
|
6955
7036
|
|
|
6956
7037
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
6957
7038
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -6960,7 +7041,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6960
7041
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
6961
7042
|
return {
|
|
6962
7043
|
value: s.label || s.key,
|
|
6963
|
-
color: s.color ||
|
|
7044
|
+
color: s.color || _this43.options.colors[i % _this43.options.colors.length]
|
|
6964
7045
|
};
|
|
6965
7046
|
});
|
|
6966
7047
|
var longestValue = legendData.map(function (s) {
|
|
@@ -7024,7 +7105,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7024
7105
|
|
|
7025
7106
|
if (this.polygons) {
|
|
7026
7107
|
this.polygons.forEach(function (p) {
|
|
7027
|
-
return
|
|
7108
|
+
return _this43.map.removeLayer(p);
|
|
7028
7109
|
});
|
|
7029
7110
|
}
|
|
7030
7111
|
|
|
@@ -7082,18 +7163,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
7082
7163
|
}
|
|
7083
7164
|
|
|
7084
7165
|
if (!p.options.color) {
|
|
7085
|
-
p.options.color =
|
|
7166
|
+
p.options.color = _this43.options.colors[i % _this43.options.colors.length];
|
|
7086
7167
|
}
|
|
7087
7168
|
|
|
7088
7169
|
var pol = L.polygon(p.data.map(function (c) {
|
|
7089
7170
|
return c.map(function (d) {
|
|
7090
7171
|
return [d.Latitude, d.Longitude];
|
|
7091
7172
|
});
|
|
7092
|
-
}), p.options).addTo(
|
|
7173
|
+
}), p.options).addTo(_this43.map);
|
|
7093
7174
|
|
|
7094
|
-
|
|
7175
|
+
_this43.polygons.push(pol);
|
|
7095
7176
|
|
|
7096
|
-
|
|
7177
|
+
_this43.map.fitBounds(pol.getBounds());
|
|
7097
7178
|
});
|
|
7098
7179
|
} // if (this.data.markers.length > 0) {
|
|
7099
7180
|
// el.classList.remove('hidden')
|