@websy/websy-designs 1.2.5 → 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/server/websy-designs-server.js +4 -4
- package/dist/websy-designs-es6.debug.js +564 -31
- package/dist/websy-designs-es6.js +693 -253
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +519 -30
- package/dist/websy-designs.js +678 -225
- 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
|
|
|
@@ -489,16 +490,25 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
489
490
|
this.currentselection = [];
|
|
490
491
|
this.validDates = [];
|
|
491
492
|
this.validYears = [];
|
|
493
|
+
this.validHours = [];
|
|
492
494
|
this.customRangeSelected = true;
|
|
493
495
|
this.shiftPressed = false;
|
|
494
496
|
var DEFAULTS = {
|
|
495
497
|
defaultRange: 0,
|
|
496
498
|
allowClear: true,
|
|
499
|
+
hideRanges: false,
|
|
497
500
|
minAllowedDate: this.floorDate(new Date(new Date(new Date().setFullYear(new Date().getFullYear() - 1)).setDate(1))),
|
|
498
501
|
maxAllowedDate: this.floorDate(new Date(new Date())),
|
|
499
502
|
minAllowedYear: 1970,
|
|
500
503
|
maxAllowedYear: new Date().getFullYear(),
|
|
501
504
|
daysOfWeek: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
|
|
505
|
+
monthsOfYear: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
506
|
+
hours: new Array(24).fill(0).map(function (d, i) {
|
|
507
|
+
return {
|
|
508
|
+
text: (i < 10 ? '0' : '') + i + ':00',
|
|
509
|
+
num: 1 / 24 * i
|
|
510
|
+
};
|
|
511
|
+
}),
|
|
502
512
|
mode: 'date',
|
|
503
513
|
monthMap: {
|
|
504
514
|
0: 'Jan',
|
|
@@ -551,6 +561,23 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
551
561
|
}, {
|
|
552
562
|
label: 'Last 10 Years',
|
|
553
563
|
range: [new Date().getFullYear() - 9, DEFAULTS.maxAllowedYear]
|
|
564
|
+
}],
|
|
565
|
+
monthyear: [{
|
|
566
|
+
label: 'All',
|
|
567
|
+
range: [DEFAULTS.minAllowedDate, DEFAULTS.maxAllowedDate]
|
|
568
|
+
}, {
|
|
569
|
+
label: 'Last 12 Months',
|
|
570
|
+
range: [this.floorDate(new Date(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() - 12))), this.floorDate(new Date(new Date().setDate(1)))]
|
|
571
|
+
}, {
|
|
572
|
+
label: 'Last 18 Months',
|
|
573
|
+
range: [this.floorDate(new Date(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() - 18))), this.floorDate(new Date(new Date().setDate(1)))]
|
|
574
|
+
}, {
|
|
575
|
+
label: 'Last 24 Months',
|
|
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)))]
|
|
577
|
+
}],
|
|
578
|
+
hour: [{
|
|
579
|
+
label: 'All',
|
|
580
|
+
range: ['00:00', '23:00']
|
|
554
581
|
}]
|
|
555
582
|
};
|
|
556
583
|
this.options = _extends({}, DEFAULTS, options);
|
|
@@ -575,13 +602,13 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
575
602
|
el.addEventListener('mouseup', this.handleMouseUp.bind(this));
|
|
576
603
|
document.addEventListener('keydown', this.handleKeyDown.bind(this));
|
|
577
604
|
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 ");
|
|
605
|
+
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
606
|
|
|
580
607
|
if (this.options.allowClear === true) {
|
|
581
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 ";
|
|
582
609
|
}
|
|
583
610
|
|
|
584
|
-
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 ");
|
|
585
612
|
el.innerHTML = html;
|
|
586
613
|
this.render();
|
|
587
614
|
} else {
|
|
@@ -592,6 +619,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
592
619
|
_createClass(WebsyDatePicker, [{
|
|
593
620
|
key: "close",
|
|
594
621
|
value: function close(confirm) {
|
|
622
|
+
var _this4 = this;
|
|
623
|
+
|
|
595
624
|
var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
|
|
596
625
|
var contentEl = document.getElementById("".concat(this.elementId, "_content"));
|
|
597
626
|
var el = document.getElementById(this.elementId);
|
|
@@ -605,10 +634,31 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
605
634
|
|
|
606
635
|
if (confirm === true) {
|
|
607
636
|
if (this.options.onChange) {
|
|
637
|
+
console.log('confirm', this.selectedRangeDates);
|
|
638
|
+
console.log('confirm', this.currentselection);
|
|
639
|
+
|
|
608
640
|
if (this.customRangeSelected === true) {
|
|
609
|
-
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
|
+
}
|
|
610
652
|
} else {
|
|
611
|
-
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
|
+
}
|
|
612
662
|
}
|
|
613
663
|
}
|
|
614
664
|
|
|
@@ -678,7 +728,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
678
728
|
value: function handleMouseDown(event) {
|
|
679
729
|
if (this.shiftPressed === true && this.currentselection.length > 0) {
|
|
680
730
|
this.mouseDownId = this.currentselection[this.currentselection.length - 1];
|
|
681
|
-
this.selectDate(+event.target.id.split('_')[
|
|
731
|
+
this.selectDate(+event.target.id.split('_')[1]);
|
|
682
732
|
} else {
|
|
683
733
|
this.mouseDown = true;
|
|
684
734
|
this.dragging = false;
|
|
@@ -693,7 +743,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
693
743
|
this.customRangeSelected = false;
|
|
694
744
|
}
|
|
695
745
|
|
|
696
|
-
this.mouseDownId = +event.target.id.split('_')[
|
|
746
|
+
this.mouseDownId = +event.target.id.split('_')[1];
|
|
697
747
|
this.selectDate(this.mouseDownId);
|
|
698
748
|
}
|
|
699
749
|
}
|
|
@@ -707,9 +757,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
707
757
|
return;
|
|
708
758
|
}
|
|
709
759
|
|
|
710
|
-
if (event.target.id.split('_')[
|
|
760
|
+
if (event.target.id.split('_')[1] !== this.mouseDownId) {
|
|
711
761
|
this.dragging = true;
|
|
712
|
-
this.selectDate(+event.target.id.split('_')[
|
|
762
|
+
this.selectDate(+event.target.id.split('_')[1]);
|
|
713
763
|
}
|
|
714
764
|
}
|
|
715
765
|
}
|
|
@@ -724,7 +774,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
724
774
|
}, {
|
|
725
775
|
key: "highlightRange",
|
|
726
776
|
value: function highlightRange() {
|
|
727
|
-
var
|
|
777
|
+
var _this5 = this;
|
|
728
778
|
|
|
729
779
|
var el = document.getElementById("".concat(this.elementId, "_dateList"));
|
|
730
780
|
var dateEls = el.querySelectorAll('.websy-dp-date');
|
|
@@ -741,6 +791,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
741
791
|
|
|
742
792
|
if (this.customRangeSelected === true) {
|
|
743
793
|
console.log('if date selection', this.currentselection);
|
|
794
|
+
console.log('if month selection', this.currentselection.map(function (d) {
|
|
795
|
+
return new Date(d);
|
|
796
|
+
}));
|
|
744
797
|
var diff;
|
|
745
798
|
|
|
746
799
|
if (this.options.mode === 'date') {
|
|
@@ -752,6 +805,13 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
752
805
|
|
|
753
806
|
if (this.selectedRangeDates[this.selectedRangeDates.length - 1] !== this.selectedRangeDates[0]) {// diff += 1
|
|
754
807
|
}
|
|
808
|
+
} else if (this.options.mode === 'monthyear') {
|
|
809
|
+
var yearDiff = (this.selectedRangeDates[this.selectedRangeDates.length - 1].getFullYear() - this.selectedRangeDates[0].getFullYear()) * 12;
|
|
810
|
+
diff = Math.floor(this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth() - this.selectedRangeDates[0].getMonth()) + yearDiff;
|
|
811
|
+
console.log('year diff', yearDiff);
|
|
812
|
+
console.log('diff', diff);
|
|
813
|
+
} else if (this.options.mode === 'hour') {
|
|
814
|
+
diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
|
|
755
815
|
}
|
|
756
816
|
|
|
757
817
|
for (var _i = 0; _i < diff + 1; _i++) {
|
|
@@ -768,14 +828,29 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
768
828
|
d = this.selectedRangeDates[0] + _i;
|
|
769
829
|
rangeStart = this.selectedRangeDates[0];
|
|
770
830
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
831
|
+
} else if (this.options.mode === 'monthyear') {
|
|
832
|
+
d = new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + _i);
|
|
833
|
+
rangeStart = this.selectedRangeDates[0].getTime();
|
|
834
|
+
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
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];
|
|
771
839
|
}
|
|
772
840
|
|
|
773
841
|
var dateEl = void 0;
|
|
774
842
|
|
|
775
843
|
if (this.options.mode === 'date') {
|
|
776
|
-
dateEl = document.getElementById("".concat(d, "_date"));
|
|
844
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_date"));
|
|
777
845
|
} else if (this.options.mode === 'year') {
|
|
778
|
-
dateEl = document.getElementById("".concat(d, "_year"));
|
|
846
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_year"));
|
|
847
|
+
} else if (this.options.mode === 'monthyear') {
|
|
848
|
+
console.log('d', d);
|
|
849
|
+
console.log(this.selectedRangeDates);
|
|
850
|
+
console.log(rangeStart, rangeEnd);
|
|
851
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_monthyear"));
|
|
852
|
+
} else if (this.options.mode === 'hour') {
|
|
853
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_hour"));
|
|
779
854
|
}
|
|
780
855
|
|
|
781
856
|
if (dateEl) {
|
|
@@ -794,10 +869,14 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
794
869
|
this.currentselection.forEach(function (d) {
|
|
795
870
|
var dateEl;
|
|
796
871
|
|
|
797
|
-
if (
|
|
798
|
-
dateEl = document.getElementById("".concat(d, "_date"));
|
|
799
|
-
} else if (
|
|
800
|
-
dateEl = document.getElementById("".concat(d, "_year"));
|
|
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"));
|
|
801
880
|
}
|
|
802
881
|
|
|
803
882
|
dateEl.classList.add('selected');
|
|
@@ -851,17 +930,23 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
851
930
|
}, {
|
|
852
931
|
key: "renderDates",
|
|
853
932
|
value: function renderDates(disabledDates) {
|
|
854
|
-
var
|
|
933
|
+
var _this6 = this;
|
|
855
934
|
|
|
856
935
|
var disabled = [];
|
|
857
936
|
this.validDates = [];
|
|
858
937
|
this.validYears = [];
|
|
938
|
+
this.validHours = [];
|
|
939
|
+
this.monthYears = {};
|
|
940
|
+
this.monthYearMonths = [];
|
|
859
941
|
|
|
860
942
|
if (disabledDates) {
|
|
861
943
|
disabled = disabledDates.map(function (d) {
|
|
862
|
-
if (
|
|
944
|
+
if (_this6.options.mode === 'date') {
|
|
863
945
|
return d.getTime();
|
|
864
|
-
} 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') {
|
|
865
950
|
return d;
|
|
866
951
|
}
|
|
867
952
|
|
|
@@ -879,13 +964,17 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
879
964
|
diff = Math.ceil((this.options.maxAllowedDate.getTime() - this.options.minAllowedDate.getTime()) / this.oneDay) + 1;
|
|
880
965
|
} else if (this.options.mode === 'year') {
|
|
881
966
|
diff = this.options.maxAllowedYear - this.options.minAllowedYear + 1;
|
|
967
|
+
} else if (this.options.mode === 'monthyear') {
|
|
968
|
+
diff = Math.ceil((this.options.maxAllowedDate.getTime() - this.options.minAllowedDate.getTime()) / this.oneDay) + 1;
|
|
969
|
+
} else if (this.options.mode === 'hour') {
|
|
970
|
+
diff = 24;
|
|
882
971
|
}
|
|
883
972
|
|
|
884
973
|
var months = {};
|
|
885
974
|
var yearList = [];
|
|
886
975
|
|
|
887
976
|
for (var i = 0; i < diff; i++) {
|
|
888
|
-
if (this.options.mode === 'date') {
|
|
977
|
+
if (this.options.mode === 'date' || this.options.mode === 'monthyear') {
|
|
889
978
|
var d = this.floorDate(new Date(this.options.minAllowedDate.getTime() + i * this.oneDay));
|
|
890
979
|
var monthYear = "".concat(this.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
891
980
|
|
|
@@ -893,6 +982,21 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
893
982
|
months[monthYear] = [];
|
|
894
983
|
}
|
|
895
984
|
|
|
985
|
+
if (!this.monthYears[d.getFullYear()]) {
|
|
986
|
+
this.monthYears[d.getFullYear()] = [];
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
if (this.monthYearMonths.indexOf("".concat(d.getMonth(), "-").concat(d.getFullYear())) === -1) {
|
|
990
|
+
this.monthYearMonths.push("".concat(d.getMonth(), "-").concat(d.getFullYear()));
|
|
991
|
+
this.monthYears[d.getFullYear()].push({
|
|
992
|
+
date: new Date(d.setDate(1)),
|
|
993
|
+
month: this.options.monthMap[d.getMonth()],
|
|
994
|
+
monthNum: d.getMonth(),
|
|
995
|
+
year: d.getFullYear(),
|
|
996
|
+
id: d.setDate(1)
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
|
|
896
1000
|
if (disabled.indexOf(d.getTime()) === -1) {
|
|
897
1001
|
this.validDates.push(d.getTime());
|
|
898
1002
|
}
|
|
@@ -916,14 +1020,23 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
916
1020
|
if (disabled.indexOf(_d) === -1) {
|
|
917
1021
|
this.validYears.push(_d);
|
|
918
1022
|
}
|
|
1023
|
+
} else if (this.options.mode === 'hour') {//
|
|
919
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
|
+
});
|
|
920
1033
|
} // check each range to see if it can be enabled
|
|
921
1034
|
|
|
922
1035
|
|
|
923
1036
|
for (var _i2 = 0; _i2 < this.options.ranges[this.options.mode].length; _i2++) {
|
|
924
1037
|
var r = this.options.ranges[this.options.mode][_i2];
|
|
925
1038
|
|
|
926
|
-
if (this.options.mode === 'date') {
|
|
1039
|
+
if (this.options.mode === 'date' || this.options.mode === 'monthyear') {
|
|
927
1040
|
// check the first date
|
|
928
1041
|
if (this.validDates.indexOf(r.range[0].getTime()) !== -1) {
|
|
929
1042
|
r.disabled = false;
|
|
@@ -959,6 +1072,23 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
959
1072
|
}
|
|
960
1073
|
}
|
|
961
1074
|
}
|
|
1075
|
+
} else if (this.options.mode === 'monthyear') {//
|
|
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
|
+
}
|
|
962
1092
|
}
|
|
963
1093
|
}
|
|
964
1094
|
|
|
@@ -977,7 +1107,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
977
1107
|
if (months[key][0].dayOfWeek > 0) {
|
|
978
1108
|
var paddedDays = [];
|
|
979
1109
|
|
|
980
|
-
for (var
|
|
1110
|
+
for (var _i6 = 0; _i6 < months[key][0].dayOfWeek; _i6++) {
|
|
981
1111
|
paddedDays.push("<li> </li>");
|
|
982
1112
|
}
|
|
983
1113
|
|
|
@@ -985,7 +1115,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
985
1115
|
}
|
|
986
1116
|
|
|
987
1117
|
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>");
|
|
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>");
|
|
989
1119
|
}).join('');
|
|
990
1120
|
html += "\n </ul>\n </div>\n ";
|
|
991
1121
|
}
|
|
@@ -998,7 +1128,36 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
998
1128
|
|
|
999
1129
|
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'><ul>");
|
|
1000
1130
|
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>");
|
|
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>");
|
|
1132
|
+
}).join('');
|
|
1133
|
+
html += "</ul></div>";
|
|
1134
|
+
} else if (this.options.mode === 'monthyear') {
|
|
1135
|
+
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-monthyear-container'>");
|
|
1136
|
+
|
|
1137
|
+
for (var year in this.monthYears) {
|
|
1138
|
+
html += "\n <ul>\n <li>".concat(year, "</li>\n ");
|
|
1139
|
+
|
|
1140
|
+
if (this.monthYears[year][0].monthNum > 0) {
|
|
1141
|
+
var paddedMonths = [];
|
|
1142
|
+
|
|
1143
|
+
for (var _i7 = 0; _i7 < this.monthYears[year][0].monthNum; _i7++) {
|
|
1144
|
+
paddedMonths.push("<li> </li>");
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
html += paddedMonths.join('');
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
html += this.monthYears[year].map(function (d) {
|
|
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>");
|
|
1152
|
+
}).join('');
|
|
1153
|
+
html += "</ul>";
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
html += "</div>";
|
|
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>");
|
|
1002
1161
|
}).join('');
|
|
1003
1162
|
html += "</ul></div>";
|
|
1004
1163
|
}
|
|
@@ -1008,10 +1167,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1008
1167
|
}, {
|
|
1009
1168
|
key: "renderRanges",
|
|
1010
1169
|
value: function renderRanges() {
|
|
1011
|
-
var
|
|
1170
|
+
var _this7 = this;
|
|
1012
1171
|
|
|
1013
1172
|
return this.options.ranges[this.options.mode].map(function (r, i) {
|
|
1014
|
-
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 ");
|
|
1015
1174
|
}).join('') + "<li data-index='-1' class='websy-date-picker-range ".concat(this.selectedRange === -1 ? 'active' : '', "'>Custom</li>");
|
|
1016
1175
|
}
|
|
1017
1176
|
}, {
|
|
@@ -1021,13 +1180,15 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1021
1180
|
var el;
|
|
1022
1181
|
|
|
1023
1182
|
if (this.options.mode === 'date') {
|
|
1024
|
-
el = document.getElementById("".concat(this.selectedRangeDates[0].getTime(), "_date"));
|
|
1183
|
+
el = document.getElementById("".concat(this.elementId, "_").concat(this.selectedRangeDates[0].getTime(), "_date"));
|
|
1025
1184
|
} else if (this.options.mode === 'year') {
|
|
1026
1185
|
if (this.options.sortDirection === 'desc') {
|
|
1027
|
-
el = document.getElementById("".concat(this.selectedRangeDates[this.selectedRangeDates.length - 1], "_year"));
|
|
1186
|
+
el = document.getElementById("".concat(this.elementId, "_").concat(this.selectedRangeDates[this.selectedRangeDates.length - 1], "_year"));
|
|
1028
1187
|
} else {
|
|
1029
|
-
el = document.getElementById("".concat(this.selectedRangeDates[0], "_year"));
|
|
1188
|
+
el = document.getElementById("".concat(this.elementId, "_").concat(this.selectedRangeDates[0], "_year"));
|
|
1030
1189
|
}
|
|
1190
|
+
} else if (this.options.mode === 'monthyear') {//
|
|
1191
|
+
} else if (this.options.mode === 'hour') {//
|
|
1031
1192
|
}
|
|
1032
1193
|
|
|
1033
1194
|
var parentEl = document.getElementById("".concat(this.elementId, "_dateList"));
|
|
@@ -1053,8 +1214,16 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1053
1214
|
}
|
|
1054
1215
|
|
|
1055
1216
|
this.customRangeSelected = true;
|
|
1217
|
+
console.log('current selection', this.currentselection);
|
|
1056
1218
|
} else {
|
|
1057
|
-
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
|
+
|
|
1058
1227
|
this.currentselection.sort(function (a, b) {
|
|
1059
1228
|
return a - b;
|
|
1060
1229
|
});
|
|
@@ -1062,10 +1231,14 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1062
1231
|
}
|
|
1063
1232
|
}
|
|
1064
1233
|
|
|
1065
|
-
if (this.options.mode === 'date') {
|
|
1234
|
+
if (this.options.mode === 'date' || this.options.mode === 'monthyear') {
|
|
1066
1235
|
this.selectedRangeDates = [new Date(this.currentselection[0]), new Date(this.currentselection[1] || this.currentselection[0])];
|
|
1236
|
+
console.log('selected range', this.selectedRangeDates);
|
|
1067
1237
|
} else if (this.options.mode === 'year') {
|
|
1068
1238
|
this.selectedRangeDates = [this.currentselection[0], this.currentselection[1] || this.currentselection[0]];
|
|
1239
|
+
} else if (this.options.mode === 'monthyear') {//
|
|
1240
|
+
} else if (this.options.mode === 'hour') {
|
|
1241
|
+
this.selectedRangeDates = [this.currentselection[0], this.currentselection[1] || this.currentselection[0]];
|
|
1069
1242
|
} // if (this.currentselection.length === 2) {
|
|
1070
1243
|
// this.currentselection = []
|
|
1071
1244
|
// }
|
|
@@ -1121,7 +1294,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1121
1294
|
}, {
|
|
1122
1295
|
key: "setDateBounds",
|
|
1123
1296
|
value: function setDateBounds(range) {
|
|
1124
|
-
if (['All Dates', 'All Years'].indexOf(this.options.ranges[this.options.mode][0].label) !== -1) {
|
|
1297
|
+
if (['All Dates', 'All Years', 'All'].indexOf(this.options.ranges[this.options.mode][0].label) !== -1) {
|
|
1125
1298
|
this.options.ranges[this.options.mode][0].range = [range[0], range[1] || range[0]];
|
|
1126
1299
|
}
|
|
1127
1300
|
|
|
@@ -1131,24 +1304,38 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1131
1304
|
} else if (this.options.mode === 'year') {
|
|
1132
1305
|
this.options.minAllowedYear = range[0];
|
|
1133
1306
|
this.options.maxAllowedYear = range[1] || range[0];
|
|
1307
|
+
} else if (this.options.mode === 'monthyear') {
|
|
1308
|
+
this.options.minAllowedDate = range[0];
|
|
1309
|
+
this.options.maxAllowedDate = range[1] || range[0];
|
|
1310
|
+
} else if (this.options.mode === 'hour') {
|
|
1311
|
+
this.options.minAllowedHour = range[0];
|
|
1312
|
+
this.options.maxAllowedHour = range[1] || range[0];
|
|
1134
1313
|
}
|
|
1135
1314
|
}
|
|
1136
1315
|
}, {
|
|
1137
1316
|
key: "updateRange",
|
|
1138
1317
|
value: function updateRange() {
|
|
1139
|
-
var
|
|
1318
|
+
var _this8 = this;
|
|
1140
1319
|
|
|
1141
1320
|
var range;
|
|
1142
1321
|
|
|
1143
1322
|
if (this.selectedRange === -1) {
|
|
1144
1323
|
var list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(function (d) {
|
|
1145
|
-
if (
|
|
1324
|
+
if (_this8.options.mode === 'date') {
|
|
1146
1325
|
if (!d.toLocaleDateString) {
|
|
1147
1326
|
d = new Date(d);
|
|
1148
1327
|
}
|
|
1149
1328
|
|
|
1150
1329
|
return d.toLocaleDateString();
|
|
1151
|
-
} else if (
|
|
1330
|
+
} else if (_this8.options.mode === 'year') {
|
|
1331
|
+
return d;
|
|
1332
|
+
} else if (_this8.options.mode === 'monthyear') {
|
|
1333
|
+
if (!d.getMonth) {
|
|
1334
|
+
d = new Date(d);
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
return "".concat(_this8.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
1338
|
+
} else if (_this8.options.mode === 'hour') {
|
|
1152
1339
|
return d;
|
|
1153
1340
|
}
|
|
1154
1341
|
});
|
|
@@ -1161,6 +1348,11 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1161
1348
|
start = "".concat(list.length, " selected");
|
|
1162
1349
|
}
|
|
1163
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
|
+
|
|
1164
1356
|
range = {
|
|
1165
1357
|
label: "".concat(start).concat(end)
|
|
1166
1358
|
};
|
|
@@ -1197,7 +1389,7 @@ Date.prototype.floor = function () {
|
|
|
1197
1389
|
|
|
1198
1390
|
var WebsyDropdown = /*#__PURE__*/function () {
|
|
1199
1391
|
function WebsyDropdown(elementId, options) {
|
|
1200
|
-
var
|
|
1392
|
+
var _this9 = this;
|
|
1201
1393
|
|
|
1202
1394
|
_classCallCheck(this, WebsyDropdown);
|
|
1203
1395
|
|
|
@@ -1211,7 +1403,8 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1211
1403
|
disabled: false,
|
|
1212
1404
|
minSearchCharacters: 2,
|
|
1213
1405
|
showCompleteSelectedList: false,
|
|
1214
|
-
closeAfterSelection: true
|
|
1406
|
+
closeAfterSelection: true,
|
|
1407
|
+
customActions: []
|
|
1215
1408
|
};
|
|
1216
1409
|
this.options = _extends({}, DEFAULTS, options);
|
|
1217
1410
|
|
|
@@ -1240,12 +1433,12 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1240
1433
|
el.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
1241
1434
|
el.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
1242
1435
|
var headerLabel = this.selectedItems.map(function (s) {
|
|
1243
|
-
return
|
|
1436
|
+
return _this9.options.items[s].label || _this9.options.items[s].value;
|
|
1244
1437
|
}).join(this.options.multiValueDelimiter);
|
|
1245
1438
|
var headerValue = this.selectedItems.map(function (s) {
|
|
1246
|
-
return
|
|
1439
|
+
return _this9.options.items[s].value || _this9.options.items[s].label;
|
|
1247
1440
|
}).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 ");
|
|
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 ");
|
|
1249
1442
|
|
|
1250
1443
|
if (this.options.allowClear === true) {
|
|
1251
1444
|
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 +1446,14 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1253
1446
|
|
|
1254
1447
|
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
1448
|
|
|
1449
|
+
if (this.options.customActions.length > 0) {
|
|
1450
|
+
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 ");
|
|
1451
|
+
this.options.customActions.forEach(function (a, i) {
|
|
1452
|
+
html += "\n <li class='websy-dropdown-custom-action' data-index='".concat(i, "'>").concat(a.label, "</li>\n ");
|
|
1453
|
+
});
|
|
1454
|
+
html += "\n </ul>\n </div>\n ";
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1256
1457
|
if (this.options.disableSearch !== true) {
|
|
1257
1458
|
html += "\n <input id='".concat(this.elementId, "_search' class='websy-dropdown-search' placeholder='").concat(this.options.searchPlaceholder || 'Search', "'>\n ");
|
|
1258
1459
|
}
|
|
@@ -1286,6 +1487,12 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1286
1487
|
var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
|
|
1287
1488
|
var contentEl = document.getElementById("".concat(this.elementId, "_content"));
|
|
1288
1489
|
var scrollEl = document.getElementById("".concat(this.elementId, "_itemsContainer"));
|
|
1490
|
+
var actionEl = document.getElementById("".concat(this.elementId, "_actionContainer"));
|
|
1491
|
+
|
|
1492
|
+
if (actionEl) {
|
|
1493
|
+
actionEl.classList.remove('active');
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1289
1496
|
var el = document.getElementById(this.elementId);
|
|
1290
1497
|
|
|
1291
1498
|
if (el) {
|
|
@@ -1328,6 +1535,18 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1328
1535
|
} else if (event.target.classList.contains('search')) {
|
|
1329
1536
|
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
1330
1537
|
el.classList.toggle('search-open');
|
|
1538
|
+
} else if (event.target.classList.contains('websy-dropdown-custom-action')) {
|
|
1539
|
+
var actionIndex = +event.target.getAttribute('data-index');
|
|
1540
|
+
|
|
1541
|
+
if (this.options.customActions[actionIndex] && this.options.customActions[actionIndex].fn) {
|
|
1542
|
+
this.options.customActions[actionIndex].fn();
|
|
1543
|
+
}
|
|
1544
|
+
} else if (event.target.classList.contains('websy-dropdown-action-button')) {
|
|
1545
|
+
var _el = document.getElementById("".concat(this.elementId, "_actionContainer"));
|
|
1546
|
+
|
|
1547
|
+
if (_el) {
|
|
1548
|
+
_el.classList.toggle('active');
|
|
1549
|
+
}
|
|
1331
1550
|
}
|
|
1332
1551
|
}
|
|
1333
1552
|
}, {
|
|
@@ -1500,10 +1719,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1500
1719
|
}, {
|
|
1501
1720
|
key: "renderItems",
|
|
1502
1721
|
value: function renderItems() {
|
|
1503
|
-
var
|
|
1722
|
+
var _this10 = this;
|
|
1504
1723
|
|
|
1505
1724
|
var html = this.options.items.map(function (r, i) {
|
|
1506
|
-
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 ");
|
|
1507
1726
|
}).join('');
|
|
1508
1727
|
var el = document.getElementById("".concat(this.elementId, "_items"));
|
|
1509
1728
|
|
|
@@ -1522,7 +1741,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1522
1741
|
}, {
|
|
1523
1742
|
key: "updateHeader",
|
|
1524
1743
|
value: function updateHeader(item) {
|
|
1525
|
-
var
|
|
1744
|
+
var _this11 = this;
|
|
1526
1745
|
|
|
1527
1746
|
var el = document.getElementById(this.elementId);
|
|
1528
1747
|
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
@@ -1569,17 +1788,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1569
1788
|
} else if (this.selectedItems.length > 1) {
|
|
1570
1789
|
if (this.options.showCompleteSelectedList === true) {
|
|
1571
1790
|
var selectedLabels = this.selectedItems.map(function (s) {
|
|
1572
|
-
return
|
|
1791
|
+
return _this11.options.items[s].label || _this11.options.items[s].value;
|
|
1573
1792
|
}).join(this.options.multiValueDelimiter);
|
|
1574
1793
|
var selectedValues = this.selectedItems.map(function (s) {
|
|
1575
|
-
return
|
|
1794
|
+
return _this11.options.items[s].value || _this11.options.items[s].label;
|
|
1576
1795
|
}).join(this.options.multiValueDelimiter);
|
|
1577
1796
|
labelEl.innerHTML = selectedLabels;
|
|
1578
1797
|
labelEl.setAttribute('data-info', selectedLabels);
|
|
1579
1798
|
inputEl.value = selectedValues;
|
|
1580
1799
|
} else {
|
|
1581
1800
|
var _selectedValues = this.selectedItems.map(function (s) {
|
|
1582
|
-
return
|
|
1801
|
+
return _this11.options.items[s].value || _this11.options.items[s].label;
|
|
1583
1802
|
}).join(this.options.multiValueDelimiter);
|
|
1584
1803
|
|
|
1585
1804
|
labelEl.innerHTML = "".concat(this.selectedItems.length, " selected");
|
|
@@ -1716,16 +1935,16 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1716
1935
|
}, {
|
|
1717
1936
|
key: "checkRecaptcha",
|
|
1718
1937
|
value: function checkRecaptcha() {
|
|
1719
|
-
var
|
|
1938
|
+
var _this12 = this;
|
|
1720
1939
|
|
|
1721
1940
|
return new Promise(function (resolve, reject) {
|
|
1722
|
-
if (
|
|
1941
|
+
if (_this12.options.useRecaptcha === true) {
|
|
1723
1942
|
// if (this.recaptchaValue) {
|
|
1724
1943
|
grecaptcha.ready(function () {
|
|
1725
1944
|
grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
|
|
1726
1945
|
action: 'submit'
|
|
1727
1946
|
}).then(function (token) {
|
|
1728
|
-
|
|
1947
|
+
_this12.apiService.add('google/checkrecaptcha', {
|
|
1729
1948
|
grecaptcharesponse: token
|
|
1730
1949
|
}).then(function (response) {
|
|
1731
1950
|
if (response.success && response.success === true) {
|
|
@@ -1788,14 +2007,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1788
2007
|
}, {
|
|
1789
2008
|
key: "processComponents",
|
|
1790
2009
|
value: function processComponents(components, callbackFn) {
|
|
1791
|
-
var
|
|
2010
|
+
var _this13 = this;
|
|
1792
2011
|
|
|
1793
2012
|
if (components.length === 0) {
|
|
1794
2013
|
callbackFn();
|
|
1795
2014
|
} else {
|
|
1796
2015
|
components.forEach(function (c) {
|
|
1797
2016
|
if (typeof WebsyDesigns[c.component] !== 'undefined') {
|
|
1798
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
2017
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this13.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
1799
2018
|
} else {// some user feedback here
|
|
1800
2019
|
}
|
|
1801
2020
|
});
|
|
@@ -1816,7 +2035,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1816
2035
|
}, {
|
|
1817
2036
|
key: "render",
|
|
1818
2037
|
value: function render(update, data) {
|
|
1819
|
-
var
|
|
2038
|
+
var _this14 = this;
|
|
1820
2039
|
|
|
1821
2040
|
var el = document.getElementById(this.elementId);
|
|
1822
2041
|
var componentsToProcess = [];
|
|
@@ -1826,11 +2045,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1826
2045
|
this.options.fields.forEach(function (f, i) {
|
|
1827
2046
|
if (f.component) {
|
|
1828
2047
|
componentsToProcess.push(f);
|
|
1829
|
-
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 ");
|
|
1830
2049
|
} else if (f.type === 'longtext') {
|
|
1831
|
-
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 ");
|
|
1832
2051
|
} else {
|
|
1833
|
-
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 ");
|
|
1834
2053
|
}
|
|
1835
2054
|
});
|
|
1836
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 ");
|
|
@@ -1847,7 +2066,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1847
2066
|
|
|
1848
2067
|
el.innerHTML = html;
|
|
1849
2068
|
this.processComponents(componentsToProcess, function () {
|
|
1850
|
-
if (
|
|
2069
|
+
if (_this14.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
|
|
1851
2070
|
}
|
|
1852
2071
|
});
|
|
1853
2072
|
}
|
|
@@ -1855,7 +2074,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1855
2074
|
}, {
|
|
1856
2075
|
key: "submitForm",
|
|
1857
2076
|
value: function submitForm() {
|
|
1858
|
-
var
|
|
2077
|
+
var _this15 = this;
|
|
1859
2078
|
|
|
1860
2079
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
1861
2080
|
|
|
@@ -1869,32 +2088,32 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1869
2088
|
data[key] = value;
|
|
1870
2089
|
});
|
|
1871
2090
|
|
|
1872
|
-
if (
|
|
1873
|
-
var
|
|
2091
|
+
if (_this15.options.url) {
|
|
2092
|
+
var _this15$apiService;
|
|
1874
2093
|
|
|
1875
|
-
var params = [
|
|
2094
|
+
var params = [_this15.options.url];
|
|
1876
2095
|
|
|
1877
|
-
if (
|
|
1878
|
-
params.push(
|
|
2096
|
+
if (_this15.options.mode === 'update') {
|
|
2097
|
+
params.push(_this15.options.id);
|
|
1879
2098
|
}
|
|
1880
2099
|
|
|
1881
2100
|
params.push(data);
|
|
1882
2101
|
|
|
1883
|
-
(
|
|
1884
|
-
if (
|
|
2102
|
+
(_this15$apiService = _this15.apiService)[_this15.options.mode].apply(_this15$apiService, params).then(function (result) {
|
|
2103
|
+
if (_this15.options.clearAfterSave === true) {
|
|
1885
2104
|
// this.render()
|
|
1886
2105
|
formEl.reset();
|
|
1887
2106
|
}
|
|
1888
2107
|
|
|
1889
|
-
|
|
2108
|
+
_this15.options.onSuccess.call(_this15, result);
|
|
1890
2109
|
}, function (err) {
|
|
1891
2110
|
console.log('Error submitting form data:', err);
|
|
1892
2111
|
|
|
1893
|
-
|
|
2112
|
+
_this15.options.onError.call(_this15, err);
|
|
1894
2113
|
});
|
|
1895
|
-
} else if (
|
|
1896
|
-
|
|
1897
|
-
if (
|
|
2114
|
+
} else if (_this15.options.submitFn) {
|
|
2115
|
+
_this15.options.submitFn(data, function () {
|
|
2116
|
+
if (_this15.options.clearAfterSave === true) {
|
|
1898
2117
|
// this.render()
|
|
1899
2118
|
formEl.reset();
|
|
1900
2119
|
}
|
|
@@ -1914,17 +2133,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1914
2133
|
}, {
|
|
1915
2134
|
key: "data",
|
|
1916
2135
|
set: function set(d) {
|
|
1917
|
-
var
|
|
2136
|
+
var _this16 = this;
|
|
1918
2137
|
|
|
1919
2138
|
if (!this.options.fields) {
|
|
1920
2139
|
this.options.fields = [];
|
|
1921
2140
|
}
|
|
1922
2141
|
|
|
1923
2142
|
var _loop = function _loop(key) {
|
|
1924
|
-
|
|
2143
|
+
_this16.options.fields.forEach(function (f) {
|
|
1925
2144
|
if (f.field === key) {
|
|
1926
2145
|
f.value = d[key];
|
|
1927
|
-
var el = document.getElementById("".concat(
|
|
2146
|
+
var el = document.getElementById("".concat(_this16.elementId, "_input_").concat(f.field));
|
|
1928
2147
|
el.value = f.value;
|
|
1929
2148
|
}
|
|
1930
2149
|
});
|
|
@@ -2303,7 +2522,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2303
2522
|
|
|
2304
2523
|
var Pager = /*#__PURE__*/function () {
|
|
2305
2524
|
function Pager(elementId, options) {
|
|
2306
|
-
var
|
|
2525
|
+
var _this17 = this;
|
|
2307
2526
|
|
|
2308
2527
|
_classCallCheck(this, Pager);
|
|
2309
2528
|
|
|
@@ -2356,8 +2575,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2356
2575
|
allowClear: false,
|
|
2357
2576
|
disableSearch: true,
|
|
2358
2577
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
2359
|
-
if (
|
|
2360
|
-
|
|
2578
|
+
if (_this17.options.onChangePageSize) {
|
|
2579
|
+
_this17.options.onChangePageSize(selectedItem.value);
|
|
2361
2580
|
}
|
|
2362
2581
|
}
|
|
2363
2582
|
});
|
|
@@ -2381,13 +2600,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2381
2600
|
}, {
|
|
2382
2601
|
key: "render",
|
|
2383
2602
|
value: function render() {
|
|
2384
|
-
var
|
|
2603
|
+
var _this18 = this;
|
|
2385
2604
|
|
|
2386
2605
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
2387
2606
|
|
|
2388
2607
|
if (el) {
|
|
2389
2608
|
var pages = this.options.pages.map(function (item, index) {
|
|
2390
|
-
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>");
|
|
2391
2610
|
});
|
|
2392
2611
|
var startIndex = 0;
|
|
2393
2612
|
|
|
@@ -2455,58 +2674,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2455
2674
|
_createClass(WebsyPDFButton, [{
|
|
2456
2675
|
key: "handleClick",
|
|
2457
2676
|
value: function handleClick(event) {
|
|
2458
|
-
var
|
|
2677
|
+
var _this19 = this;
|
|
2459
2678
|
|
|
2460
2679
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
2461
2680
|
this.loader.show();
|
|
2462
2681
|
setTimeout(function () {
|
|
2463
|
-
if (
|
|
2464
|
-
var el = document.getElementById(
|
|
2682
|
+
if (_this19.options.targetId) {
|
|
2683
|
+
var el = document.getElementById(_this19.options.targetId);
|
|
2465
2684
|
|
|
2466
2685
|
if (el) {
|
|
2467
2686
|
var pdfData = {
|
|
2468
2687
|
options: {}
|
|
2469
2688
|
};
|
|
2470
2689
|
|
|
2471
|
-
if (
|
|
2472
|
-
pdfData.options = _extends({},
|
|
2690
|
+
if (_this19.options.pdfOptions) {
|
|
2691
|
+
pdfData.options = _extends({}, _this19.options.pdfOptions);
|
|
2473
2692
|
}
|
|
2474
2693
|
|
|
2475
|
-
if (
|
|
2476
|
-
if (
|
|
2477
|
-
var headerEl = document.getElementById(
|
|
2694
|
+
if (_this19.options.header) {
|
|
2695
|
+
if (_this19.options.header.elementId) {
|
|
2696
|
+
var headerEl = document.getElementById(_this19.options.header.elementId);
|
|
2478
2697
|
|
|
2479
2698
|
if (headerEl) {
|
|
2480
2699
|
pdfData.header = headerEl.outerHTML;
|
|
2481
2700
|
|
|
2482
|
-
if (
|
|
2483
|
-
pdfData.options.headerCSS =
|
|
2701
|
+
if (_this19.options.header.css) {
|
|
2702
|
+
pdfData.options.headerCSS = _this19.options.header.css;
|
|
2484
2703
|
}
|
|
2485
2704
|
}
|
|
2486
|
-
} else if (
|
|
2487
|
-
pdfData.header =
|
|
2705
|
+
} else if (_this19.options.header.html) {
|
|
2706
|
+
pdfData.header = _this19.options.header.html;
|
|
2488
2707
|
|
|
2489
|
-
if (
|
|
2490
|
-
pdfData.options.headerCSS =
|
|
2708
|
+
if (_this19.options.header.css) {
|
|
2709
|
+
pdfData.options.headerCSS = _this19.options.header.css;
|
|
2491
2710
|
}
|
|
2492
2711
|
} else {
|
|
2493
|
-
pdfData.header =
|
|
2712
|
+
pdfData.header = _this19.options.header;
|
|
2494
2713
|
}
|
|
2495
2714
|
}
|
|
2496
2715
|
|
|
2497
|
-
if (
|
|
2498
|
-
if (
|
|
2499
|
-
var footerEl = document.getElementById(
|
|
2716
|
+
if (_this19.options.footer) {
|
|
2717
|
+
if (_this19.options.footer.elementId) {
|
|
2718
|
+
var footerEl = document.getElementById(_this19.options.footer.elementId);
|
|
2500
2719
|
|
|
2501
2720
|
if (footerEl) {
|
|
2502
2721
|
pdfData.footer = footerEl.outerHTML;
|
|
2503
2722
|
|
|
2504
|
-
if (
|
|
2505
|
-
pdfData.options.footerCSS =
|
|
2723
|
+
if (_this19.options.footer.css) {
|
|
2724
|
+
pdfData.options.footerCSS = _this19.options.footer.css;
|
|
2506
2725
|
}
|
|
2507
2726
|
}
|
|
2508
2727
|
} else {
|
|
2509
|
-
pdfData.footer =
|
|
2728
|
+
pdfData.footer = _this19.options.footer;
|
|
2510
2729
|
}
|
|
2511
2730
|
}
|
|
2512
2731
|
|
|
@@ -2515,31 +2734,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2515
2734
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
2516
2735
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
2517
2736
|
|
|
2518
|
-
|
|
2737
|
+
_this19.service.add('', pdfData, {
|
|
2519
2738
|
responseType: 'blob'
|
|
2520
2739
|
}).then(function (response) {
|
|
2521
|
-
|
|
2740
|
+
_this19.loader.hide();
|
|
2522
2741
|
|
|
2523
2742
|
var blob = new Blob([response], {
|
|
2524
2743
|
type: 'application/pdf'
|
|
2525
2744
|
});
|
|
2526
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 ");
|
|
2527
2746
|
|
|
2528
|
-
if (
|
|
2747
|
+
if (_this19.options.directDownload === true) {
|
|
2529
2748
|
var fileName;
|
|
2530
2749
|
|
|
2531
|
-
if (typeof
|
|
2532
|
-
fileName =
|
|
2750
|
+
if (typeof _this19.options.fileName === 'function') {
|
|
2751
|
+
fileName = _this19.options.fileName() || 'Export';
|
|
2533
2752
|
} else {
|
|
2534
|
-
fileName =
|
|
2753
|
+
fileName = _this19.options.fileName || 'Export';
|
|
2535
2754
|
}
|
|
2536
2755
|
|
|
2537
2756
|
msg += "download='".concat(fileName, ".pdf'");
|
|
2538
2757
|
}
|
|
2539
2758
|
|
|
2540
|
-
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 ");
|
|
2541
2760
|
|
|
2542
|
-
|
|
2761
|
+
_this19.popup.show({
|
|
2543
2762
|
message: msg,
|
|
2544
2763
|
mask: true
|
|
2545
2764
|
});
|
|
@@ -2721,12 +2940,242 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
2721
2940
|
|
|
2722
2941
|
return WebsyPubSub;
|
|
2723
2942
|
}();
|
|
2943
|
+
|
|
2944
|
+
var ResponsiveText = /*#__PURE__*/function () {
|
|
2945
|
+
function ResponsiveText(elementId, options) {
|
|
2946
|
+
var _this20 = this;
|
|
2947
|
+
|
|
2948
|
+
_classCallCheck(this, ResponsiveText);
|
|
2949
|
+
|
|
2950
|
+
var DEFAULTS = {
|
|
2951
|
+
textAlign: 'center',
|
|
2952
|
+
verticalAlign: 'flex-end',
|
|
2953
|
+
wrapText: false
|
|
2954
|
+
};
|
|
2955
|
+
this.options = _extends({}, DEFAULTS, options);
|
|
2956
|
+
this.elementId = elementId;
|
|
2957
|
+
this.canvas = document.createElement('canvas');
|
|
2958
|
+
window.addEventListener('resize', function () {
|
|
2959
|
+
return _this20.render();
|
|
2960
|
+
});
|
|
2961
|
+
var el = document.getElementById(this.elementId);
|
|
2962
|
+
|
|
2963
|
+
if (el) {
|
|
2964
|
+
this.render();
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
2967
|
+
|
|
2968
|
+
_createClass(ResponsiveText, [{
|
|
2969
|
+
key: "css",
|
|
2970
|
+
value: function css(element, property) {
|
|
2971
|
+
return window.getComputedStyle(element, null).getPropertyValue(property);
|
|
2972
|
+
}
|
|
2973
|
+
}, {
|
|
2974
|
+
key: "render",
|
|
2975
|
+
value: function render(text) {
|
|
2976
|
+
if (typeof text !== 'undefined') {
|
|
2977
|
+
this.options.text = text;
|
|
2978
|
+
}
|
|
2979
|
+
|
|
2980
|
+
if (this.options.text) {
|
|
2981
|
+
var wrappingRequired = false;
|
|
2982
|
+
var el = document.getElementById(this.elementId);
|
|
2983
|
+
var cx = this.canvas.getContext('2d');
|
|
2984
|
+
var f = 0;
|
|
2985
|
+
var fits = false; // let el = document.getElementById(`${layout.qInfo.qId}_responsiveInner`)
|
|
2986
|
+
|
|
2987
|
+
var height = el.clientHeight;
|
|
2988
|
+
|
|
2989
|
+
if (typeof this.options.maxHeight === 'string' && this.options.maxHeight.indexOf('%') !== -1) {
|
|
2990
|
+
var p = +this.options.maxHeight.replace('%', '');
|
|
2991
|
+
|
|
2992
|
+
if (!isNaN(p)) {
|
|
2993
|
+
this.options.maxHeight = Math.floor(height * (p / 100));
|
|
2994
|
+
}
|
|
2995
|
+
} else if (typeof this.options.maxHeight === 'string' && this.options.maxHeight.indexOf('px') !== -1) {
|
|
2996
|
+
this.options.maxHeight = +this.options.maxHeight.replace('px', '');
|
|
2997
|
+
}
|
|
2998
|
+
|
|
2999
|
+
if (typeof this.options.minHeight === 'string' && this.options.minHeight.indexOf('%') !== -1) {
|
|
3000
|
+
var _p = +this.options.minHeight.replace('%', '');
|
|
3001
|
+
|
|
3002
|
+
if (!isNaN(_p)) {
|
|
3003
|
+
this.options.minHeight = Math.floor(height * (_p / 100));
|
|
3004
|
+
}
|
|
3005
|
+
} else if (typeof this.options.minHeight === 'string' && this.options.minHeight.indexOf('px') !== -1) {
|
|
3006
|
+
this.options.minHeight = +this.options.minHeight.replace('px', '');
|
|
3007
|
+
}
|
|
3008
|
+
|
|
3009
|
+
var fontFamily = this.css(el, 'font-family');
|
|
3010
|
+
var fontWeight = this.css(el, 'font-weight');
|
|
3011
|
+
var allowedWidth = el.clientWidth;
|
|
3012
|
+
|
|
3013
|
+
if (allowedWidth === 0) {
|
|
3014
|
+
// check for a max-width property
|
|
3015
|
+
if (el.style.maxWidth && el.style.maxWidth !== 'auto') {
|
|
3016
|
+
if (el.parentElement.clientWidth > 0) {
|
|
3017
|
+
var calc = el.style.maxWidth;
|
|
3018
|
+
|
|
3019
|
+
if (calc.indexOf('calc') !== -1) {
|
|
3020
|
+
// this logic currently only handles calc statements using % and px
|
|
3021
|
+
// and only + or - formulas
|
|
3022
|
+
calc = calc.replace('calc(', '').replace(')', '');
|
|
3023
|
+
calc = calc.split(' ');
|
|
3024
|
+
|
|
3025
|
+
if (calc[0].indexOf('px') !== -1) {
|
|
3026
|
+
allowedWidth = calc[0].replace('px', '');
|
|
3027
|
+
} else if (calc[0].indexOf('%') !== -1) {
|
|
3028
|
+
allowedWidth = el.parentElement.clientWidth * (+calc[0].replace('%', '') / 100);
|
|
3029
|
+
}
|
|
3030
|
+
|
|
3031
|
+
if (calc[2] && calc[4]) {
|
|
3032
|
+
// this means we have an operator and a second value
|
|
3033
|
+
// handle -
|
|
3034
|
+
if (calc[2] === '-') {
|
|
3035
|
+
if (calc[4].indexOf('px') !== -1) {
|
|
3036
|
+
allowedWidth -= +calc[4].replace('px', '');
|
|
3037
|
+
}
|
|
3038
|
+
}
|
|
3039
|
+
|
|
3040
|
+
if (calc[2] === '+') {
|
|
3041
|
+
if (calc[4].indexOf('px') !== -1) {
|
|
3042
|
+
allowedWidth += +calc[4].replace('px', '');
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
}
|
|
3046
|
+
} else if (calc.indexOf('px') !== -1) {
|
|
3047
|
+
allowedWidth = +calc.replace('px', '');
|
|
3048
|
+
} else if (calc.indexOf('%') !== -1) {
|
|
3049
|
+
allowedWidth = el.parentElement.clientWidth * (+calc.replace('%', '') / 100);
|
|
3050
|
+
}
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
} // console.log('max height', this.options.maxHeight);
|
|
3054
|
+
|
|
3055
|
+
|
|
3056
|
+
var innerElHeight = el.clientHeight;
|
|
3057
|
+
|
|
3058
|
+
while (fits === false) {
|
|
3059
|
+
f++;
|
|
3060
|
+
cx.font = "".concat(fontWeight, " ").concat(f, "px ").concat(fontFamily);
|
|
3061
|
+
var measurements = cx.measureText(this.options.text); // add support for safari where some elements end up with zero height
|
|
3062
|
+
|
|
3063
|
+
if (navigator.userAgent.indexOf('Safari') !== -1) {
|
|
3064
|
+
// get the closest parent that has a height
|
|
3065
|
+
var heightFound = false;
|
|
3066
|
+
var currEl = el;
|
|
3067
|
+
|
|
3068
|
+
while (heightFound === false) {
|
|
3069
|
+
if (currEl.clientHeight > 0) {
|
|
3070
|
+
innerElHeight = currEl.clientHeight;
|
|
3071
|
+
heightFound = true;
|
|
3072
|
+
} else if (currEl.parentNode) {
|
|
3073
|
+
currEl = currEl.parentNode;
|
|
3074
|
+
} else {
|
|
3075
|
+
// prevent the loop from running indefinitely
|
|
3076
|
+
heightFound = true;
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3081
|
+
if (typeof this.options.maxHeight !== 'undefined' && f === this.options.maxHeight) {
|
|
3082
|
+
f = this.options.maxHeight;
|
|
3083
|
+
height = measurements.actualBoundingBoxAscent;
|
|
3084
|
+
fits = true;
|
|
3085
|
+
} else if (measurements.width > allowedWidth || measurements.actualBoundingBoxAscent >= innerElHeight) {
|
|
3086
|
+
f--;
|
|
3087
|
+
height = measurements.actualBoundingBoxAscent;
|
|
3088
|
+
fits = true;
|
|
3089
|
+
}
|
|
3090
|
+
}
|
|
3091
|
+
|
|
3092
|
+
if (this.options.minHeight === '') {
|
|
3093
|
+
this.options.minHeight = undefined;
|
|
3094
|
+
}
|
|
3095
|
+
|
|
3096
|
+
if (typeof this.options.minHeight !== 'undefined') {
|
|
3097
|
+
if (this.options.minHeight > f && this.options.wrapText === true) {
|
|
3098
|
+
// we run the process again but this time separating the words onto separate lines
|
|
3099
|
+
// this currently only supports wrapping onto 2 lines
|
|
3100
|
+
wrappingRequired = true;
|
|
3101
|
+
fits = false;
|
|
3102
|
+
f = this.options.minHeight;
|
|
3103
|
+
var spaceCount = this.options.text.match(/ /g);
|
|
3104
|
+
|
|
3105
|
+
if (spaceCount && spaceCount.length > 0) {
|
|
3106
|
+
spaceCount = spaceCount.length;
|
|
3107
|
+
var words = this.options.text.split(' ');
|
|
3108
|
+
|
|
3109
|
+
while (fits === false) {
|
|
3110
|
+
f++;
|
|
3111
|
+
cx.font = "".concat(fontWeight, " ").concat(f, "px ").concat(fontFamily);
|
|
3112
|
+
|
|
3113
|
+
for (var i = spaceCount; i > 0; i--) {
|
|
3114
|
+
var fitsCount = 0;
|
|
3115
|
+
var lines = [words.slice(0, i).join(' '), words.slice(i, words.length).join(' ')];
|
|
3116
|
+
var longestLine = lines.reduce(function (a, b) {
|
|
3117
|
+
return a.length > b.length ? a : b;
|
|
3118
|
+
}, ''); // lines.forEach(l => {
|
|
3119
|
+
|
|
3120
|
+
var _measurements = cx.measureText(longestLine); // add support for safari where some elements end up with zero height
|
|
3121
|
+
|
|
3122
|
+
|
|
3123
|
+
if (navigator.userAgent.indexOf('Safari') !== -1) {
|
|
3124
|
+
// get the closest parent that has a height
|
|
3125
|
+
var _heightFound = false;
|
|
3126
|
+
var _currEl = el;
|
|
3127
|
+
|
|
3128
|
+
while (_heightFound === false) {
|
|
3129
|
+
if (_currEl.clientHeight > 0) {
|
|
3130
|
+
innerElHeight = _currEl.clientHeight;
|
|
3131
|
+
_heightFound = true;
|
|
3132
|
+
} else if (_currEl.parentNode) {
|
|
3133
|
+
_currEl = _currEl.parentNode;
|
|
3134
|
+
} else {
|
|
3135
|
+
// prevent the loop from running indefinitely
|
|
3136
|
+
_heightFound = true;
|
|
3137
|
+
}
|
|
3138
|
+
}
|
|
3139
|
+
}
|
|
3140
|
+
|
|
3141
|
+
if (typeof this.options.maxHeight !== 'undefined' && f === this.options.maxHeight) {
|
|
3142
|
+
f = this.options.maxHeight;
|
|
3143
|
+
height = _measurements.actualBoundingBoxAscent;
|
|
3144
|
+
fits = true;
|
|
3145
|
+
break;
|
|
3146
|
+
} else if (_measurements.width > allowedWidth || _measurements.actualBoundingBoxAscent >= innerElHeight / 2 * 0.75) {
|
|
3147
|
+
f--;
|
|
3148
|
+
height = _measurements.actualBoundingBoxAscent;
|
|
3149
|
+
fits = true;
|
|
3150
|
+
break;
|
|
3151
|
+
} // })
|
|
3152
|
+
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
|
|
3157
|
+
if (typeof this.options.minHeight !== 'undefined' && this.options.minHeight > f) {
|
|
3158
|
+
f = this.options.minHeight;
|
|
3159
|
+
}
|
|
3160
|
+
} else if (this.options.minHeight > f) {
|
|
3161
|
+
f = this.options.minHeight;
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
|
|
3165
|
+
var spanHeight = Math.min(innerElHeight, height);
|
|
3166
|
+
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 ");
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
}]);
|
|
3170
|
+
|
|
3171
|
+
return ResponsiveText;
|
|
3172
|
+
}();
|
|
2724
3173
|
/* global WebsyDesigns */
|
|
2725
3174
|
|
|
2726
3175
|
|
|
2727
3176
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
2728
3177
|
function WebsyResultList(elementId, options) {
|
|
2729
|
-
var
|
|
3178
|
+
var _this21 = this;
|
|
2730
3179
|
|
|
2731
3180
|
_classCallCheck(this, WebsyResultList);
|
|
2732
3181
|
|
|
@@ -2754,9 +3203,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2754
3203
|
|
|
2755
3204
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
2756
3205
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
2757
|
-
|
|
3206
|
+
_this21.options.template = templateString;
|
|
2758
3207
|
|
|
2759
|
-
|
|
3208
|
+
_this21.render();
|
|
2760
3209
|
});
|
|
2761
3210
|
} else {
|
|
2762
3211
|
this.render();
|
|
@@ -2775,7 +3224,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2775
3224
|
}, {
|
|
2776
3225
|
key: "buildHTML",
|
|
2777
3226
|
value: function buildHTML(d) {
|
|
2778
|
-
var
|
|
3227
|
+
var _this22 = this;
|
|
2779
3228
|
|
|
2780
3229
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
2781
3230
|
var html = "";
|
|
@@ -2783,7 +3232,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2783
3232
|
if (this.options.template) {
|
|
2784
3233
|
if (d.length > 0) {
|
|
2785
3234
|
d.forEach(function (row, ix) {
|
|
2786
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(
|
|
3235
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(_this22.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
2787
3236
|
|
|
2788
3237
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
2789
3238
|
|
|
@@ -2903,7 +3352,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2903
3352
|
}, {
|
|
2904
3353
|
key: "handleClick",
|
|
2905
3354
|
value: function handleClick(event) {
|
|
2906
|
-
var
|
|
3355
|
+
var _this23 = this;
|
|
2907
3356
|
|
|
2908
3357
|
if (event.target.classList.contains('clickable')) {
|
|
2909
3358
|
var l = event.target.getAttribute('data-event');
|
|
@@ -2921,8 +3370,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2921
3370
|
l = l[0];
|
|
2922
3371
|
params = params.map(function (p) {
|
|
2923
3372
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
2924
|
-
if (
|
|
2925
|
-
p =
|
|
3373
|
+
if (_this23.rows[+id]) {
|
|
3374
|
+
p = _this23.rows[+id][p];
|
|
2926
3375
|
}
|
|
2927
3376
|
} else if (typeof p === 'string') {
|
|
2928
3377
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -2944,13 +3393,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2944
3393
|
}, {
|
|
2945
3394
|
key: "render",
|
|
2946
3395
|
value: function render() {
|
|
2947
|
-
var
|
|
3396
|
+
var _this24 = this;
|
|
2948
3397
|
|
|
2949
3398
|
if (this.options.entity) {
|
|
2950
3399
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
2951
|
-
|
|
3400
|
+
_this24.rows = results.rows;
|
|
2952
3401
|
|
|
2953
|
-
|
|
3402
|
+
_this24.resize();
|
|
2954
3403
|
});
|
|
2955
3404
|
} else {
|
|
2956
3405
|
this.resize();
|
|
@@ -3029,14 +3478,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3029
3478
|
_createClass(WebsyRouter, [{
|
|
3030
3479
|
key: "addGroup",
|
|
3031
3480
|
value: function addGroup(group) {
|
|
3032
|
-
var
|
|
3481
|
+
var _this25 = this;
|
|
3033
3482
|
|
|
3034
3483
|
if (!this.groups[group]) {
|
|
3035
3484
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3036
3485
|
|
|
3037
3486
|
if (els) {
|
|
3038
3487
|
this.getClosestParent(els[0], function (parent) {
|
|
3039
|
-
|
|
3488
|
+
_this25.groups[group] = {
|
|
3040
3489
|
activeView: '',
|
|
3041
3490
|
views: [],
|
|
3042
3491
|
parent: parent.getAttribute('data-view')
|
|
@@ -3361,12 +3810,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3361
3810
|
}, {
|
|
3362
3811
|
key: "showComponents",
|
|
3363
3812
|
value: function showComponents(view) {
|
|
3364
|
-
var
|
|
3813
|
+
var _this26 = this;
|
|
3365
3814
|
|
|
3366
3815
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
3367
3816
|
this.options.views[view].components.forEach(function (c) {
|
|
3368
3817
|
if (typeof c.instance === 'undefined') {
|
|
3369
|
-
|
|
3818
|
+
_this26.prepComponent(c.elementId, c.options);
|
|
3370
3819
|
|
|
3371
3820
|
c.instance = new c.Component(c.elementId, c.options);
|
|
3372
3821
|
} else if (c.instance.render) {
|
|
@@ -3794,7 +4243,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
3794
4243
|
|
|
3795
4244
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
3796
4245
|
function WebsyTemplate(elementId, options) {
|
|
3797
|
-
var
|
|
4246
|
+
var _this27 = this;
|
|
3798
4247
|
|
|
3799
4248
|
_classCallCheck(this, WebsyTemplate);
|
|
3800
4249
|
|
|
@@ -3820,9 +4269,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3820
4269
|
|
|
3821
4270
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3822
4271
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3823
|
-
|
|
4272
|
+
_this27.options.template = templateString;
|
|
3824
4273
|
|
|
3825
|
-
|
|
4274
|
+
_this27.render();
|
|
3826
4275
|
});
|
|
3827
4276
|
} else {
|
|
3828
4277
|
this.render();
|
|
@@ -3832,7 +4281,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3832
4281
|
_createClass(WebsyTemplate, [{
|
|
3833
4282
|
key: "buildHTML",
|
|
3834
4283
|
value: function buildHTML() {
|
|
3835
|
-
var
|
|
4284
|
+
var _this28 = this;
|
|
3836
4285
|
|
|
3837
4286
|
var html = "";
|
|
3838
4287
|
|
|
@@ -3894,14 +4343,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3894
4343
|
}
|
|
3895
4344
|
|
|
3896
4345
|
if (polarity === true) {
|
|
3897
|
-
if (typeof
|
|
4346
|
+
if (typeof _this28.options.data[parts[0]] !== 'undefined' && _this28.options.data[parts[0]] === parts[1]) {
|
|
3898
4347
|
// remove the <if> tags
|
|
3899
4348
|
removeAll = false;
|
|
3900
4349
|
} else if (parts[0] === parts[1]) {
|
|
3901
4350
|
removeAll = false;
|
|
3902
4351
|
}
|
|
3903
4352
|
} else if (polarity === false) {
|
|
3904
|
-
if (typeof
|
|
4353
|
+
if (typeof _this28.options.data[parts[0]] !== 'undefined' && _this28.options.data[parts[0]] !== parts[1]) {
|
|
3905
4354
|
// remove the <if> tags
|
|
3906
4355
|
removeAll = false;
|
|
3907
4356
|
}
|
|
@@ -4147,10 +4596,10 @@ var WebsyUtils = {
|
|
|
4147
4596
|
var s = '';
|
|
4148
4597
|
var d = 1; // let out
|
|
4149
4598
|
|
|
4150
|
-
for (var
|
|
4151
|
-
if (n >= ranges[
|
|
4152
|
-
d = ranges[
|
|
4153
|
-
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,')
|
|
4154
4603
|
|
|
4155
4604
|
break;
|
|
4156
4605
|
}
|
|
@@ -4188,7 +4637,7 @@ var WebsyUtils = {
|
|
|
4188
4637
|
|
|
4189
4638
|
var WebsyTable = /*#__PURE__*/function () {
|
|
4190
4639
|
function WebsyTable(elementId, options) {
|
|
4191
|
-
var
|
|
4640
|
+
var _this29 = this;
|
|
4192
4641
|
|
|
4193
4642
|
_classCallCheck(this, WebsyTable);
|
|
4194
4643
|
|
|
@@ -4226,8 +4675,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4226
4675
|
allowClear: false,
|
|
4227
4676
|
disableSearch: true,
|
|
4228
4677
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4229
|
-
if (
|
|
4230
|
-
|
|
4678
|
+
if (_this29.options.onChangePageSize) {
|
|
4679
|
+
_this29.options.onChangePageSize(selectedItem.value);
|
|
4231
4680
|
}
|
|
4232
4681
|
}
|
|
4233
4682
|
});
|
|
@@ -4248,7 +4697,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4248
4697
|
_createClass(WebsyTable, [{
|
|
4249
4698
|
key: "appendRows",
|
|
4250
4699
|
value: function appendRows(data) {
|
|
4251
|
-
var
|
|
4700
|
+
var _this30 = this;
|
|
4252
4701
|
|
|
4253
4702
|
this.hideError();
|
|
4254
4703
|
var bodyHTML = '';
|
|
@@ -4256,15 +4705,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4256
4705
|
if (data) {
|
|
4257
4706
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4258
4707
|
return '<tr>' + r.map(function (c, i) {
|
|
4259
|
-
if (
|
|
4708
|
+
if (_this30.options.columns[i].show !== false) {
|
|
4260
4709
|
var style = '';
|
|
4261
4710
|
|
|
4262
4711
|
if (c.style) {
|
|
4263
4712
|
style += c.style;
|
|
4264
4713
|
}
|
|
4265
4714
|
|
|
4266
|
-
if (
|
|
4267
|
-
style += "width: ".concat(
|
|
4715
|
+
if (_this30.options.columns[i].width) {
|
|
4716
|
+
style += "width: ".concat(_this30.options.columns[i].width, "; ");
|
|
4268
4717
|
}
|
|
4269
4718
|
|
|
4270
4719
|
if (c.backgroundColor) {
|
|
@@ -4279,18 +4728,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4279
4728
|
style += "color: ".concat(c.color, "; ");
|
|
4280
4729
|
}
|
|
4281
4730
|
|
|
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(
|
|
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 ");
|
|
4286
4735
|
} else {
|
|
4287
4736
|
var info = c.value;
|
|
4288
4737
|
|
|
4289
|
-
if (
|
|
4738
|
+
if (_this30.options.columns[i].showAsImage === true) {
|
|
4290
4739
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4291
4740
|
}
|
|
4292
4741
|
|
|
4293
|
-
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 ");
|
|
4294
4743
|
}
|
|
4295
4744
|
}
|
|
4296
4745
|
}).join('') + '</tr>';
|
|
@@ -4462,7 +4911,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4462
4911
|
}, {
|
|
4463
4912
|
key: "render",
|
|
4464
4913
|
value: function render(data) {
|
|
4465
|
-
var
|
|
4914
|
+
var _this31 = this;
|
|
4466
4915
|
|
|
4467
4916
|
if (!this.options.columns) {
|
|
4468
4917
|
return;
|
|
@@ -4487,7 +4936,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4487
4936
|
|
|
4488
4937
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
4489
4938
|
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 ?
|
|
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 ");
|
|
4491
4940
|
}
|
|
4492
4941
|
}).join('') + '</tr>';
|
|
4493
4942
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -4506,7 +4955,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4506
4955
|
|
|
4507
4956
|
if (pagingEl) {
|
|
4508
4957
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
4509
|
-
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>");
|
|
4510
4959
|
});
|
|
4511
4960
|
var startIndex = 0;
|
|
4512
4961
|
|
|
@@ -4574,7 +5023,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4574
5023
|
|
|
4575
5024
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
4576
5025
|
function WebsyTable2(elementId, options) {
|
|
4577
|
-
var
|
|
5026
|
+
var _this32 = this;
|
|
4578
5027
|
|
|
4579
5028
|
_classCallCheck(this, WebsyTable2);
|
|
4580
5029
|
|
|
@@ -4615,8 +5064,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4615
5064
|
allowClear: false,
|
|
4616
5065
|
disableSearch: true,
|
|
4617
5066
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4618
|
-
if (
|
|
4619
|
-
|
|
5067
|
+
if (_this32.options.onChangePageSize) {
|
|
5068
|
+
_this32.options.onChangePageSize(selectedItem.value);
|
|
4620
5069
|
}
|
|
4621
5070
|
}
|
|
4622
5071
|
});
|
|
@@ -4640,7 +5089,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4640
5089
|
_createClass(WebsyTable2, [{
|
|
4641
5090
|
key: "appendRows",
|
|
4642
5091
|
value: function appendRows(data) {
|
|
4643
|
-
var
|
|
5092
|
+
var _this33 = this;
|
|
4644
5093
|
|
|
4645
5094
|
this.hideError();
|
|
4646
5095
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -4649,15 +5098,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4649
5098
|
if (data) {
|
|
4650
5099
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4651
5100
|
return '<tr>' + r.map(function (c, i) {
|
|
4652
|
-
if (
|
|
4653
|
-
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;");
|
|
4654
5103
|
|
|
4655
5104
|
if (c.style) {
|
|
4656
5105
|
style += c.style;
|
|
4657
5106
|
}
|
|
4658
5107
|
|
|
4659
|
-
if (
|
|
4660
|
-
style += "width: ".concat(
|
|
5108
|
+
if (_this33.options.columns[i].width) {
|
|
5109
|
+
style += "width: ".concat(_this33.options.columns[i].width, "; ");
|
|
4661
5110
|
}
|
|
4662
5111
|
|
|
4663
5112
|
if (c.backgroundColor) {
|
|
@@ -4672,18 +5121,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4672
5121
|
style += "color: ".concat(c.color, "; ");
|
|
4673
5122
|
}
|
|
4674
5123
|
|
|
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(
|
|
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 ");
|
|
4679
5128
|
} else {
|
|
4680
5129
|
var info = c.value;
|
|
4681
5130
|
|
|
4682
|
-
if (
|
|
5131
|
+
if (_this33.options.columns[i].showAsImage === true) {
|
|
4683
5132
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4684
5133
|
}
|
|
4685
5134
|
|
|
4686
|
-
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 ");
|
|
4687
5136
|
}
|
|
4688
5137
|
}
|
|
4689
5138
|
}).join('') + '</tr>';
|
|
@@ -4808,7 +5257,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4808
5257
|
value: function handleGlobalMouseUp(event) {
|
|
4809
5258
|
this.scrolling = false;
|
|
4810
5259
|
var el = document.getElementById(this.elementId);
|
|
4811
|
-
|
|
5260
|
+
|
|
5261
|
+
if (el) {
|
|
5262
|
+
el.classList.remove('scrolling');
|
|
5263
|
+
}
|
|
4812
5264
|
}
|
|
4813
5265
|
}, {
|
|
4814
5266
|
key: "handleMouseUp",
|
|
@@ -4938,7 +5390,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4938
5390
|
}, {
|
|
4939
5391
|
key: "render",
|
|
4940
5392
|
value: function render(data) {
|
|
4941
|
-
var
|
|
5393
|
+
var _this34 = this;
|
|
4942
5394
|
|
|
4943
5395
|
if (!this.options.columns) {
|
|
4944
5396
|
return;
|
|
@@ -4974,7 +5426,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4974
5426
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
4975
5427
|
}
|
|
4976
5428
|
|
|
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 ?
|
|
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 ");
|
|
4978
5430
|
}
|
|
4979
5431
|
}).join('') + '</tr>';
|
|
4980
5432
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -4985,7 +5437,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4985
5437
|
var dropdownHTML = "";
|
|
4986
5438
|
this.options.columns.forEach(function (c, i) {
|
|
4987
5439
|
if (c.searchable && c.searchField) {
|
|
4988
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5440
|
+
dropdownHTML += "\n <div id=\"".concat(_this34.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
4989
5441
|
}
|
|
4990
5442
|
});
|
|
4991
5443
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5007,7 +5459,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5007
5459
|
|
|
5008
5460
|
if (pagingEl) {
|
|
5009
5461
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5010
|
-
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>");
|
|
5011
5463
|
});
|
|
5012
5464
|
var startIndex = 0;
|
|
5013
5465
|
|
|
@@ -5094,7 +5546,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5094
5546
|
}, {
|
|
5095
5547
|
key: "getColumnParameters",
|
|
5096
5548
|
value: function getColumnParameters(values) {
|
|
5097
|
-
var
|
|
5549
|
+
var _this35 = this;
|
|
5098
5550
|
|
|
5099
5551
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
5100
5552
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -5102,10 +5554,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5102
5554
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
5103
5555
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5104
5556
|
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 ?
|
|
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 ");
|
|
5106
5558
|
}).join('') + '</tr>';
|
|
5107
5559
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
5108
|
-
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 ");
|
|
5109
5561
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
5110
5562
|
|
|
5111
5563
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -5126,8 +5578,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5126
5578
|
|
|
5127
5579
|
|
|
5128
5580
|
if (accWidth < (tableContainerEl.offsetWidth || tableContainerEl.clientWidth) - nonScrollableWidth) {
|
|
5129
|
-
for (var
|
|
5130
|
-
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);
|
|
5131
5583
|
}
|
|
5132
5584
|
} // const cellWidth = firstDataCell.offsetWidth || firstDataCell.clientWidth
|
|
5133
5585
|
// tableEl.style.width = ''
|
|
@@ -5155,7 +5607,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5155
5607
|
|
|
5156
5608
|
var WebsyChart = /*#__PURE__*/function () {
|
|
5157
5609
|
function WebsyChart(elementId, options) {
|
|
5158
|
-
var
|
|
5610
|
+
var _this36 = this;
|
|
5159
5611
|
|
|
5160
5612
|
_classCallCheck(this, WebsyChart);
|
|
5161
5613
|
|
|
@@ -5204,22 +5656,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5204
5656
|
this.invertOverride = function (input, input2) {
|
|
5205
5657
|
var xAxis = 'bottomAxis';
|
|
5206
5658
|
|
|
5207
|
-
if (
|
|
5659
|
+
if (_this36.options.orientation === 'horizontal') {
|
|
5208
5660
|
xAxis = 'leftAxis';
|
|
5209
5661
|
}
|
|
5210
5662
|
|
|
5211
|
-
var width =
|
|
5663
|
+
var width = _this36[xAxis].step();
|
|
5212
5664
|
|
|
5213
5665
|
var output;
|
|
5214
5666
|
|
|
5215
|
-
var domain = _toConsumableArray(
|
|
5667
|
+
var domain = _toConsumableArray(_this36[xAxis].domain());
|
|
5216
5668
|
|
|
5217
|
-
if (
|
|
5669
|
+
if (_this36.options.orientation === 'horizontal') {
|
|
5218
5670
|
domain = domain.reverse();
|
|
5219
5671
|
}
|
|
5220
5672
|
|
|
5221
5673
|
for (var j = 0; j < domain.length; j++) {
|
|
5222
|
-
var breakA =
|
|
5674
|
+
var breakA = _this36[xAxis](domain[j]) - width / 2;
|
|
5223
5675
|
var breakB = breakA + width;
|
|
5224
5676
|
|
|
5225
5677
|
if (input > breakA && input <= breakB) {
|
|
@@ -5319,10 +5771,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5319
5771
|
}, {
|
|
5320
5772
|
key: "handleEventMouseMove",
|
|
5321
5773
|
value: function handleEventMouseMove(event, d) {
|
|
5322
|
-
var
|
|
5774
|
+
var _this37 = this;
|
|
5323
5775
|
|
|
5324
5776
|
var bisectDate = d3.bisector(function (d) {
|
|
5325
|
-
return
|
|
5777
|
+
return _this37.parseX(d.x.value);
|
|
5326
5778
|
}).left;
|
|
5327
5779
|
|
|
5328
5780
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -5361,8 +5813,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5361
5813
|
}
|
|
5362
5814
|
|
|
5363
5815
|
this.options.data.series.forEach(function (s) {
|
|
5364
|
-
if (
|
|
5365
|
-
xPoint =
|
|
5816
|
+
if (_this37.options.data[xData].scale !== 'Time') {
|
|
5817
|
+
xPoint = _this37[xAxis](_this37.parseX(xLabel));
|
|
5366
5818
|
s.data.forEach(function (d) {
|
|
5367
5819
|
if (d.x.value === xLabel) {
|
|
5368
5820
|
if (!tooltipTitle) {
|
|
@@ -5381,13 +5833,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5381
5833
|
var pointA = s.data[index - 1];
|
|
5382
5834
|
var pointB = s.data[index];
|
|
5383
5835
|
|
|
5384
|
-
if (
|
|
5836
|
+
if (_this37.options.orientation === 'horizontal') {
|
|
5385
5837
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
5386
5838
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
5387
5839
|
}
|
|
5388
5840
|
|
|
5389
5841
|
if (pointA && !pointB) {
|
|
5390
|
-
xPoint =
|
|
5842
|
+
xPoint = _this37[xAxis](_this37.parseX(pointA.x.value));
|
|
5391
5843
|
tooltipTitle = pointA.x.value;
|
|
5392
5844
|
|
|
5393
5845
|
if (!pointA.y.color) {
|
|
@@ -5397,12 +5849,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5397
5849
|
tooltipData.push(pointA.y);
|
|
5398
5850
|
|
|
5399
5851
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
5400
|
-
tooltipTitle = d3.timeFormat(
|
|
5852
|
+
tooltipTitle = d3.timeFormat(_this37.options.dateFormat || _this37.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
5401
5853
|
}
|
|
5402
5854
|
}
|
|
5403
5855
|
|
|
5404
5856
|
if (pointB && !pointA) {
|
|
5405
|
-
xPoint =
|
|
5857
|
+
xPoint = _this37[xAxis](_this37.parseX(pointB.x.value));
|
|
5406
5858
|
tooltipTitle = pointB.x.value;
|
|
5407
5859
|
|
|
5408
5860
|
if (!pointB.y.color) {
|
|
@@ -5412,14 +5864,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5412
5864
|
tooltipData.push(pointB.y);
|
|
5413
5865
|
|
|
5414
5866
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5415
|
-
tooltipTitle = d3.timeFormat(
|
|
5867
|
+
tooltipTitle = d3.timeFormat(_this37.options.dateFormat || _this37.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5416
5868
|
}
|
|
5417
5869
|
}
|
|
5418
5870
|
|
|
5419
5871
|
if (pointA && pointB) {
|
|
5420
|
-
var d0 =
|
|
5872
|
+
var d0 = _this37[xAxis](_this37.parseX(pointA.x.value));
|
|
5421
5873
|
|
|
5422
|
-
var d1 =
|
|
5874
|
+
var d1 = _this37[xAxis](_this37.parseX(pointB.x.value));
|
|
5423
5875
|
|
|
5424
5876
|
var mid = Math.abs(d0 - d1) / 2;
|
|
5425
5877
|
|
|
@@ -5428,7 +5880,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5428
5880
|
tooltipTitle = pointB.x.value;
|
|
5429
5881
|
|
|
5430
5882
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5431
|
-
tooltipTitle = d3.timeFormat(
|
|
5883
|
+
tooltipTitle = d3.timeFormat(_this37.options.dateFormat || _this37.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5432
5884
|
}
|
|
5433
5885
|
|
|
5434
5886
|
if (!pointB.y.color) {
|
|
@@ -5441,7 +5893,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5441
5893
|
tooltipTitle = pointA.x.value;
|
|
5442
5894
|
|
|
5443
5895
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5444
|
-
tooltipTitle = d3.timeFormat(
|
|
5896
|
+
tooltipTitle = d3.timeFormat(_this37.options.dateFormat || _this37.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5445
5897
|
}
|
|
5446
5898
|
|
|
5447
5899
|
if (!pointA.y.color) {
|
|
@@ -5546,7 +5998,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5546
5998
|
}, {
|
|
5547
5999
|
key: "render",
|
|
5548
6000
|
value: function render(options) {
|
|
5549
|
-
var
|
|
6001
|
+
var _this38 = this;
|
|
5550
6002
|
|
|
5551
6003
|
/* global d3 options WebsyUtils */
|
|
5552
6004
|
if (typeof options !== 'undefined') {
|
|
@@ -5615,7 +6067,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5615
6067
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
5616
6068
|
return {
|
|
5617
6069
|
value: s.label || s.key,
|
|
5618
|
-
color: s.color ||
|
|
6070
|
+
color: s.color || _this38.options.colors[i % _this38.options.colors.length]
|
|
5619
6071
|
};
|
|
5620
6072
|
});
|
|
5621
6073
|
|
|
@@ -5867,7 +6319,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5867
6319
|
|
|
5868
6320
|
if (this.options.data.bottom.formatter) {
|
|
5869
6321
|
bAxisFunc.tickFormat(function (d) {
|
|
5870
|
-
return
|
|
6322
|
+
return _this38.options.data.bottom.formatter(d);
|
|
5871
6323
|
});
|
|
5872
6324
|
}
|
|
5873
6325
|
|
|
@@ -5893,8 +6345,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5893
6345
|
|
|
5894
6346
|
if (this.options.margin.axisLeft > 0) {
|
|
5895
6347
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
5896
|
-
if (
|
|
5897
|
-
d =
|
|
6348
|
+
if (_this38.options.data.left.formatter) {
|
|
6349
|
+
d = _this38.options.data.left.formatter(d);
|
|
5898
6350
|
}
|
|
5899
6351
|
|
|
5900
6352
|
return d;
|
|
@@ -5931,8 +6383,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5931
6383
|
|
|
5932
6384
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
5933
6385
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
5934
|
-
if (
|
|
5935
|
-
d =
|
|
6386
|
+
if (_this38.options.data.right.formatter) {
|
|
6387
|
+
d = _this38.options.data.right.formatter(d);
|
|
5936
6388
|
}
|
|
5937
6389
|
|
|
5938
6390
|
return d;
|
|
@@ -5958,16 +6410,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5958
6410
|
|
|
5959
6411
|
this.options.data.series.forEach(function (series, index) {
|
|
5960
6412
|
if (!series.key) {
|
|
5961
|
-
series.key =
|
|
6413
|
+
series.key = _this38.createIdentity();
|
|
5962
6414
|
}
|
|
5963
6415
|
|
|
5964
6416
|
if (!series.color) {
|
|
5965
|
-
series.color =
|
|
6417
|
+
series.color = _this38.options.colors[index % _this38.options.colors.length];
|
|
5966
6418
|
}
|
|
5967
6419
|
|
|
5968
|
-
|
|
6420
|
+
_this38["render".concat(series.type || 'bar')](series, index);
|
|
5969
6421
|
|
|
5970
|
-
|
|
6422
|
+
_this38.renderLabels(series, index);
|
|
5971
6423
|
});
|
|
5972
6424
|
}
|
|
5973
6425
|
}
|
|
@@ -5975,17 +6427,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5975
6427
|
}, {
|
|
5976
6428
|
key: "renderarea",
|
|
5977
6429
|
value: function renderarea(series, index) {
|
|
5978
|
-
var
|
|
6430
|
+
var _this39 = this;
|
|
5979
6431
|
|
|
5980
6432
|
/* global d3 series index */
|
|
5981
6433
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
5982
6434
|
return d3.area().x(function (d) {
|
|
5983
|
-
return
|
|
6435
|
+
return _this39[xAxis](_this39.parseX(d.x.value));
|
|
5984
6436
|
}).y0(function (d) {
|
|
5985
|
-
return
|
|
6437
|
+
return _this39[yAxis](0);
|
|
5986
6438
|
}).y1(function (d) {
|
|
5987
|
-
return
|
|
5988
|
-
}).curve(d3[curveStyle ||
|
|
6439
|
+
return _this39[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6440
|
+
}).curve(d3[curveStyle || _this39.options.curveStyle]);
|
|
5989
6441
|
};
|
|
5990
6442
|
|
|
5991
6443
|
var xAxis = 'bottomAxis';
|
|
@@ -6160,15 +6612,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6160
6612
|
}, {
|
|
6161
6613
|
key: "renderline",
|
|
6162
6614
|
value: function renderline(series, index) {
|
|
6163
|
-
var
|
|
6615
|
+
var _this40 = this;
|
|
6164
6616
|
|
|
6165
6617
|
/* global series index d3 */
|
|
6166
6618
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
6167
6619
|
return d3.line().x(function (d) {
|
|
6168
|
-
return
|
|
6620
|
+
return _this40[xAxis](_this40.parseX(d.x.value));
|
|
6169
6621
|
}).y(function (d) {
|
|
6170
|
-
return
|
|
6171
|
-
}).curve(d3[curveStyle ||
|
|
6622
|
+
return _this40[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6623
|
+
}).curve(d3[curveStyle || _this40.options.curveStyle]);
|
|
6172
6624
|
};
|
|
6173
6625
|
|
|
6174
6626
|
var xAxis = 'bottomAxis';
|
|
@@ -6206,14 +6658,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6206
6658
|
}, {
|
|
6207
6659
|
key: "rendersymbol",
|
|
6208
6660
|
value: function rendersymbol(series, index) {
|
|
6209
|
-
var
|
|
6661
|
+
var _this41 = this;
|
|
6210
6662
|
|
|
6211
6663
|
/* global d3 series index series.key */
|
|
6212
6664
|
var drawSymbol = function drawSymbol(size) {
|
|
6213
6665
|
return d3.symbol() // .type(d => {
|
|
6214
6666
|
// return d3.symbols[0]
|
|
6215
6667
|
// })
|
|
6216
|
-
.size(size ||
|
|
6668
|
+
.size(size || _this41.options.symbolSize);
|
|
6217
6669
|
};
|
|
6218
6670
|
|
|
6219
6671
|
var xAxis = 'bottomAxis';
|
|
@@ -6231,7 +6683,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6231
6683
|
symbols.attr('d', function (d) {
|
|
6232
6684
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
6233
6685
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
6234
|
-
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), ")");
|
|
6235
6687
|
}); // Enter
|
|
6236
6688
|
|
|
6237
6689
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -6240,7 +6692,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6240
6692
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
6241
6693
|
return "symbol symbol_".concat(series.key);
|
|
6242
6694
|
}).attr('transform', function (d) {
|
|
6243
|
-
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), ")");
|
|
6244
6696
|
});
|
|
6245
6697
|
}
|
|
6246
6698
|
}, {
|
|
@@ -6395,7 +6847,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6395
6847
|
}, {
|
|
6396
6848
|
key: "resize",
|
|
6397
6849
|
value: function resize() {
|
|
6398
|
-
var
|
|
6850
|
+
var _this42 = this;
|
|
6399
6851
|
|
|
6400
6852
|
var el = document.getElementById(this.elementId);
|
|
6401
6853
|
|
|
@@ -6408,7 +6860,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6408
6860
|
// }
|
|
6409
6861
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
6410
6862
|
html += this._data.map(function (d, i) {
|
|
6411
|
-
return
|
|
6863
|
+
return _this42.getLegendItemHTML(d);
|
|
6412
6864
|
}).join('');
|
|
6413
6865
|
html += "\n <div>\n ";
|
|
6414
6866
|
el.innerHTML = html;
|
|
@@ -6556,8 +7008,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6556
7008
|
var el = document.getElementById(this.elementId);
|
|
6557
7009
|
|
|
6558
7010
|
if (el) {
|
|
6559
|
-
if (typeof d3 === 'undefined') {
|
|
6560
|
-
console.error('d3 library has not been loaded');
|
|
7011
|
+
if (typeof d3 === 'undefined') {// console.error('d3 library has not been loaded')
|
|
6561
7012
|
}
|
|
6562
7013
|
|
|
6563
7014
|
if (typeof L === 'undefined') {
|
|
@@ -6581,7 +7032,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6581
7032
|
}, {
|
|
6582
7033
|
key: "render",
|
|
6583
7034
|
value: function render() {
|
|
6584
|
-
var
|
|
7035
|
+
var _this43 = this;
|
|
6585
7036
|
|
|
6586
7037
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
6587
7038
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -6590,7 +7041,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6590
7041
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
6591
7042
|
return {
|
|
6592
7043
|
value: s.label || s.key,
|
|
6593
|
-
color: s.color ||
|
|
7044
|
+
color: s.color || _this43.options.colors[i % _this43.options.colors.length]
|
|
6594
7045
|
};
|
|
6595
7046
|
});
|
|
6596
7047
|
var longestValue = legendData.map(function (s) {
|
|
@@ -6654,7 +7105,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6654
7105
|
|
|
6655
7106
|
if (this.polygons) {
|
|
6656
7107
|
this.polygons.forEach(function (p) {
|
|
6657
|
-
return
|
|
7108
|
+
return _this43.map.removeLayer(p);
|
|
6658
7109
|
});
|
|
6659
7110
|
}
|
|
6660
7111
|
|
|
@@ -6712,18 +7163,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6712
7163
|
}
|
|
6713
7164
|
|
|
6714
7165
|
if (!p.options.color) {
|
|
6715
|
-
p.options.color =
|
|
7166
|
+
p.options.color = _this43.options.colors[i % _this43.options.colors.length];
|
|
6716
7167
|
}
|
|
6717
7168
|
|
|
6718
7169
|
var pol = L.polygon(p.data.map(function (c) {
|
|
6719
7170
|
return c.map(function (d) {
|
|
6720
7171
|
return [d.Latitude, d.Longitude];
|
|
6721
7172
|
});
|
|
6722
|
-
}), p.options).addTo(
|
|
7173
|
+
}), p.options).addTo(_this43.map);
|
|
6723
7174
|
|
|
6724
|
-
|
|
7175
|
+
_this43.polygons.push(pol);
|
|
6725
7176
|
|
|
6726
|
-
|
|
7177
|
+
_this43.map.fitBounds(pol.getBounds());
|
|
6727
7178
|
});
|
|
6728
7179
|
} // if (this.data.markers.length > 0) {
|
|
6729
7180
|
// el.classList.remove('hidden')
|
|
@@ -6882,7 +7333,9 @@ var WebsyDesigns = {
|
|
|
6882
7333
|
WebsyLogin: WebsyLogin,
|
|
6883
7334
|
Login: WebsyLogin,
|
|
6884
7335
|
WebsySignup: WebsySignup,
|
|
6885
|
-
Signup: WebsySignup
|
|
7336
|
+
Signup: WebsySignup,
|
|
7337
|
+
ResponsiveText: ResponsiveText,
|
|
7338
|
+
WebsyResponsiveText: ResponsiveText
|
|
6886
7339
|
};
|
|
6887
7340
|
WebsyDesigns.service = new WebsyDesigns.APIService('');
|
|
6888
7341
|
var GlobalPubSub = new WebsyPubSub('empty', {});
|