@websy/websy-designs 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/websy-designs-server.js +4 -4
- package/dist/websy-designs-es6.debug.js +498 -26
- package/dist/websy-designs-es6.js +528 -169
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +453 -25
- package/dist/websy-designs.js +513 -141
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +2 -1
package/dist/websy-designs.js
CHANGED
|
@@ -50,6 +50,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
50
50
|
WebsyCarousel
|
|
51
51
|
WebsyLogin
|
|
52
52
|
WebsySignup
|
|
53
|
+
ResponsiveText
|
|
53
54
|
Pager
|
|
54
55
|
*/
|
|
55
56
|
|
|
@@ -499,6 +500,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
499
500
|
minAllowedYear: 1970,
|
|
500
501
|
maxAllowedYear: new Date().getFullYear(),
|
|
501
502
|
daysOfWeek: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
|
|
503
|
+
monthsOfYear: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
504
|
+
hours: new Array(24).fill(0).map(function (d, i) {
|
|
505
|
+
return (i < 10 ? '0' : '') + i + ':00';
|
|
506
|
+
}),
|
|
502
507
|
mode: 'date',
|
|
503
508
|
monthMap: {
|
|
504
509
|
0: 'Jan',
|
|
@@ -551,7 +556,21 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
551
556
|
}, {
|
|
552
557
|
label: 'Last 10 Years',
|
|
553
558
|
range: [new Date().getFullYear() - 9, DEFAULTS.maxAllowedYear]
|
|
554
|
-
}]
|
|
559
|
+
}],
|
|
560
|
+
monthyear: [{
|
|
561
|
+
label: 'All',
|
|
562
|
+
range: [DEFAULTS.minAllowedDate, DEFAULTS.maxAllowedDate]
|
|
563
|
+
}, {
|
|
564
|
+
label: 'Last 12 Months',
|
|
565
|
+
range: [this.floorDate(new Date(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() - 12))), this.floorDate(new Date(new Date().setDate(1)))]
|
|
566
|
+
}, {
|
|
567
|
+
label: 'Last 18 Months',
|
|
568
|
+
range: [this.floorDate(new Date(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() - 18))), this.floorDate(new Date(new Date().setDate(1)))]
|
|
569
|
+
}, {
|
|
570
|
+
label: 'Last 24 Months',
|
|
571
|
+
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
|
+
}],
|
|
573
|
+
hour: []
|
|
555
574
|
};
|
|
556
575
|
this.options = _extends({}, DEFAULTS, options);
|
|
557
576
|
this.selectedRange = this.options.defaultRange || 0;
|
|
@@ -575,7 +594,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
575
594
|
el.addEventListener('mouseup', this.handleMouseUp.bind(this));
|
|
576
595
|
document.addEventListener('keydown', this.handleKeyDown.bind(this));
|
|
577
596
|
document.addEventListener('keyup', this.handleKeyUp.bind(this));
|
|
578
|
-
var html = "\n <div class='websy-date-picker-container'>\n <span class='websy-dropdown-header-label'>".concat(this.options.label || 'Date', "</span>\n <div id=\"").concat(this.elementId, "_header\" class='websy-date-picker-header ").concat(this.options.allowClear === true ? 'allow-clear' : '', "'>\n <span id='").concat(this.elementId, "_selectedRange'>").concat(this.options.ranges[this.options.mode][this.selectedRange].label, "</span>\n <svg 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 ");
|
|
597
|
+
var html = "\n <div class='websy-date-picker-container ".concat(this.options.mode, "'>\n <span class='websy-dropdown-header-label'>").concat(this.options.label || 'Date', "</span>\n <div id=\"").concat(this.elementId, "_header\" class='websy-date-picker-header ").concat(this.options.allowClear === true ? 'allow-clear' : '', "'>\n <span id='").concat(this.elementId, "_selectedRange'>").concat(this.options.ranges[this.options.mode][this.selectedRange].label, "</span>\n <svg 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 ");
|
|
579
598
|
|
|
580
599
|
if (this.options.allowClear === true) {
|
|
581
600
|
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 ";
|
|
@@ -605,6 +624,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
605
624
|
|
|
606
625
|
if (confirm === true) {
|
|
607
626
|
if (this.options.onChange) {
|
|
627
|
+
console.log('confirm', this.selectedRangeDates);
|
|
628
|
+
console.log('confirm', this.currentselection);
|
|
629
|
+
|
|
608
630
|
if (this.customRangeSelected === true) {
|
|
609
631
|
this.options.onChange(this.selectedRangeDates, true);
|
|
610
632
|
} else {
|
|
@@ -678,7 +700,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
678
700
|
value: function handleMouseDown(event) {
|
|
679
701
|
if (this.shiftPressed === true && this.currentselection.length > 0) {
|
|
680
702
|
this.mouseDownId = this.currentselection[this.currentselection.length - 1];
|
|
681
|
-
this.selectDate(+event.target.id.split('_')[
|
|
703
|
+
this.selectDate(+event.target.id.split('_')[1]);
|
|
682
704
|
} else {
|
|
683
705
|
this.mouseDown = true;
|
|
684
706
|
this.dragging = false;
|
|
@@ -693,7 +715,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
693
715
|
this.customRangeSelected = false;
|
|
694
716
|
}
|
|
695
717
|
|
|
696
|
-
this.mouseDownId = +event.target.id.split('_')[
|
|
718
|
+
this.mouseDownId = +event.target.id.split('_')[1];
|
|
697
719
|
this.selectDate(this.mouseDownId);
|
|
698
720
|
}
|
|
699
721
|
}
|
|
@@ -707,9 +729,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
707
729
|
return;
|
|
708
730
|
}
|
|
709
731
|
|
|
710
|
-
if (event.target.id.split('_')[
|
|
732
|
+
if (event.target.id.split('_')[1] !== this.mouseDownId) {
|
|
711
733
|
this.dragging = true;
|
|
712
|
-
this.selectDate(+event.target.id.split('_')[
|
|
734
|
+
this.selectDate(+event.target.id.split('_')[1]);
|
|
713
735
|
}
|
|
714
736
|
}
|
|
715
737
|
}
|
|
@@ -741,6 +763,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
741
763
|
|
|
742
764
|
if (this.customRangeSelected === true) {
|
|
743
765
|
console.log('if date selection', this.currentselection);
|
|
766
|
+
console.log('if month selection', this.currentselection.map(function (d) {
|
|
767
|
+
return new Date(d);
|
|
768
|
+
}));
|
|
744
769
|
var diff;
|
|
745
770
|
|
|
746
771
|
if (this.options.mode === 'date') {
|
|
@@ -752,6 +777,12 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
752
777
|
|
|
753
778
|
if (this.selectedRangeDates[this.selectedRangeDates.length - 1] !== this.selectedRangeDates[0]) {// diff += 1
|
|
754
779
|
}
|
|
780
|
+
} else if (this.options.mode === 'monthyear') {
|
|
781
|
+
var yearDiff = (this.selectedRangeDates[this.selectedRangeDates.length - 1].getFullYear() - this.selectedRangeDates[0].getFullYear()) * 12;
|
|
782
|
+
diff = Math.floor(this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth() - this.selectedRangeDates[0].getMonth()) + yearDiff;
|
|
783
|
+
console.log('year diff', yearDiff);
|
|
784
|
+
console.log('diff', diff);
|
|
785
|
+
} else if (this.options.mode === 'hour') {//
|
|
755
786
|
}
|
|
756
787
|
|
|
757
788
|
for (var _i = 0; _i < diff + 1; _i++) {
|
|
@@ -768,14 +799,25 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
768
799
|
d = this.selectedRangeDates[0] + _i;
|
|
769
800
|
rangeStart = this.selectedRangeDates[0];
|
|
770
801
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
802
|
+
} else if (this.options.mode === 'monthyear') {
|
|
803
|
+
d = new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + _i);
|
|
804
|
+
rangeStart = this.selectedRangeDates[0].getTime();
|
|
805
|
+
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
806
|
+
} else if (this.options.mode === 'hour') {//
|
|
771
807
|
}
|
|
772
808
|
|
|
773
809
|
var dateEl = void 0;
|
|
774
810
|
|
|
775
811
|
if (this.options.mode === 'date') {
|
|
776
|
-
dateEl = document.getElementById("".concat(d, "_date"));
|
|
812
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_date"));
|
|
777
813
|
} else if (this.options.mode === 'year') {
|
|
778
|
-
dateEl = document.getElementById("".concat(d, "_year"));
|
|
814
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_year"));
|
|
815
|
+
} else if (this.options.mode === 'monthyear') {
|
|
816
|
+
console.log('d', d);
|
|
817
|
+
console.log(this.selectedRangeDates);
|
|
818
|
+
console.log(rangeStart, rangeEnd);
|
|
819
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_monthyear"));
|
|
820
|
+
} else if (this.options.mode === 'hour') {//
|
|
779
821
|
}
|
|
780
822
|
|
|
781
823
|
if (dateEl) {
|
|
@@ -795,9 +837,12 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
795
837
|
var dateEl;
|
|
796
838
|
|
|
797
839
|
if (_this4.options.mode === 'date') {
|
|
798
|
-
dateEl = document.getElementById("".concat(d, "_date"));
|
|
840
|
+
dateEl = document.getElementById("".concat(_this4.elementId, "_").concat(d, "_date"));
|
|
799
841
|
} else if (_this4.options.mode === 'year') {
|
|
800
|
-
dateEl = document.getElementById("".concat(d, "_year"));
|
|
842
|
+
dateEl = document.getElementById("".concat(_this4.elementId, "_").concat(d, "_year"));
|
|
843
|
+
} else if (_this4.options.mode === 'monthyear') {
|
|
844
|
+
dateEl = document.getElementById("".concat(_this4.elementId, "_").concat(d, "_monthyear"));
|
|
845
|
+
} else if (_this4.options.mode === 'hour') {//
|
|
801
846
|
}
|
|
802
847
|
|
|
803
848
|
dateEl.classList.add('selected');
|
|
@@ -856,6 +901,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
856
901
|
var disabled = [];
|
|
857
902
|
this.validDates = [];
|
|
858
903
|
this.validYears = [];
|
|
904
|
+
this.monthYears = {};
|
|
905
|
+
this.monthYearMonths = [];
|
|
859
906
|
|
|
860
907
|
if (disabledDates) {
|
|
861
908
|
disabled = disabledDates.map(function (d) {
|
|
@@ -863,6 +910,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
863
910
|
return d.getTime();
|
|
864
911
|
} else if (_this5.options.mode === 'year') {
|
|
865
912
|
return d;
|
|
913
|
+
} else if (_this5.options.mode === 'monthyear') {//
|
|
914
|
+
} else if (_this5.options.mode === 'hour') {//
|
|
866
915
|
}
|
|
867
916
|
|
|
868
917
|
return d.getTime();
|
|
@@ -879,13 +928,16 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
879
928
|
diff = Math.ceil((this.options.maxAllowedDate.getTime() - this.options.minAllowedDate.getTime()) / this.oneDay) + 1;
|
|
880
929
|
} else if (this.options.mode === 'year') {
|
|
881
930
|
diff = this.options.maxAllowedYear - this.options.minAllowedYear + 1;
|
|
931
|
+
} else if (this.options.mode === 'monthyear') {
|
|
932
|
+
diff = Math.ceil((this.options.maxAllowedDate.getTime() - this.options.minAllowedDate.getTime()) / this.oneDay) + 1;
|
|
933
|
+
} else if (this.options.mode === 'hour') {//
|
|
882
934
|
}
|
|
883
935
|
|
|
884
936
|
var months = {};
|
|
885
937
|
var yearList = [];
|
|
886
938
|
|
|
887
939
|
for (var i = 0; i < diff; i++) {
|
|
888
|
-
if (this.options.mode === 'date') {
|
|
940
|
+
if (this.options.mode === 'date' || this.options.mode === 'monthyear') {
|
|
889
941
|
var d = this.floorDate(new Date(this.options.minAllowedDate.getTime() + i * this.oneDay));
|
|
890
942
|
var monthYear = "".concat(this.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
891
943
|
|
|
@@ -893,6 +945,21 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
893
945
|
months[monthYear] = [];
|
|
894
946
|
}
|
|
895
947
|
|
|
948
|
+
if (!this.monthYears[d.getFullYear()]) {
|
|
949
|
+
this.monthYears[d.getFullYear()] = [];
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
if (this.monthYearMonths.indexOf("".concat(d.getMonth(), "-").concat(d.getFullYear())) === -1) {
|
|
953
|
+
this.monthYearMonths.push("".concat(d.getMonth(), "-").concat(d.getFullYear()));
|
|
954
|
+
this.monthYears[d.getFullYear()].push({
|
|
955
|
+
date: new Date(d.setDate(1)),
|
|
956
|
+
month: this.options.monthMap[d.getMonth()],
|
|
957
|
+
monthNum: d.getMonth(),
|
|
958
|
+
year: d.getFullYear(),
|
|
959
|
+
id: d.setDate(1)
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
|
|
896
963
|
if (disabled.indexOf(d.getTime()) === -1) {
|
|
897
964
|
this.validDates.push(d.getTime());
|
|
898
965
|
}
|
|
@@ -916,6 +983,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
916
983
|
if (disabled.indexOf(_d) === -1) {
|
|
917
984
|
this.validYears.push(_d);
|
|
918
985
|
}
|
|
986
|
+
} else if (this.options.mode === 'hour') {//
|
|
919
987
|
}
|
|
920
988
|
} // check each range to see if it can be enabled
|
|
921
989
|
|
|
@@ -923,7 +991,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
923
991
|
for (var _i2 = 0; _i2 < this.options.ranges[this.options.mode].length; _i2++) {
|
|
924
992
|
var r = this.options.ranges[this.options.mode][_i2];
|
|
925
993
|
|
|
926
|
-
if (this.options.mode === 'date') {
|
|
994
|
+
if (this.options.mode === 'date' || this.options.mode === 'monthyear') {
|
|
927
995
|
// check the first date
|
|
928
996
|
if (this.validDates.indexOf(r.range[0].getTime()) !== -1) {
|
|
929
997
|
r.disabled = false;
|
|
@@ -959,6 +1027,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
959
1027
|
}
|
|
960
1028
|
}
|
|
961
1029
|
}
|
|
1030
|
+
} else if (this.options.mode === 'monthyear') {//
|
|
1031
|
+
} else if (this.options.mode === 'hour') {//
|
|
962
1032
|
}
|
|
963
1033
|
}
|
|
964
1034
|
|
|
@@ -985,7 +1055,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
985
1055
|
}
|
|
986
1056
|
|
|
987
1057
|
html += months[key].map(function (d) {
|
|
988
|
-
return "<li id='".concat(d.id, "_date' class='websy-dp-date ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.dayOfMonth, "</li>");
|
|
1058
|
+
return "<li id='".concat(_this5.elementId, "_").concat(d.id, "_date' class='websy-dp-date ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.dayOfMonth, "</li>");
|
|
989
1059
|
}).join('');
|
|
990
1060
|
html += "\n </ul>\n </div>\n ";
|
|
991
1061
|
}
|
|
@@ -998,9 +1068,33 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
998
1068
|
|
|
999
1069
|
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'><ul>");
|
|
1000
1070
|
html += yearList.map(function (d) {
|
|
1001
|
-
return "<li id='".concat(d.id, "_year' class='websy-dp-date websy-dp-year ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.year, "</li>");
|
|
1071
|
+
return "<li id='".concat(_this5.elementId, "_").concat(d.id, "_year' class='websy-dp-date websy-dp-year ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.year, "</li>");
|
|
1002
1072
|
}).join('');
|
|
1003
1073
|
html += "</ul></div>";
|
|
1074
|
+
} else if (this.options.mode === 'monthyear') {
|
|
1075
|
+
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-monthyear-container'>");
|
|
1076
|
+
|
|
1077
|
+
for (var year in this.monthYears) {
|
|
1078
|
+
html += "\n <ul>\n <li>".concat(year, "</li>\n ");
|
|
1079
|
+
|
|
1080
|
+
if (this.monthYears[year][0].monthNum > 0) {
|
|
1081
|
+
var paddedMonths = [];
|
|
1082
|
+
|
|
1083
|
+
for (var _i6 = 0; _i6 < this.monthYears[year][0].monthNum; _i6++) {
|
|
1084
|
+
paddedMonths.push("<li> </li>");
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
html += paddedMonths.join('');
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
html += this.monthYears[year].map(function (d) {
|
|
1091
|
+
return "<li id='".concat(_this5.elementId, "_").concat(d.id, "_monthyear' data-year='").concat(d.year, "' class='websy-dp-date websy-dp-monthyear'>").concat(d.month, "</li>");
|
|
1092
|
+
}).join('');
|
|
1093
|
+
html += "</ul>";
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
html += "</div>";
|
|
1097
|
+
} else if (this.options.mode === 'hour') {//
|
|
1004
1098
|
}
|
|
1005
1099
|
|
|
1006
1100
|
return html;
|
|
@@ -1021,13 +1115,15 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1021
1115
|
var el;
|
|
1022
1116
|
|
|
1023
1117
|
if (this.options.mode === 'date') {
|
|
1024
|
-
el = document.getElementById("".concat(this.selectedRangeDates[0].getTime(), "_date"));
|
|
1118
|
+
el = document.getElementById("".concat(this.elementId, "_").concat(this.selectedRangeDates[0].getTime(), "_date"));
|
|
1025
1119
|
} else if (this.options.mode === 'year') {
|
|
1026
1120
|
if (this.options.sortDirection === 'desc') {
|
|
1027
|
-
el = document.getElementById("".concat(this.selectedRangeDates[this.selectedRangeDates.length - 1], "_year"));
|
|
1121
|
+
el = document.getElementById("".concat(this.elementId, "_").concat(this.selectedRangeDates[this.selectedRangeDates.length - 1], "_year"));
|
|
1028
1122
|
} else {
|
|
1029
|
-
el = document.getElementById("".concat(this.selectedRangeDates[0], "_year"));
|
|
1123
|
+
el = document.getElementById("".concat(this.elementId, "_").concat(this.selectedRangeDates[0], "_year"));
|
|
1030
1124
|
}
|
|
1125
|
+
} else if (this.options.mode === 'monthyear') {//
|
|
1126
|
+
} else if (this.options.mode === 'hour') {//
|
|
1031
1127
|
}
|
|
1032
1128
|
|
|
1033
1129
|
var parentEl = document.getElementById("".concat(this.elementId, "_dateList"));
|
|
@@ -1053,6 +1149,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1053
1149
|
}
|
|
1054
1150
|
|
|
1055
1151
|
this.customRangeSelected = true;
|
|
1152
|
+
console.log('current selection', this.currentselection);
|
|
1056
1153
|
} else {
|
|
1057
1154
|
this.currentselection.push(timestamp);
|
|
1058
1155
|
this.currentselection.sort(function (a, b) {
|
|
@@ -1062,10 +1159,13 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1062
1159
|
}
|
|
1063
1160
|
}
|
|
1064
1161
|
|
|
1065
|
-
if (this.options.mode === 'date') {
|
|
1162
|
+
if (this.options.mode === 'date' || this.options.mode === 'monthyear') {
|
|
1066
1163
|
this.selectedRangeDates = [new Date(this.currentselection[0]), new Date(this.currentselection[1] || this.currentselection[0])];
|
|
1164
|
+
console.log('selected range', this.selectedRangeDates);
|
|
1067
1165
|
} else if (this.options.mode === 'year') {
|
|
1068
1166
|
this.selectedRangeDates = [this.currentselection[0], this.currentselection[1] || this.currentselection[0]];
|
|
1167
|
+
} else if (this.options.mode === 'monthyear') {//
|
|
1168
|
+
} else if (this.options.mode === 'hour') {//
|
|
1069
1169
|
} // if (this.currentselection.length === 2) {
|
|
1070
1170
|
// this.currentselection = []
|
|
1071
1171
|
// }
|
|
@@ -1121,7 +1221,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1121
1221
|
}, {
|
|
1122
1222
|
key: "setDateBounds",
|
|
1123
1223
|
value: function setDateBounds(range) {
|
|
1124
|
-
if (['All Dates', 'All Years'].indexOf(this.options.ranges[this.options.mode][0].label) !== -1) {
|
|
1224
|
+
if (['All Dates', 'All Years', 'All'].indexOf(this.options.ranges[this.options.mode][0].label) !== -1) {
|
|
1125
1225
|
this.options.ranges[this.options.mode][0].range = [range[0], range[1] || range[0]];
|
|
1126
1226
|
}
|
|
1127
1227
|
|
|
@@ -1131,6 +1231,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1131
1231
|
} else if (this.options.mode === 'year') {
|
|
1132
1232
|
this.options.minAllowedYear = range[0];
|
|
1133
1233
|
this.options.maxAllowedYear = range[1] || range[0];
|
|
1234
|
+
} else if (this.options.mode === 'monthyear') {
|
|
1235
|
+
this.options.minAllowedDate = range[0];
|
|
1236
|
+
this.options.maxAllowedDate = range[1] || range[0];
|
|
1237
|
+
} else if (this.options.mode === 'hour') {//
|
|
1134
1238
|
}
|
|
1135
1239
|
}
|
|
1136
1240
|
}, {
|
|
@@ -1150,6 +1254,13 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1150
1254
|
return d.toLocaleDateString();
|
|
1151
1255
|
} else if (_this7.options.mode === 'year') {
|
|
1152
1256
|
return d;
|
|
1257
|
+
} else if (_this7.options.mode === 'monthyear') {
|
|
1258
|
+
if (!d.getMonth) {
|
|
1259
|
+
d = new Date(d);
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
return "".concat(_this7.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
1263
|
+
} else if (_this7.options.mode === 'hour') {//
|
|
1153
1264
|
}
|
|
1154
1265
|
});
|
|
1155
1266
|
var start = list[0];
|
|
@@ -1211,7 +1322,8 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1211
1322
|
disabled: false,
|
|
1212
1323
|
minSearchCharacters: 2,
|
|
1213
1324
|
showCompleteSelectedList: false,
|
|
1214
|
-
closeAfterSelection: true
|
|
1325
|
+
closeAfterSelection: true,
|
|
1326
|
+
customActions: []
|
|
1215
1327
|
};
|
|
1216
1328
|
this.options = _extends({}, DEFAULTS, options);
|
|
1217
1329
|
|
|
@@ -1245,7 +1357,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1245
1357
|
var headerValue = this.selectedItems.map(function (s) {
|
|
1246
1358
|
return _this8.options.items[s].value || _this8.options.items[s].label;
|
|
1247
1359
|
}).join(this.options.multiValueDelimiter);
|
|
1248
|
-
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, "'>\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 ");
|
|
1360
|
+
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 ");
|
|
1249
1361
|
|
|
1250
1362
|
if (this.options.allowClear === true) {
|
|
1251
1363
|
html += "\n <svg class='clear' 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 ";
|
|
@@ -1253,6 +1365,14 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1253
1365
|
|
|
1254
1366
|
html += " \n </div>\n <div id='".concat(this.elementId, "_mask' class='websy-dropdown-mask'></div>\n <div id='").concat(this.elementId, "_content' class='websy-dropdown-content'>\n ");
|
|
1255
1367
|
|
|
1368
|
+
if (this.options.customActions.length > 0) {
|
|
1369
|
+
html += "\n <div class='websy-dropdown-action-container'>\n <button class='websy-dropdown-action-button'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 512 512\">><circle cx=\"256\" cy=\"256\" r=\"32\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><circle cx=\"416\" cy=\"256\" r=\"32\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><circle cx=\"96\" cy=\"256\" r=\"32\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/></svg>\n </button>\n <ul id='".concat(this.elementId, "_actionContainer'>\n ");
|
|
1370
|
+
this.options.customActions.forEach(function (a, i) {
|
|
1371
|
+
html += "\n <li class='websy-dropdown-custom-action' data-index='".concat(i, "'>").concat(a.label, "</li>\n ");
|
|
1372
|
+
});
|
|
1373
|
+
html += "\n </ul>\n </div>\n ";
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1256
1376
|
if (this.options.disableSearch !== true) {
|
|
1257
1377
|
html += "\n <input id='".concat(this.elementId, "_search' class='websy-dropdown-search' placeholder='").concat(this.options.searchPlaceholder || 'Search', "'>\n ");
|
|
1258
1378
|
}
|
|
@@ -1286,6 +1406,12 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1286
1406
|
var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
|
|
1287
1407
|
var contentEl = document.getElementById("".concat(this.elementId, "_content"));
|
|
1288
1408
|
var scrollEl = document.getElementById("".concat(this.elementId, "_itemsContainer"));
|
|
1409
|
+
var actionEl = document.getElementById("".concat(this.elementId, "_actionContainer"));
|
|
1410
|
+
|
|
1411
|
+
if (actionEl) {
|
|
1412
|
+
actionEl.classList.remove('active');
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1289
1415
|
var el = document.getElementById(this.elementId);
|
|
1290
1416
|
|
|
1291
1417
|
if (el) {
|
|
@@ -1328,6 +1454,18 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1328
1454
|
} else if (event.target.classList.contains('search')) {
|
|
1329
1455
|
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
1330
1456
|
el.classList.toggle('search-open');
|
|
1457
|
+
} else if (event.target.classList.contains('websy-dropdown-custom-action')) {
|
|
1458
|
+
var actionIndex = +event.target.getAttribute('data-index');
|
|
1459
|
+
|
|
1460
|
+
if (this.options.customActions[actionIndex] && this.options.customActions[actionIndex].fn) {
|
|
1461
|
+
this.options.customActions[actionIndex].fn();
|
|
1462
|
+
}
|
|
1463
|
+
} else if (event.target.classList.contains('websy-dropdown-action-button')) {
|
|
1464
|
+
var _el = document.getElementById("".concat(this.elementId, "_actionContainer"));
|
|
1465
|
+
|
|
1466
|
+
if (_el) {
|
|
1467
|
+
_el.classList.toggle('active');
|
|
1468
|
+
}
|
|
1331
1469
|
}
|
|
1332
1470
|
}
|
|
1333
1471
|
}, {
|
|
@@ -2721,12 +2859,242 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
2721
2859
|
|
|
2722
2860
|
return WebsyPubSub;
|
|
2723
2861
|
}();
|
|
2862
|
+
|
|
2863
|
+
var ResponsiveText = /*#__PURE__*/function () {
|
|
2864
|
+
function ResponsiveText(elementId, options) {
|
|
2865
|
+
var _this19 = this;
|
|
2866
|
+
|
|
2867
|
+
_classCallCheck(this, ResponsiveText);
|
|
2868
|
+
|
|
2869
|
+
var DEFAULTS = {
|
|
2870
|
+
textAlign: 'center',
|
|
2871
|
+
verticalAlign: 'flex-end',
|
|
2872
|
+
wrapText: false
|
|
2873
|
+
};
|
|
2874
|
+
this.options = _extends({}, DEFAULTS, options);
|
|
2875
|
+
this.elementId = elementId;
|
|
2876
|
+
this.canvas = document.createElement('canvas');
|
|
2877
|
+
window.addEventListener('resize', function () {
|
|
2878
|
+
return _this19.render();
|
|
2879
|
+
});
|
|
2880
|
+
var el = document.getElementById(this.elementId);
|
|
2881
|
+
|
|
2882
|
+
if (el) {
|
|
2883
|
+
this.render();
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
|
|
2887
|
+
_createClass(ResponsiveText, [{
|
|
2888
|
+
key: "css",
|
|
2889
|
+
value: function css(element, property) {
|
|
2890
|
+
return window.getComputedStyle(element, null).getPropertyValue(property);
|
|
2891
|
+
}
|
|
2892
|
+
}, {
|
|
2893
|
+
key: "render",
|
|
2894
|
+
value: function render(text) {
|
|
2895
|
+
if (typeof text !== 'undefined') {
|
|
2896
|
+
this.options.text = text;
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2899
|
+
if (this.options.text) {
|
|
2900
|
+
var wrappingRequired = false;
|
|
2901
|
+
var el = document.getElementById(this.elementId);
|
|
2902
|
+
var cx = this.canvas.getContext('2d');
|
|
2903
|
+
var f = 0;
|
|
2904
|
+
var fits = false; // let el = document.getElementById(`${layout.qInfo.qId}_responsiveInner`)
|
|
2905
|
+
|
|
2906
|
+
var height = el.clientHeight;
|
|
2907
|
+
|
|
2908
|
+
if (typeof this.options.maxHeight === 'string' && this.options.maxHeight.indexOf('%') !== -1) {
|
|
2909
|
+
var p = +this.options.maxHeight.replace('%', '');
|
|
2910
|
+
|
|
2911
|
+
if (!isNaN(p)) {
|
|
2912
|
+
this.options.maxHeight = Math.floor(height * (p / 100));
|
|
2913
|
+
}
|
|
2914
|
+
} else if (typeof this.options.maxHeight === 'string' && this.options.maxHeight.indexOf('px') !== -1) {
|
|
2915
|
+
this.options.maxHeight = +this.options.maxHeight.replace('px', '');
|
|
2916
|
+
}
|
|
2917
|
+
|
|
2918
|
+
if (typeof this.options.minHeight === 'string' && this.options.minHeight.indexOf('%') !== -1) {
|
|
2919
|
+
var _p = +this.options.minHeight.replace('%', '');
|
|
2920
|
+
|
|
2921
|
+
if (!isNaN(_p)) {
|
|
2922
|
+
this.options.minHeight = Math.floor(height * (_p / 100));
|
|
2923
|
+
}
|
|
2924
|
+
} else if (typeof this.options.minHeight === 'string' && this.options.minHeight.indexOf('px') !== -1) {
|
|
2925
|
+
this.options.minHeight = +this.options.minHeight.replace('px', '');
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
var fontFamily = this.css(el, 'font-family');
|
|
2929
|
+
var fontWeight = this.css(el, 'font-weight');
|
|
2930
|
+
var allowedWidth = el.clientWidth;
|
|
2931
|
+
|
|
2932
|
+
if (allowedWidth === 0) {
|
|
2933
|
+
// check for a max-width property
|
|
2934
|
+
if (el.style.maxWidth && el.style.maxWidth !== 'auto') {
|
|
2935
|
+
if (el.parentElement.clientWidth > 0) {
|
|
2936
|
+
var calc = el.style.maxWidth;
|
|
2937
|
+
|
|
2938
|
+
if (calc.indexOf('calc') !== -1) {
|
|
2939
|
+
// this logic currently only handles calc statements using % and px
|
|
2940
|
+
// and only + or - formulas
|
|
2941
|
+
calc = calc.replace('calc(', '').replace(')', '');
|
|
2942
|
+
calc = calc.split(' ');
|
|
2943
|
+
|
|
2944
|
+
if (calc[0].indexOf('px') !== -1) {
|
|
2945
|
+
allowedWidth = calc[0].replace('px', '');
|
|
2946
|
+
} else if (calc[0].indexOf('%') !== -1) {
|
|
2947
|
+
allowedWidth = el.parentElement.clientWidth * (+calc[0].replace('%', '') / 100);
|
|
2948
|
+
}
|
|
2949
|
+
|
|
2950
|
+
if (calc[2] && calc[4]) {
|
|
2951
|
+
// this means we have an operator and a second value
|
|
2952
|
+
// handle -
|
|
2953
|
+
if (calc[2] === '-') {
|
|
2954
|
+
if (calc[4].indexOf('px') !== -1) {
|
|
2955
|
+
allowedWidth -= +calc[4].replace('px', '');
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
|
|
2959
|
+
if (calc[2] === '+') {
|
|
2960
|
+
if (calc[4].indexOf('px') !== -1) {
|
|
2961
|
+
allowedWidth += +calc[4].replace('px', '');
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
} else if (calc.indexOf('px') !== -1) {
|
|
2966
|
+
allowedWidth = +calc.replace('px', '');
|
|
2967
|
+
} else if (calc.indexOf('%') !== -1) {
|
|
2968
|
+
allowedWidth = el.parentElement.clientWidth * (+calc.replace('%', '') / 100);
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2972
|
+
} // console.log('max height', this.options.maxHeight);
|
|
2973
|
+
|
|
2974
|
+
|
|
2975
|
+
var innerElHeight = el.clientHeight;
|
|
2976
|
+
|
|
2977
|
+
while (fits === false) {
|
|
2978
|
+
f++;
|
|
2979
|
+
cx.font = "".concat(fontWeight, " ").concat(f, "px ").concat(fontFamily);
|
|
2980
|
+
var measurements = cx.measureText(this.options.text); // add support for safari where some elements end up with zero height
|
|
2981
|
+
|
|
2982
|
+
if (navigator.userAgent.indexOf('Safari') !== -1) {
|
|
2983
|
+
// get the closest parent that has a height
|
|
2984
|
+
var heightFound = false;
|
|
2985
|
+
var currEl = el;
|
|
2986
|
+
|
|
2987
|
+
while (heightFound === false) {
|
|
2988
|
+
if (currEl.clientHeight > 0) {
|
|
2989
|
+
innerElHeight = currEl.clientHeight;
|
|
2990
|
+
heightFound = true;
|
|
2991
|
+
} else if (currEl.parentNode) {
|
|
2992
|
+
currEl = currEl.parentNode;
|
|
2993
|
+
} else {
|
|
2994
|
+
// prevent the loop from running indefinitely
|
|
2995
|
+
heightFound = true;
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
|
|
3000
|
+
if (typeof this.options.maxHeight !== 'undefined' && f === this.options.maxHeight) {
|
|
3001
|
+
f = this.options.maxHeight;
|
|
3002
|
+
height = measurements.actualBoundingBoxAscent;
|
|
3003
|
+
fits = true;
|
|
3004
|
+
} else if (measurements.width > allowedWidth || measurements.actualBoundingBoxAscent >= innerElHeight) {
|
|
3005
|
+
f--;
|
|
3006
|
+
height = measurements.actualBoundingBoxAscent;
|
|
3007
|
+
fits = true;
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
|
|
3011
|
+
if (this.options.minHeight === '') {
|
|
3012
|
+
this.options.minHeight = undefined;
|
|
3013
|
+
}
|
|
3014
|
+
|
|
3015
|
+
if (typeof this.options.minHeight !== 'undefined') {
|
|
3016
|
+
if (this.options.minHeight > f && this.options.wrapText === true) {
|
|
3017
|
+
// we run the process again but this time separating the words onto separate lines
|
|
3018
|
+
// this currently only supports wrapping onto 2 lines
|
|
3019
|
+
wrappingRequired = true;
|
|
3020
|
+
fits = false;
|
|
3021
|
+
f = this.options.minHeight;
|
|
3022
|
+
var spaceCount = this.options.text.match(/ /g);
|
|
3023
|
+
|
|
3024
|
+
if (spaceCount && spaceCount.length > 0) {
|
|
3025
|
+
spaceCount = spaceCount.length;
|
|
3026
|
+
var words = this.options.text.split(' ');
|
|
3027
|
+
|
|
3028
|
+
while (fits === false) {
|
|
3029
|
+
f++;
|
|
3030
|
+
cx.font = "".concat(fontWeight, " ").concat(f, "px ").concat(fontFamily);
|
|
3031
|
+
|
|
3032
|
+
for (var i = spaceCount; i > 0; i--) {
|
|
3033
|
+
var fitsCount = 0;
|
|
3034
|
+
var lines = [words.slice(0, i).join(' '), words.slice(i, words.length).join(' ')];
|
|
3035
|
+
var longestLine = lines.reduce(function (a, b) {
|
|
3036
|
+
return a.length > b.length ? a : b;
|
|
3037
|
+
}, ''); // lines.forEach(l => {
|
|
3038
|
+
|
|
3039
|
+
var _measurements = cx.measureText(longestLine); // add support for safari where some elements end up with zero height
|
|
3040
|
+
|
|
3041
|
+
|
|
3042
|
+
if (navigator.userAgent.indexOf('Safari') !== -1) {
|
|
3043
|
+
// get the closest parent that has a height
|
|
3044
|
+
var _heightFound = false;
|
|
3045
|
+
var _currEl = el;
|
|
3046
|
+
|
|
3047
|
+
while (_heightFound === false) {
|
|
3048
|
+
if (_currEl.clientHeight > 0) {
|
|
3049
|
+
innerElHeight = _currEl.clientHeight;
|
|
3050
|
+
_heightFound = true;
|
|
3051
|
+
} else if (_currEl.parentNode) {
|
|
3052
|
+
_currEl = _currEl.parentNode;
|
|
3053
|
+
} else {
|
|
3054
|
+
// prevent the loop from running indefinitely
|
|
3055
|
+
_heightFound = true;
|
|
3056
|
+
}
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
|
|
3060
|
+
if (typeof this.options.maxHeight !== 'undefined' && f === this.options.maxHeight) {
|
|
3061
|
+
f = this.options.maxHeight;
|
|
3062
|
+
height = _measurements.actualBoundingBoxAscent;
|
|
3063
|
+
fits = true;
|
|
3064
|
+
break;
|
|
3065
|
+
} else if (_measurements.width > allowedWidth || _measurements.actualBoundingBoxAscent >= innerElHeight / 2 * 0.75) {
|
|
3066
|
+
f--;
|
|
3067
|
+
height = _measurements.actualBoundingBoxAscent;
|
|
3068
|
+
fits = true;
|
|
3069
|
+
break;
|
|
3070
|
+
} // })
|
|
3071
|
+
|
|
3072
|
+
}
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3075
|
+
|
|
3076
|
+
if (typeof this.options.minHeight !== 'undefined' && this.options.minHeight > f) {
|
|
3077
|
+
f = this.options.minHeight;
|
|
3078
|
+
}
|
|
3079
|
+
} else if (this.options.minHeight > f) {
|
|
3080
|
+
f = this.options.minHeight;
|
|
3081
|
+
}
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3084
|
+
var spanHeight = Math.min(innerElHeight, height);
|
|
3085
|
+
el.innerHTML = "\n <div \n class='websy-responsive-text' \n style='\n justify-content: ".concat(this.options.verticalAlign, ";\n font-size: ").concat(f, "px;\n font-weight: ").concat(fontWeight || 'normal', ";\n '\n > \n <span\n style='\n white-space: ").concat(this.options.wrapText === true ? 'normal' : 'nowrap', ";\n height: ").concat(Math.floor(wrappingRequired === true ? spanHeight * (1 * 1 / 3) * 2 : spanHeight), "px;\n line-height: ").concat(Math.ceil(wrappingRequired === true ? f * 1.2 : spanHeight), "px;\n justify-content: ").concat(this.options.textAlign, ";\n text-align: ").concat(this.options.textAlign, ";\n '\n >").concat(this.options.text, "</span>\n </div>\n ");
|
|
3086
|
+
}
|
|
3087
|
+
}
|
|
3088
|
+
}]);
|
|
3089
|
+
|
|
3090
|
+
return ResponsiveText;
|
|
3091
|
+
}();
|
|
2724
3092
|
/* global WebsyDesigns */
|
|
2725
3093
|
|
|
2726
3094
|
|
|
2727
3095
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
2728
3096
|
function WebsyResultList(elementId, options) {
|
|
2729
|
-
var
|
|
3097
|
+
var _this20 = this;
|
|
2730
3098
|
|
|
2731
3099
|
_classCallCheck(this, WebsyResultList);
|
|
2732
3100
|
|
|
@@ -2754,9 +3122,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2754
3122
|
|
|
2755
3123
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
2756
3124
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
2757
|
-
|
|
3125
|
+
_this20.options.template = templateString;
|
|
2758
3126
|
|
|
2759
|
-
|
|
3127
|
+
_this20.render();
|
|
2760
3128
|
});
|
|
2761
3129
|
} else {
|
|
2762
3130
|
this.render();
|
|
@@ -2775,7 +3143,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2775
3143
|
}, {
|
|
2776
3144
|
key: "buildHTML",
|
|
2777
3145
|
value: function buildHTML(d) {
|
|
2778
|
-
var
|
|
3146
|
+
var _this21 = this;
|
|
2779
3147
|
|
|
2780
3148
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
2781
3149
|
var html = "";
|
|
@@ -2783,7 +3151,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2783
3151
|
if (this.options.template) {
|
|
2784
3152
|
if (d.length > 0) {
|
|
2785
3153
|
d.forEach(function (row, ix) {
|
|
2786
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(
|
|
3154
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(_this21.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
2787
3155
|
|
|
2788
3156
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
2789
3157
|
|
|
@@ -2903,7 +3271,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2903
3271
|
}, {
|
|
2904
3272
|
key: "handleClick",
|
|
2905
3273
|
value: function handleClick(event) {
|
|
2906
|
-
var
|
|
3274
|
+
var _this22 = this;
|
|
2907
3275
|
|
|
2908
3276
|
if (event.target.classList.contains('clickable')) {
|
|
2909
3277
|
var l = event.target.getAttribute('data-event');
|
|
@@ -2921,8 +3289,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2921
3289
|
l = l[0];
|
|
2922
3290
|
params = params.map(function (p) {
|
|
2923
3291
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
2924
|
-
if (
|
|
2925
|
-
p =
|
|
3292
|
+
if (_this22.rows[+id]) {
|
|
3293
|
+
p = _this22.rows[+id][p];
|
|
2926
3294
|
}
|
|
2927
3295
|
} else if (typeof p === 'string') {
|
|
2928
3296
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -2944,13 +3312,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2944
3312
|
}, {
|
|
2945
3313
|
key: "render",
|
|
2946
3314
|
value: function render() {
|
|
2947
|
-
var
|
|
3315
|
+
var _this23 = this;
|
|
2948
3316
|
|
|
2949
3317
|
if (this.options.entity) {
|
|
2950
3318
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
2951
|
-
|
|
3319
|
+
_this23.rows = results.rows;
|
|
2952
3320
|
|
|
2953
|
-
|
|
3321
|
+
_this23.resize();
|
|
2954
3322
|
});
|
|
2955
3323
|
} else {
|
|
2956
3324
|
this.resize();
|
|
@@ -3029,14 +3397,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3029
3397
|
_createClass(WebsyRouter, [{
|
|
3030
3398
|
key: "addGroup",
|
|
3031
3399
|
value: function addGroup(group) {
|
|
3032
|
-
var
|
|
3400
|
+
var _this24 = this;
|
|
3033
3401
|
|
|
3034
3402
|
if (!this.groups[group]) {
|
|
3035
3403
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3036
3404
|
|
|
3037
3405
|
if (els) {
|
|
3038
3406
|
this.getClosestParent(els[0], function (parent) {
|
|
3039
|
-
|
|
3407
|
+
_this24.groups[group] = {
|
|
3040
3408
|
activeView: '',
|
|
3041
3409
|
views: [],
|
|
3042
3410
|
parent: parent.getAttribute('data-view')
|
|
@@ -3361,12 +3729,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3361
3729
|
}, {
|
|
3362
3730
|
key: "showComponents",
|
|
3363
3731
|
value: function showComponents(view) {
|
|
3364
|
-
var
|
|
3732
|
+
var _this25 = this;
|
|
3365
3733
|
|
|
3366
3734
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
3367
3735
|
this.options.views[view].components.forEach(function (c) {
|
|
3368
3736
|
if (typeof c.instance === 'undefined') {
|
|
3369
|
-
|
|
3737
|
+
_this25.prepComponent(c.elementId, c.options);
|
|
3370
3738
|
|
|
3371
3739
|
c.instance = new c.Component(c.elementId, c.options);
|
|
3372
3740
|
} else if (c.instance.render) {
|
|
@@ -3794,7 +4162,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
3794
4162
|
|
|
3795
4163
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
3796
4164
|
function WebsyTemplate(elementId, options) {
|
|
3797
|
-
var
|
|
4165
|
+
var _this26 = this;
|
|
3798
4166
|
|
|
3799
4167
|
_classCallCheck(this, WebsyTemplate);
|
|
3800
4168
|
|
|
@@ -3820,9 +4188,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3820
4188
|
|
|
3821
4189
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3822
4190
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3823
|
-
|
|
4191
|
+
_this26.options.template = templateString;
|
|
3824
4192
|
|
|
3825
|
-
|
|
4193
|
+
_this26.render();
|
|
3826
4194
|
});
|
|
3827
4195
|
} else {
|
|
3828
4196
|
this.render();
|
|
@@ -3832,7 +4200,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3832
4200
|
_createClass(WebsyTemplate, [{
|
|
3833
4201
|
key: "buildHTML",
|
|
3834
4202
|
value: function buildHTML() {
|
|
3835
|
-
var
|
|
4203
|
+
var _this27 = this;
|
|
3836
4204
|
|
|
3837
4205
|
var html = "";
|
|
3838
4206
|
|
|
@@ -3894,14 +4262,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3894
4262
|
}
|
|
3895
4263
|
|
|
3896
4264
|
if (polarity === true) {
|
|
3897
|
-
if (typeof
|
|
4265
|
+
if (typeof _this27.options.data[parts[0]] !== 'undefined' && _this27.options.data[parts[0]] === parts[1]) {
|
|
3898
4266
|
// remove the <if> tags
|
|
3899
4267
|
removeAll = false;
|
|
3900
4268
|
} else if (parts[0] === parts[1]) {
|
|
3901
4269
|
removeAll = false;
|
|
3902
4270
|
}
|
|
3903
4271
|
} else if (polarity === false) {
|
|
3904
|
-
if (typeof
|
|
4272
|
+
if (typeof _this27.options.data[parts[0]] !== 'undefined' && _this27.options.data[parts[0]] !== parts[1]) {
|
|
3905
4273
|
// remove the <if> tags
|
|
3906
4274
|
removeAll = false;
|
|
3907
4275
|
}
|
|
@@ -4147,10 +4515,10 @@ var WebsyUtils = {
|
|
|
4147
4515
|
var s = '';
|
|
4148
4516
|
var d = 1; // let out
|
|
4149
4517
|
|
|
4150
|
-
for (var
|
|
4151
|
-
if (n >= ranges[
|
|
4152
|
-
d = ranges[
|
|
4153
|
-
s = ranges[
|
|
4518
|
+
for (var _i7 = 0; _i7 < ranges.length; _i7++) {
|
|
4519
|
+
if (n >= ranges[_i7].divider) {
|
|
4520
|
+
d = ranges[_i7].divider;
|
|
4521
|
+
s = ranges[_i7].suffix; // out = (n / ranges[i].divider).toFixed(decimals).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$100,')
|
|
4154
4522
|
|
|
4155
4523
|
break;
|
|
4156
4524
|
}
|
|
@@ -4188,7 +4556,7 @@ var WebsyUtils = {
|
|
|
4188
4556
|
|
|
4189
4557
|
var WebsyTable = /*#__PURE__*/function () {
|
|
4190
4558
|
function WebsyTable(elementId, options) {
|
|
4191
|
-
var
|
|
4559
|
+
var _this28 = this;
|
|
4192
4560
|
|
|
4193
4561
|
_classCallCheck(this, WebsyTable);
|
|
4194
4562
|
|
|
@@ -4226,8 +4594,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4226
4594
|
allowClear: false,
|
|
4227
4595
|
disableSearch: true,
|
|
4228
4596
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4229
|
-
if (
|
|
4230
|
-
|
|
4597
|
+
if (_this28.options.onChangePageSize) {
|
|
4598
|
+
_this28.options.onChangePageSize(selectedItem.value);
|
|
4231
4599
|
}
|
|
4232
4600
|
}
|
|
4233
4601
|
});
|
|
@@ -4248,7 +4616,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4248
4616
|
_createClass(WebsyTable, [{
|
|
4249
4617
|
key: "appendRows",
|
|
4250
4618
|
value: function appendRows(data) {
|
|
4251
|
-
var
|
|
4619
|
+
var _this29 = this;
|
|
4252
4620
|
|
|
4253
4621
|
this.hideError();
|
|
4254
4622
|
var bodyHTML = '';
|
|
@@ -4256,15 +4624,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4256
4624
|
if (data) {
|
|
4257
4625
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4258
4626
|
return '<tr>' + r.map(function (c, i) {
|
|
4259
|
-
if (
|
|
4627
|
+
if (_this29.options.columns[i].show !== false) {
|
|
4260
4628
|
var style = '';
|
|
4261
4629
|
|
|
4262
4630
|
if (c.style) {
|
|
4263
4631
|
style += c.style;
|
|
4264
4632
|
}
|
|
4265
4633
|
|
|
4266
|
-
if (
|
|
4267
|
-
style += "width: ".concat(
|
|
4634
|
+
if (_this29.options.columns[i].width) {
|
|
4635
|
+
style += "width: ".concat(_this29.options.columns[i].width, "; ");
|
|
4268
4636
|
}
|
|
4269
4637
|
|
|
4270
4638
|
if (c.backgroundColor) {
|
|
@@ -4279,18 +4647,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4279
4647
|
style += "color: ".concat(c.color, "; ");
|
|
4280
4648
|
}
|
|
4281
4649
|
|
|
4282
|
-
if (
|
|
4283
|
-
return "\n <td \n data-row-index='".concat(
|
|
4284
|
-
} else if ((
|
|
4285
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
4650
|
+
if (_this29.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
4651
|
+
return "\n <td \n data-row-index='".concat(_this29.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this29.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(_this29.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this29.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
4652
|
+
} else if ((_this29.options.columns[i].showAsNavigatorLink === true || _this29.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
4653
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this29.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this29.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this29.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this29.options.columns[i].linkText || c.value, "</td>\n ");
|
|
4286
4654
|
} else {
|
|
4287
4655
|
var info = c.value;
|
|
4288
4656
|
|
|
4289
|
-
if (
|
|
4657
|
+
if (_this29.options.columns[i].showAsImage === true) {
|
|
4290
4658
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4291
4659
|
}
|
|
4292
4660
|
|
|
4293
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
4661
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this29.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this29.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 ");
|
|
4294
4662
|
}
|
|
4295
4663
|
}
|
|
4296
4664
|
}).join('') + '</tr>';
|
|
@@ -4462,7 +4830,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4462
4830
|
}, {
|
|
4463
4831
|
key: "render",
|
|
4464
4832
|
value: function render(data) {
|
|
4465
|
-
var
|
|
4833
|
+
var _this30 = this;
|
|
4466
4834
|
|
|
4467
4835
|
if (!this.options.columns) {
|
|
4468
4836
|
return;
|
|
@@ -4487,7 +4855,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4487
4855
|
|
|
4488
4856
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
4489
4857
|
if (c.show !== false) {
|
|
4490
|
-
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 ?
|
|
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 ? _this30.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
4491
4859
|
}
|
|
4492
4860
|
}).join('') + '</tr>';
|
|
4493
4861
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -4506,7 +4874,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4506
4874
|
|
|
4507
4875
|
if (pagingEl) {
|
|
4508
4876
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
4509
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
4877
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this30.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
4510
4878
|
});
|
|
4511
4879
|
var startIndex = 0;
|
|
4512
4880
|
|
|
@@ -4574,7 +4942,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4574
4942
|
|
|
4575
4943
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
4576
4944
|
function WebsyTable2(elementId, options) {
|
|
4577
|
-
var
|
|
4945
|
+
var _this31 = this;
|
|
4578
4946
|
|
|
4579
4947
|
_classCallCheck(this, WebsyTable2);
|
|
4580
4948
|
|
|
@@ -4615,8 +4983,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4615
4983
|
allowClear: false,
|
|
4616
4984
|
disableSearch: true,
|
|
4617
4985
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4618
|
-
if (
|
|
4619
|
-
|
|
4986
|
+
if (_this31.options.onChangePageSize) {
|
|
4987
|
+
_this31.options.onChangePageSize(selectedItem.value);
|
|
4620
4988
|
}
|
|
4621
4989
|
}
|
|
4622
4990
|
});
|
|
@@ -4640,7 +5008,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4640
5008
|
_createClass(WebsyTable2, [{
|
|
4641
5009
|
key: "appendRows",
|
|
4642
5010
|
value: function appendRows(data) {
|
|
4643
|
-
var
|
|
5011
|
+
var _this32 = this;
|
|
4644
5012
|
|
|
4645
5013
|
this.hideError();
|
|
4646
5014
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -4649,15 +5017,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4649
5017
|
if (data) {
|
|
4650
5018
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4651
5019
|
return '<tr>' + r.map(function (c, i) {
|
|
4652
|
-
if (
|
|
4653
|
-
var style = "height: ".concat(
|
|
5020
|
+
if (_this32.options.columns[i].show !== false) {
|
|
5021
|
+
var style = "height: ".concat(_this32.options.cellSize, "px; line-height: ").concat(_this32.options.cellSize, "px;");
|
|
4654
5022
|
|
|
4655
5023
|
if (c.style) {
|
|
4656
5024
|
style += c.style;
|
|
4657
5025
|
}
|
|
4658
5026
|
|
|
4659
|
-
if (
|
|
4660
|
-
style += "width: ".concat(
|
|
5027
|
+
if (_this32.options.columns[i].width) {
|
|
5028
|
+
style += "width: ".concat(_this32.options.columns[i].width, "; ");
|
|
4661
5029
|
}
|
|
4662
5030
|
|
|
4663
5031
|
if (c.backgroundColor) {
|
|
@@ -4672,18 +5040,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4672
5040
|
style += "color: ".concat(c.color, "; ");
|
|
4673
5041
|
}
|
|
4674
5042
|
|
|
4675
|
-
if (
|
|
4676
|
-
return "\n <td \n data-row-index='".concat(
|
|
4677
|
-
} else if ((
|
|
4678
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5043
|
+
if (_this32.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5044
|
+
return "\n <td \n data-row-index='".concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this32.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(_this32.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this32.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5045
|
+
} else if ((_this32.options.columns[i].showAsNavigatorLink === true || _this32.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5046
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this32.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this32.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this32.options.columns[i].linkText || c.value, "</td>\n ");
|
|
4679
5047
|
} else {
|
|
4680
5048
|
var info = c.value;
|
|
4681
5049
|
|
|
4682
|
-
if (
|
|
5050
|
+
if (_this32.options.columns[i].showAsImage === true) {
|
|
4683
5051
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4684
5052
|
}
|
|
4685
5053
|
|
|
4686
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5054
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this32.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 ");
|
|
4687
5055
|
}
|
|
4688
5056
|
}
|
|
4689
5057
|
}).join('') + '</tr>';
|
|
@@ -4808,7 +5176,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4808
5176
|
value: function handleGlobalMouseUp(event) {
|
|
4809
5177
|
this.scrolling = false;
|
|
4810
5178
|
var el = document.getElementById(this.elementId);
|
|
4811
|
-
|
|
5179
|
+
|
|
5180
|
+
if (el) {
|
|
5181
|
+
el.classList.remove('scrolling');
|
|
5182
|
+
}
|
|
4812
5183
|
}
|
|
4813
5184
|
}, {
|
|
4814
5185
|
key: "handleMouseUp",
|
|
@@ -4938,7 +5309,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4938
5309
|
}, {
|
|
4939
5310
|
key: "render",
|
|
4940
5311
|
value: function render(data) {
|
|
4941
|
-
var
|
|
5312
|
+
var _this33 = this;
|
|
4942
5313
|
|
|
4943
5314
|
if (!this.options.columns) {
|
|
4944
5315
|
return;
|
|
@@ -4974,7 +5345,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4974
5345
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
4975
5346
|
}
|
|
4976
5347
|
|
|
4977
|
-
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 ?
|
|
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 ? _this33.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
4978
5349
|
}
|
|
4979
5350
|
}).join('') + '</tr>';
|
|
4980
5351
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -4985,7 +5356,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4985
5356
|
var dropdownHTML = "";
|
|
4986
5357
|
this.options.columns.forEach(function (c, i) {
|
|
4987
5358
|
if (c.searchable && c.searchField) {
|
|
4988
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5359
|
+
dropdownHTML += "\n <div id=\"".concat(_this33.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
4989
5360
|
}
|
|
4990
5361
|
});
|
|
4991
5362
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5007,7 +5378,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5007
5378
|
|
|
5008
5379
|
if (pagingEl) {
|
|
5009
5380
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5010
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5381
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this33.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5011
5382
|
});
|
|
5012
5383
|
var startIndex = 0;
|
|
5013
5384
|
|
|
@@ -5094,7 +5465,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5094
5465
|
}, {
|
|
5095
5466
|
key: "getColumnParameters",
|
|
5096
5467
|
value: function getColumnParameters(values) {
|
|
5097
|
-
var
|
|
5468
|
+
var _this34 = this;
|
|
5098
5469
|
|
|
5099
5470
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
5100
5471
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -5102,10 +5473,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5102
5473
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
5103
5474
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5104
5475
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
5105
|
-
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 ?
|
|
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 ? _this34.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5106
5477
|
}).join('') + '</tr>';
|
|
5107
5478
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
5108
|
-
return "\n <td \n style='height: ".concat(
|
|
5479
|
+
return "\n <td \n style='height: ".concat(_this34.options.cellSize, "px; line-height: ").concat(_this34.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
5109
5480
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
5110
5481
|
|
|
5111
5482
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -5126,8 +5497,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5126
5497
|
|
|
5127
5498
|
|
|
5128
5499
|
if (accWidth < (tableContainerEl.offsetWidth || tableContainerEl.clientWidth) - nonScrollableWidth) {
|
|
5129
|
-
for (var
|
|
5130
|
-
cellWidths[
|
|
5500
|
+
for (var _i8 = this.options.leftColumns; _i8 < cellWidths.length; _i8++) {
|
|
5501
|
+
cellWidths[_i8] = ((tableContainerEl.offsetWidth || tableContainerEl.clientWidth) - nonScrollableWidth) / (cellWidths.length - this.options.leftColumns);
|
|
5131
5502
|
}
|
|
5132
5503
|
} // const cellWidth = firstDataCell.offsetWidth || firstDataCell.clientWidth
|
|
5133
5504
|
// tableEl.style.width = ''
|
|
@@ -5155,7 +5526,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5155
5526
|
|
|
5156
5527
|
var WebsyChart = /*#__PURE__*/function () {
|
|
5157
5528
|
function WebsyChart(elementId, options) {
|
|
5158
|
-
var
|
|
5529
|
+
var _this35 = this;
|
|
5159
5530
|
|
|
5160
5531
|
_classCallCheck(this, WebsyChart);
|
|
5161
5532
|
|
|
@@ -5204,22 +5575,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5204
5575
|
this.invertOverride = function (input, input2) {
|
|
5205
5576
|
var xAxis = 'bottomAxis';
|
|
5206
5577
|
|
|
5207
|
-
if (
|
|
5578
|
+
if (_this35.options.orientation === 'horizontal') {
|
|
5208
5579
|
xAxis = 'leftAxis';
|
|
5209
5580
|
}
|
|
5210
5581
|
|
|
5211
|
-
var width =
|
|
5582
|
+
var width = _this35[xAxis].step();
|
|
5212
5583
|
|
|
5213
5584
|
var output;
|
|
5214
5585
|
|
|
5215
|
-
var domain = _toConsumableArray(
|
|
5586
|
+
var domain = _toConsumableArray(_this35[xAxis].domain());
|
|
5216
5587
|
|
|
5217
|
-
if (
|
|
5588
|
+
if (_this35.options.orientation === 'horizontal') {
|
|
5218
5589
|
domain = domain.reverse();
|
|
5219
5590
|
}
|
|
5220
5591
|
|
|
5221
5592
|
for (var j = 0; j < domain.length; j++) {
|
|
5222
|
-
var breakA =
|
|
5593
|
+
var breakA = _this35[xAxis](domain[j]) - width / 2;
|
|
5223
5594
|
var breakB = breakA + width;
|
|
5224
5595
|
|
|
5225
5596
|
if (input > breakA && input <= breakB) {
|
|
@@ -5319,10 +5690,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5319
5690
|
}, {
|
|
5320
5691
|
key: "handleEventMouseMove",
|
|
5321
5692
|
value: function handleEventMouseMove(event, d) {
|
|
5322
|
-
var
|
|
5693
|
+
var _this36 = this;
|
|
5323
5694
|
|
|
5324
5695
|
var bisectDate = d3.bisector(function (d) {
|
|
5325
|
-
return
|
|
5696
|
+
return _this36.parseX(d.x.value);
|
|
5326
5697
|
}).left;
|
|
5327
5698
|
|
|
5328
5699
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -5361,8 +5732,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5361
5732
|
}
|
|
5362
5733
|
|
|
5363
5734
|
this.options.data.series.forEach(function (s) {
|
|
5364
|
-
if (
|
|
5365
|
-
xPoint =
|
|
5735
|
+
if (_this36.options.data[xData].scale !== 'Time') {
|
|
5736
|
+
xPoint = _this36[xAxis](_this36.parseX(xLabel));
|
|
5366
5737
|
s.data.forEach(function (d) {
|
|
5367
5738
|
if (d.x.value === xLabel) {
|
|
5368
5739
|
if (!tooltipTitle) {
|
|
@@ -5381,13 +5752,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5381
5752
|
var pointA = s.data[index - 1];
|
|
5382
5753
|
var pointB = s.data[index];
|
|
5383
5754
|
|
|
5384
|
-
if (
|
|
5755
|
+
if (_this36.options.orientation === 'horizontal') {
|
|
5385
5756
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
5386
5757
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
5387
5758
|
}
|
|
5388
5759
|
|
|
5389
5760
|
if (pointA && !pointB) {
|
|
5390
|
-
xPoint =
|
|
5761
|
+
xPoint = _this36[xAxis](_this36.parseX(pointA.x.value));
|
|
5391
5762
|
tooltipTitle = pointA.x.value;
|
|
5392
5763
|
|
|
5393
5764
|
if (!pointA.y.color) {
|
|
@@ -5397,12 +5768,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5397
5768
|
tooltipData.push(pointA.y);
|
|
5398
5769
|
|
|
5399
5770
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
5400
|
-
tooltipTitle = d3.timeFormat(
|
|
5771
|
+
tooltipTitle = d3.timeFormat(_this36.options.dateFormat || _this36.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
5401
5772
|
}
|
|
5402
5773
|
}
|
|
5403
5774
|
|
|
5404
5775
|
if (pointB && !pointA) {
|
|
5405
|
-
xPoint =
|
|
5776
|
+
xPoint = _this36[xAxis](_this36.parseX(pointB.x.value));
|
|
5406
5777
|
tooltipTitle = pointB.x.value;
|
|
5407
5778
|
|
|
5408
5779
|
if (!pointB.y.color) {
|
|
@@ -5412,14 +5783,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5412
5783
|
tooltipData.push(pointB.y);
|
|
5413
5784
|
|
|
5414
5785
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5415
|
-
tooltipTitle = d3.timeFormat(
|
|
5786
|
+
tooltipTitle = d3.timeFormat(_this36.options.dateFormat || _this36.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5416
5787
|
}
|
|
5417
5788
|
}
|
|
5418
5789
|
|
|
5419
5790
|
if (pointA && pointB) {
|
|
5420
|
-
var d0 =
|
|
5791
|
+
var d0 = _this36[xAxis](_this36.parseX(pointA.x.value));
|
|
5421
5792
|
|
|
5422
|
-
var d1 =
|
|
5793
|
+
var d1 = _this36[xAxis](_this36.parseX(pointB.x.value));
|
|
5423
5794
|
|
|
5424
5795
|
var mid = Math.abs(d0 - d1) / 2;
|
|
5425
5796
|
|
|
@@ -5428,7 +5799,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5428
5799
|
tooltipTitle = pointB.x.value;
|
|
5429
5800
|
|
|
5430
5801
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5431
|
-
tooltipTitle = d3.timeFormat(
|
|
5802
|
+
tooltipTitle = d3.timeFormat(_this36.options.dateFormat || _this36.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5432
5803
|
}
|
|
5433
5804
|
|
|
5434
5805
|
if (!pointB.y.color) {
|
|
@@ -5441,7 +5812,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5441
5812
|
tooltipTitle = pointA.x.value;
|
|
5442
5813
|
|
|
5443
5814
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5444
|
-
tooltipTitle = d3.timeFormat(
|
|
5815
|
+
tooltipTitle = d3.timeFormat(_this36.options.dateFormat || _this36.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5445
5816
|
}
|
|
5446
5817
|
|
|
5447
5818
|
if (!pointA.y.color) {
|
|
@@ -5546,7 +5917,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5546
5917
|
}, {
|
|
5547
5918
|
key: "render",
|
|
5548
5919
|
value: function render(options) {
|
|
5549
|
-
var
|
|
5920
|
+
var _this37 = this;
|
|
5550
5921
|
|
|
5551
5922
|
/* global d3 options WebsyUtils */
|
|
5552
5923
|
if (typeof options !== 'undefined') {
|
|
@@ -5615,7 +5986,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5615
5986
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
5616
5987
|
return {
|
|
5617
5988
|
value: s.label || s.key,
|
|
5618
|
-
color: s.color ||
|
|
5989
|
+
color: s.color || _this37.options.colors[i % _this37.options.colors.length]
|
|
5619
5990
|
};
|
|
5620
5991
|
});
|
|
5621
5992
|
|
|
@@ -5867,7 +6238,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5867
6238
|
|
|
5868
6239
|
if (this.options.data.bottom.formatter) {
|
|
5869
6240
|
bAxisFunc.tickFormat(function (d) {
|
|
5870
|
-
return
|
|
6241
|
+
return _this37.options.data.bottom.formatter(d);
|
|
5871
6242
|
});
|
|
5872
6243
|
}
|
|
5873
6244
|
|
|
@@ -5893,8 +6264,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5893
6264
|
|
|
5894
6265
|
if (this.options.margin.axisLeft > 0) {
|
|
5895
6266
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
5896
|
-
if (
|
|
5897
|
-
d =
|
|
6267
|
+
if (_this37.options.data.left.formatter) {
|
|
6268
|
+
d = _this37.options.data.left.formatter(d);
|
|
5898
6269
|
}
|
|
5899
6270
|
|
|
5900
6271
|
return d;
|
|
@@ -5931,8 +6302,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5931
6302
|
|
|
5932
6303
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
5933
6304
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
5934
|
-
if (
|
|
5935
|
-
d =
|
|
6305
|
+
if (_this37.options.data.right.formatter) {
|
|
6306
|
+
d = _this37.options.data.right.formatter(d);
|
|
5936
6307
|
}
|
|
5937
6308
|
|
|
5938
6309
|
return d;
|
|
@@ -5958,16 +6329,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5958
6329
|
|
|
5959
6330
|
this.options.data.series.forEach(function (series, index) {
|
|
5960
6331
|
if (!series.key) {
|
|
5961
|
-
series.key =
|
|
6332
|
+
series.key = _this37.createIdentity();
|
|
5962
6333
|
}
|
|
5963
6334
|
|
|
5964
6335
|
if (!series.color) {
|
|
5965
|
-
series.color =
|
|
6336
|
+
series.color = _this37.options.colors[index % _this37.options.colors.length];
|
|
5966
6337
|
}
|
|
5967
6338
|
|
|
5968
|
-
|
|
6339
|
+
_this37["render".concat(series.type || 'bar')](series, index);
|
|
5969
6340
|
|
|
5970
|
-
|
|
6341
|
+
_this37.renderLabels(series, index);
|
|
5971
6342
|
});
|
|
5972
6343
|
}
|
|
5973
6344
|
}
|
|
@@ -5975,17 +6346,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5975
6346
|
}, {
|
|
5976
6347
|
key: "renderarea",
|
|
5977
6348
|
value: function renderarea(series, index) {
|
|
5978
|
-
var
|
|
6349
|
+
var _this38 = this;
|
|
5979
6350
|
|
|
5980
6351
|
/* global d3 series index */
|
|
5981
6352
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
5982
6353
|
return d3.area().x(function (d) {
|
|
5983
|
-
return
|
|
6354
|
+
return _this38[xAxis](_this38.parseX(d.x.value));
|
|
5984
6355
|
}).y0(function (d) {
|
|
5985
|
-
return
|
|
6356
|
+
return _this38[yAxis](0);
|
|
5986
6357
|
}).y1(function (d) {
|
|
5987
|
-
return
|
|
5988
|
-
}).curve(d3[curveStyle ||
|
|
6358
|
+
return _this38[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6359
|
+
}).curve(d3[curveStyle || _this38.options.curveStyle]);
|
|
5989
6360
|
};
|
|
5990
6361
|
|
|
5991
6362
|
var xAxis = 'bottomAxis';
|
|
@@ -6160,15 +6531,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6160
6531
|
}, {
|
|
6161
6532
|
key: "renderline",
|
|
6162
6533
|
value: function renderline(series, index) {
|
|
6163
|
-
var
|
|
6534
|
+
var _this39 = this;
|
|
6164
6535
|
|
|
6165
6536
|
/* global series index d3 */
|
|
6166
6537
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
6167
6538
|
return d3.line().x(function (d) {
|
|
6168
|
-
return
|
|
6539
|
+
return _this39[xAxis](_this39.parseX(d.x.value));
|
|
6169
6540
|
}).y(function (d) {
|
|
6170
|
-
return
|
|
6171
|
-
}).curve(d3[curveStyle ||
|
|
6541
|
+
return _this39[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6542
|
+
}).curve(d3[curveStyle || _this39.options.curveStyle]);
|
|
6172
6543
|
};
|
|
6173
6544
|
|
|
6174
6545
|
var xAxis = 'bottomAxis';
|
|
@@ -6206,14 +6577,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6206
6577
|
}, {
|
|
6207
6578
|
key: "rendersymbol",
|
|
6208
6579
|
value: function rendersymbol(series, index) {
|
|
6209
|
-
var
|
|
6580
|
+
var _this40 = this;
|
|
6210
6581
|
|
|
6211
6582
|
/* global d3 series index series.key */
|
|
6212
6583
|
var drawSymbol = function drawSymbol(size) {
|
|
6213
6584
|
return d3.symbol() // .type(d => {
|
|
6214
6585
|
// return d3.symbols[0]
|
|
6215
6586
|
// })
|
|
6216
|
-
.size(size ||
|
|
6587
|
+
.size(size || _this40.options.symbolSize);
|
|
6217
6588
|
};
|
|
6218
6589
|
|
|
6219
6590
|
var xAxis = 'bottomAxis';
|
|
@@ -6231,7 +6602,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6231
6602
|
symbols.attr('d', function (d) {
|
|
6232
6603
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
6233
6604
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
6234
|
-
return "translate(".concat(
|
|
6605
|
+
return "translate(".concat(_this40[xAxis](_this40.parseX(d.x.value)), ", ").concat(_this40[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
6235
6606
|
}); // Enter
|
|
6236
6607
|
|
|
6237
6608
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -6240,7 +6611,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6240
6611
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
6241
6612
|
return "symbol symbol_".concat(series.key);
|
|
6242
6613
|
}).attr('transform', function (d) {
|
|
6243
|
-
return "translate(".concat(
|
|
6614
|
+
return "translate(".concat(_this40[xAxis](_this40.parseX(d.x.value)), ", ").concat(_this40[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
6244
6615
|
});
|
|
6245
6616
|
}
|
|
6246
6617
|
}, {
|
|
@@ -6395,7 +6766,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6395
6766
|
}, {
|
|
6396
6767
|
key: "resize",
|
|
6397
6768
|
value: function resize() {
|
|
6398
|
-
var
|
|
6769
|
+
var _this41 = this;
|
|
6399
6770
|
|
|
6400
6771
|
var el = document.getElementById(this.elementId);
|
|
6401
6772
|
|
|
@@ -6408,7 +6779,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6408
6779
|
// }
|
|
6409
6780
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
6410
6781
|
html += this._data.map(function (d, i) {
|
|
6411
|
-
return
|
|
6782
|
+
return _this41.getLegendItemHTML(d);
|
|
6412
6783
|
}).join('');
|
|
6413
6784
|
html += "\n <div>\n ";
|
|
6414
6785
|
el.innerHTML = html;
|
|
@@ -6556,8 +6927,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6556
6927
|
var el = document.getElementById(this.elementId);
|
|
6557
6928
|
|
|
6558
6929
|
if (el) {
|
|
6559
|
-
if (typeof d3 === 'undefined') {
|
|
6560
|
-
console.error('d3 library has not been loaded');
|
|
6930
|
+
if (typeof d3 === 'undefined') {// console.error('d3 library has not been loaded')
|
|
6561
6931
|
}
|
|
6562
6932
|
|
|
6563
6933
|
if (typeof L === 'undefined') {
|
|
@@ -6581,7 +6951,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6581
6951
|
}, {
|
|
6582
6952
|
key: "render",
|
|
6583
6953
|
value: function render() {
|
|
6584
|
-
var
|
|
6954
|
+
var _this42 = this;
|
|
6585
6955
|
|
|
6586
6956
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
6587
6957
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -6590,7 +6960,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6590
6960
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
6591
6961
|
return {
|
|
6592
6962
|
value: s.label || s.key,
|
|
6593
|
-
color: s.color ||
|
|
6963
|
+
color: s.color || _this42.options.colors[i % _this42.options.colors.length]
|
|
6594
6964
|
};
|
|
6595
6965
|
});
|
|
6596
6966
|
var longestValue = legendData.map(function (s) {
|
|
@@ -6654,7 +7024,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6654
7024
|
|
|
6655
7025
|
if (this.polygons) {
|
|
6656
7026
|
this.polygons.forEach(function (p) {
|
|
6657
|
-
return
|
|
7027
|
+
return _this42.map.removeLayer(p);
|
|
6658
7028
|
});
|
|
6659
7029
|
}
|
|
6660
7030
|
|
|
@@ -6712,18 +7082,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6712
7082
|
}
|
|
6713
7083
|
|
|
6714
7084
|
if (!p.options.color) {
|
|
6715
|
-
p.options.color =
|
|
7085
|
+
p.options.color = _this42.options.colors[i % _this42.options.colors.length];
|
|
6716
7086
|
}
|
|
6717
7087
|
|
|
6718
7088
|
var pol = L.polygon(p.data.map(function (c) {
|
|
6719
7089
|
return c.map(function (d) {
|
|
6720
7090
|
return [d.Latitude, d.Longitude];
|
|
6721
7091
|
});
|
|
6722
|
-
}), p.options).addTo(
|
|
7092
|
+
}), p.options).addTo(_this42.map);
|
|
6723
7093
|
|
|
6724
|
-
|
|
7094
|
+
_this42.polygons.push(pol);
|
|
6725
7095
|
|
|
6726
|
-
|
|
7096
|
+
_this42.map.fitBounds(pol.getBounds());
|
|
6727
7097
|
});
|
|
6728
7098
|
} // if (this.data.markers.length > 0) {
|
|
6729
7099
|
// el.classList.remove('hidden')
|
|
@@ -6882,7 +7252,9 @@ var WebsyDesigns = {
|
|
|
6882
7252
|
WebsyLogin: WebsyLogin,
|
|
6883
7253
|
Login: WebsyLogin,
|
|
6884
7254
|
WebsySignup: WebsySignup,
|
|
6885
|
-
Signup: WebsySignup
|
|
7255
|
+
Signup: WebsySignup,
|
|
7256
|
+
ResponsiveText: ResponsiveText,
|
|
7257
|
+
WebsyResponsiveText: ResponsiveText
|
|
6886
7258
|
};
|
|
6887
7259
|
WebsyDesigns.service = new WebsyDesigns.APIService('');
|
|
6888
7260
|
var GlobalPubSub = new WebsyPubSub('empty', {});
|