@websy/websy-designs 1.2.6 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/websy-designs-es6.debug.js +84 -22
- package/dist/websy-designs-es6.js +312 -230
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +84 -22
- package/dist/websy-designs.js +312 -230
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -278,11 +278,13 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
278
278
|
this.currentselection = [];
|
|
279
279
|
this.validDates = [];
|
|
280
280
|
this.validYears = [];
|
|
281
|
+
this.validHours = [];
|
|
281
282
|
this.customRangeSelected = true;
|
|
282
283
|
this.shiftPressed = false;
|
|
283
284
|
var DEFAULTS = {
|
|
284
285
|
defaultRange: 0,
|
|
285
286
|
allowClear: true,
|
|
287
|
+
hideRanges: false,
|
|
286
288
|
minAllowedDate: this.floorDate(new Date(new Date(new Date().setFullYear(new Date().getFullYear() - 1)).setDate(1))),
|
|
287
289
|
maxAllowedDate: this.floorDate(new Date(new Date())),
|
|
288
290
|
minAllowedYear: 1970,
|
|
@@ -290,7 +292,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
290
292
|
daysOfWeek: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
|
|
291
293
|
monthsOfYear: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
292
294
|
hours: new Array(24).fill(0).map(function (d, i) {
|
|
293
|
-
return
|
|
295
|
+
return {
|
|
296
|
+
text: (i < 10 ? '0' : '') + i + ':00',
|
|
297
|
+
num: 1 / 24 * i
|
|
298
|
+
};
|
|
294
299
|
}),
|
|
295
300
|
mode: 'date',
|
|
296
301
|
monthMap: {
|
|
@@ -358,7 +363,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
358
363
|
label: 'Last 24 Months',
|
|
359
364
|
range: [this.floorDate(new Date(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() - 24))), this.floorDate(new Date(new Date().setDate(1)))]
|
|
360
365
|
}],
|
|
361
|
-
hour: [
|
|
366
|
+
hour: [{
|
|
367
|
+
label: 'All',
|
|
368
|
+
range: ['00:00', '23:00']
|
|
369
|
+
}]
|
|
362
370
|
};
|
|
363
371
|
this.options = _extends({}, DEFAULTS, options);
|
|
364
372
|
this.selectedRange = this.options.defaultRange || 0;
|
|
@@ -388,7 +396,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
388
396
|
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 ";
|
|
389
397
|
}
|
|
390
398
|
|
|
391
|
-
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 ");
|
|
399
|
+
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 ");
|
|
392
400
|
el.innerHTML = html;
|
|
393
401
|
this.render();
|
|
394
402
|
} else {
|
|
@@ -399,6 +407,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
399
407
|
_createClass(WebsyDatePicker, [{
|
|
400
408
|
key: "close",
|
|
401
409
|
value: function close(confirm) {
|
|
410
|
+
var _this2 = this;
|
|
411
|
+
|
|
402
412
|
var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
|
|
403
413
|
var contentEl = document.getElementById("".concat(this.elementId, "_content"));
|
|
404
414
|
var el = document.getElementById(this.elementId);
|
|
@@ -416,9 +426,27 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
416
426
|
console.log('confirm', this.currentselection);
|
|
417
427
|
|
|
418
428
|
if (this.customRangeSelected === true) {
|
|
419
|
-
this.options.
|
|
429
|
+
if (this.options.mode === 'hour') {
|
|
430
|
+
var hoursOut = [];
|
|
431
|
+
|
|
432
|
+
for (var i = this.selectedRangeDates[0]; i < this.selectedRangeDates[1] + 1; i++) {
|
|
433
|
+
hoursOut.push(this.options.hours[i]);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
this.options.onChange(hoursOut, true);
|
|
437
|
+
} else {
|
|
438
|
+
this.options.onChange(this.selectedRangeDates, true);
|
|
439
|
+
}
|
|
420
440
|
} else {
|
|
421
|
-
this.options.
|
|
441
|
+
if (this.options.mode === 'hour') {
|
|
442
|
+
var _hoursOut = this.selectedRangeDates.map(function (h) {
|
|
443
|
+
return _this2.options.hours[h];
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
this.options.onChange(_hoursOut, true);
|
|
447
|
+
} else {
|
|
448
|
+
this.options.onChange(this.currentselection, false);
|
|
449
|
+
}
|
|
422
450
|
}
|
|
423
451
|
}
|
|
424
452
|
|
|
@@ -534,7 +562,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
534
562
|
}, {
|
|
535
563
|
key: "highlightRange",
|
|
536
564
|
value: function highlightRange() {
|
|
537
|
-
var
|
|
565
|
+
var _this3 = this;
|
|
538
566
|
|
|
539
567
|
var el = document.getElementById("".concat(this.elementId, "_dateList"));
|
|
540
568
|
var dateEls = el.querySelectorAll('.websy-dp-date');
|
|
@@ -570,7 +598,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
570
598
|
diff = Math.floor(this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth() - this.selectedRangeDates[0].getMonth()) + yearDiff;
|
|
571
599
|
console.log('year diff', yearDiff);
|
|
572
600
|
console.log('diff', diff);
|
|
573
|
-
} else if (this.options.mode === 'hour') {
|
|
601
|
+
} else if (this.options.mode === 'hour') {
|
|
602
|
+
diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
|
|
574
603
|
}
|
|
575
604
|
|
|
576
605
|
for (var _i = 0; _i < diff + 1; _i++) {
|
|
@@ -591,7 +620,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
591
620
|
d = new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + _i);
|
|
592
621
|
rangeStart = this.selectedRangeDates[0].getTime();
|
|
593
622
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
594
|
-
} else if (this.options.mode === 'hour') {
|
|
623
|
+
} else if (this.options.mode === 'hour') {
|
|
624
|
+
d = this.selectedRangeDates[0] + _i;
|
|
625
|
+
rangeStart = this.selectedRangeDates[0];
|
|
626
|
+
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
595
627
|
}
|
|
596
628
|
|
|
597
629
|
var dateEl = void 0;
|
|
@@ -605,7 +637,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
605
637
|
console.log(this.selectedRangeDates);
|
|
606
638
|
console.log(rangeStart, rangeEnd);
|
|
607
639
|
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_monthyear"));
|
|
608
|
-
} else if (this.options.mode === 'hour') {
|
|
640
|
+
} else if (this.options.mode === 'hour') {
|
|
641
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_hour"));
|
|
609
642
|
}
|
|
610
643
|
|
|
611
644
|
if (dateEl) {
|
|
@@ -624,13 +657,14 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
624
657
|
this.currentselection.forEach(function (d) {
|
|
625
658
|
var dateEl;
|
|
626
659
|
|
|
627
|
-
if (
|
|
628
|
-
dateEl = document.getElementById("".concat(
|
|
629
|
-
} else if (
|
|
630
|
-
dateEl = document.getElementById("".concat(
|
|
631
|
-
} else if (
|
|
632
|
-
dateEl = document.getElementById("".concat(
|
|
633
|
-
} else if (
|
|
660
|
+
if (_this3.options.mode === 'date') {
|
|
661
|
+
dateEl = document.getElementById("".concat(_this3.elementId, "_").concat(d, "_date"));
|
|
662
|
+
} else if (_this3.options.mode === 'year') {
|
|
663
|
+
dateEl = document.getElementById("".concat(_this3.elementId, "_").concat(d, "_year"));
|
|
664
|
+
} else if (_this3.options.mode === 'monthyear') {
|
|
665
|
+
dateEl = document.getElementById("".concat(_this3.elementId, "_").concat(d, "_monthyear"));
|
|
666
|
+
} else if (_this3.options.mode === 'hour') {
|
|
667
|
+
dateEl = document.getElementById("".concat(_this3.elementId, "_").concat(d, "_hour"));
|
|
634
668
|
}
|
|
635
669
|
|
|
636
670
|
dateEl.classList.add('selected');
|
|
@@ -684,22 +718,24 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
684
718
|
}, {
|
|
685
719
|
key: "renderDates",
|
|
686
720
|
value: function renderDates(disabledDates) {
|
|
687
|
-
var
|
|
721
|
+
var _this4 = this;
|
|
688
722
|
|
|
689
723
|
var disabled = [];
|
|
690
724
|
this.validDates = [];
|
|
691
725
|
this.validYears = [];
|
|
726
|
+
this.validHours = [];
|
|
692
727
|
this.monthYears = {};
|
|
693
728
|
this.monthYearMonths = [];
|
|
694
729
|
|
|
695
730
|
if (disabledDates) {
|
|
696
731
|
disabled = disabledDates.map(function (d) {
|
|
697
|
-
if (
|
|
732
|
+
if (_this4.options.mode === 'date') {
|
|
698
733
|
return d.getTime();
|
|
699
|
-
} else if (
|
|
734
|
+
} else if (_this4.options.mode === 'year') {
|
|
735
|
+
return d;
|
|
736
|
+
} else if (_this4.options.mode === 'monthyear') {//
|
|
737
|
+
} else if (_this4.options.mode === 'hour') {
|
|
700
738
|
return d;
|
|
701
|
-
} else if (_this3.options.mode === 'monthyear') {//
|
|
702
|
-
} else if (_this3.options.mode === 'hour') {//
|
|
703
739
|
}
|
|
704
740
|
|
|
705
741
|
return d.getTime();
|
|
@@ -718,7 +754,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
718
754
|
diff = this.options.maxAllowedYear - this.options.minAllowedYear + 1;
|
|
719
755
|
} else if (this.options.mode === 'monthyear') {
|
|
720
756
|
diff = Math.ceil((this.options.maxAllowedDate.getTime() - this.options.minAllowedDate.getTime()) / this.oneDay) + 1;
|
|
721
|
-
} else if (this.options.mode === 'hour') {
|
|
757
|
+
} else if (this.options.mode === 'hour') {
|
|
758
|
+
diff = 24;
|
|
722
759
|
}
|
|
723
760
|
|
|
724
761
|
var months = {};
|
|
@@ -739,12 +776,13 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
739
776
|
|
|
740
777
|
if (this.monthYearMonths.indexOf("".concat(d.getMonth(), "-").concat(d.getFullYear())) === -1) {
|
|
741
778
|
this.monthYearMonths.push("".concat(d.getMonth(), "-").concat(d.getFullYear()));
|
|
779
|
+
var firstOfMonth = new Date(new Date(d).setDate(1));
|
|
742
780
|
this.monthYears[d.getFullYear()].push({
|
|
743
|
-
date:
|
|
781
|
+
date: firstOfMonth,
|
|
744
782
|
month: this.options.monthMap[d.getMonth()],
|
|
745
783
|
monthNum: d.getMonth(),
|
|
746
784
|
year: d.getFullYear(),
|
|
747
|
-
id:
|
|
785
|
+
id: firstOfMonth.getTime()
|
|
748
786
|
});
|
|
749
787
|
}
|
|
750
788
|
|
|
@@ -771,8 +809,16 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
771
809
|
if (disabled.indexOf(_d) === -1) {
|
|
772
810
|
this.validYears.push(_d);
|
|
773
811
|
}
|
|
774
|
-
} else if (this.options.mode === 'hour') {//
|
|
812
|
+
} else if (this.options.mode === 'hour') {//
|
|
775
813
|
}
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
if (this.options.mode === 'hour') {
|
|
817
|
+
this.options.hours.forEach(function (h) {
|
|
818
|
+
if (disabled.indexOf(h.text) === -1) {
|
|
819
|
+
_this4.validHours.push(h);
|
|
820
|
+
}
|
|
821
|
+
});
|
|
776
822
|
} // check each range to see if it can be enabled
|
|
777
823
|
|
|
778
824
|
|
|
@@ -816,7 +862,22 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
816
862
|
}
|
|
817
863
|
}
|
|
818
864
|
} else if (this.options.mode === 'monthyear') {//
|
|
819
|
-
} else if (this.options.mode === 'hour') {
|
|
865
|
+
} else if (this.options.mode === 'hour') {
|
|
866
|
+
if (this.validDates.indexOf(r.range[0]) !== -1) {
|
|
867
|
+
r.disabled = false;
|
|
868
|
+
} else if (r.range[1]) {
|
|
869
|
+
if (this.validDates.indexOf(r.range[1]) !== -1) {
|
|
870
|
+
r.disabled = false;
|
|
871
|
+
} else {
|
|
872
|
+
// check the full range until a match is found
|
|
873
|
+
for (var _i5 = r.range[0]; _i5 <= r.range[1]; _i5++) {
|
|
874
|
+
if (this.validDates.indexOf(r.range[0] + _i5) !== -1) {
|
|
875
|
+
r.disabled = false;
|
|
876
|
+
break;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
820
881
|
}
|
|
821
882
|
}
|
|
822
883
|
|
|
@@ -835,7 +896,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
835
896
|
if (months[key][0].dayOfWeek > 0) {
|
|
836
897
|
var paddedDays = [];
|
|
837
898
|
|
|
838
|
-
for (var
|
|
899
|
+
for (var _i6 = 0; _i6 < months[key][0].dayOfWeek; _i6++) {
|
|
839
900
|
paddedDays.push("<li> </li>");
|
|
840
901
|
}
|
|
841
902
|
|
|
@@ -843,7 +904,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
843
904
|
}
|
|
844
905
|
|
|
845
906
|
html += months[key].map(function (d) {
|
|
846
|
-
return "<li id='".concat(
|
|
907
|
+
return "<li id='".concat(_this4.elementId, "_").concat(d.id, "_date' class='websy-dp-date ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.dayOfMonth, "</li>");
|
|
847
908
|
}).join('');
|
|
848
909
|
html += "\n </ul>\n </div>\n ";
|
|
849
910
|
}
|
|
@@ -856,7 +917,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
856
917
|
|
|
857
918
|
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'><ul>");
|
|
858
919
|
html += yearList.map(function (d) {
|
|
859
|
-
return "<li id='".concat(
|
|
920
|
+
return "<li id='".concat(_this4.elementId, "_").concat(d.id, "_year' class='websy-dp-date websy-dp-year ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.year, "</li>");
|
|
860
921
|
}).join('');
|
|
861
922
|
html += "</ul></div>";
|
|
862
923
|
} else if (this.options.mode === 'monthyear') {
|
|
@@ -868,7 +929,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
868
929
|
if (this.monthYears[year][0].monthNum > 0) {
|
|
869
930
|
var paddedMonths = [];
|
|
870
931
|
|
|
871
|
-
for (var
|
|
932
|
+
for (var _i7 = 0; _i7 < this.monthYears[year][0].monthNum; _i7++) {
|
|
872
933
|
paddedMonths.push("<li> </li>");
|
|
873
934
|
}
|
|
874
935
|
|
|
@@ -876,13 +937,18 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
876
937
|
}
|
|
877
938
|
|
|
878
939
|
html += this.monthYears[year].map(function (d) {
|
|
879
|
-
return "<li id='".concat(
|
|
940
|
+
return "<li id='".concat(_this4.elementId, "_").concat(d.id, "_monthyear' data-year='").concat(d.year, "' class='websy-dp-date websy-dp-monthyear'>").concat(d.month, "</li>");
|
|
880
941
|
}).join('');
|
|
881
942
|
html += "</ul>";
|
|
882
943
|
}
|
|
883
944
|
|
|
884
945
|
html += "</div>";
|
|
885
|
-
} else if (this.options.mode === 'hour') {
|
|
946
|
+
} else if (this.options.mode === 'hour') {
|
|
947
|
+
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'><ul>");
|
|
948
|
+
html += this.options.hours.map(function (h) {
|
|
949
|
+
return "<li id='".concat(_this4.elementId, "_").concat(+h.text.split(':')[0], "_hour' data-hour='").concat(h.text, "' class='websy-dp-date websy-dp-hour'>").concat(h.text, "</li>");
|
|
950
|
+
}).join('');
|
|
951
|
+
html += "</ul></div>";
|
|
886
952
|
}
|
|
887
953
|
|
|
888
954
|
return html;
|
|
@@ -890,10 +956,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
890
956
|
}, {
|
|
891
957
|
key: "renderRanges",
|
|
892
958
|
value: function renderRanges() {
|
|
893
|
-
var
|
|
959
|
+
var _this5 = this;
|
|
894
960
|
|
|
895
961
|
return this.options.ranges[this.options.mode].map(function (r, i) {
|
|
896
|
-
return "\n <li data-index='".concat(i, "' class='websy-date-picker-range ").concat(i ===
|
|
962
|
+
return "\n <li data-index='".concat(i, "' class='websy-date-picker-range ").concat(i === _this5.selectedRange ? 'active' : '', " ").concat(r.disabled === true ? 'websy-disabled-range' : '', "'>").concat(r.label, "</li>\n ");
|
|
897
963
|
}).join('') + "<li data-index='-1' class='websy-date-picker-range ".concat(this.selectedRange === -1 ? 'active' : '', "'>Custom</li>");
|
|
898
964
|
}
|
|
899
965
|
}, {
|
|
@@ -939,7 +1005,14 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
939
1005
|
this.customRangeSelected = true;
|
|
940
1006
|
console.log('current selection', this.currentselection);
|
|
941
1007
|
} else {
|
|
942
|
-
this.currentselection.
|
|
1008
|
+
var index = this.currentselection.indexOf(timestamp);
|
|
1009
|
+
|
|
1010
|
+
if (index !== -1) {
|
|
1011
|
+
this.currentselection.splice(index, 1);
|
|
1012
|
+
} else {
|
|
1013
|
+
this.currentselection.push(timestamp);
|
|
1014
|
+
}
|
|
1015
|
+
|
|
943
1016
|
this.currentselection.sort(function (a, b) {
|
|
944
1017
|
return a - b;
|
|
945
1018
|
});
|
|
@@ -953,7 +1026,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
953
1026
|
} else if (this.options.mode === 'year') {
|
|
954
1027
|
this.selectedRangeDates = [this.currentselection[0], this.currentselection[1] || this.currentselection[0]];
|
|
955
1028
|
} else if (this.options.mode === 'monthyear') {//
|
|
956
|
-
} else if (this.options.mode === 'hour') {
|
|
1029
|
+
} else if (this.options.mode === 'hour') {
|
|
1030
|
+
this.selectedRangeDates = [this.currentselection[0], this.currentselection[1] || this.currentselection[0]];
|
|
957
1031
|
} // if (this.currentselection.length === 2) {
|
|
958
1032
|
// this.currentselection = []
|
|
959
1033
|
// }
|
|
@@ -1022,33 +1096,36 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1022
1096
|
} else if (this.options.mode === 'monthyear') {
|
|
1023
1097
|
this.options.minAllowedDate = range[0];
|
|
1024
1098
|
this.options.maxAllowedDate = range[1] || range[0];
|
|
1025
|
-
} else if (this.options.mode === 'hour') {
|
|
1099
|
+
} else if (this.options.mode === 'hour') {
|
|
1100
|
+
this.options.minAllowedHour = range[0];
|
|
1101
|
+
this.options.maxAllowedHour = range[1] || range[0];
|
|
1026
1102
|
}
|
|
1027
1103
|
}
|
|
1028
1104
|
}, {
|
|
1029
1105
|
key: "updateRange",
|
|
1030
1106
|
value: function updateRange() {
|
|
1031
|
-
var
|
|
1107
|
+
var _this6 = this;
|
|
1032
1108
|
|
|
1033
1109
|
var range;
|
|
1034
1110
|
|
|
1035
1111
|
if (this.selectedRange === -1) {
|
|
1036
1112
|
var list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(function (d) {
|
|
1037
|
-
if (
|
|
1113
|
+
if (_this6.options.mode === 'date') {
|
|
1038
1114
|
if (!d.toLocaleDateString) {
|
|
1039
1115
|
d = new Date(d);
|
|
1040
1116
|
}
|
|
1041
1117
|
|
|
1042
1118
|
return d.toLocaleDateString();
|
|
1043
|
-
} else if (
|
|
1119
|
+
} else if (_this6.options.mode === 'year') {
|
|
1044
1120
|
return d;
|
|
1045
|
-
} else if (
|
|
1121
|
+
} else if (_this6.options.mode === 'monthyear') {
|
|
1046
1122
|
if (!d.getMonth) {
|
|
1047
1123
|
d = new Date(d);
|
|
1048
1124
|
}
|
|
1049
1125
|
|
|
1050
|
-
return "".concat(
|
|
1051
|
-
} else if (
|
|
1126
|
+
return "".concat(_this6.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
1127
|
+
} else if (_this6.options.mode === 'hour') {
|
|
1128
|
+
return d;
|
|
1052
1129
|
}
|
|
1053
1130
|
});
|
|
1054
1131
|
var start = list[0];
|
|
@@ -1060,6 +1137,11 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1060
1137
|
start = "".concat(list.length, " selected");
|
|
1061
1138
|
}
|
|
1062
1139
|
|
|
1140
|
+
if (this.options.mode === 'hour') {
|
|
1141
|
+
start = this.options.hours[start].text;
|
|
1142
|
+
end = "".concat(this.customRangeSelected === true ? ' - ' : '').concat(this.options.hours[list[list.length - 1]].text);
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1063
1145
|
range = {
|
|
1064
1146
|
label: "".concat(start).concat(end)
|
|
1065
1147
|
};
|
|
@@ -1096,7 +1178,7 @@ Date.prototype.floor = function () {
|
|
|
1096
1178
|
|
|
1097
1179
|
var WebsyDropdown = /*#__PURE__*/function () {
|
|
1098
1180
|
function WebsyDropdown(elementId, options) {
|
|
1099
|
-
var
|
|
1181
|
+
var _this7 = this;
|
|
1100
1182
|
|
|
1101
1183
|
_classCallCheck(this, WebsyDropdown);
|
|
1102
1184
|
|
|
@@ -1140,10 +1222,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1140
1222
|
el.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
1141
1223
|
el.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
1142
1224
|
var headerLabel = this.selectedItems.map(function (s) {
|
|
1143
|
-
return
|
|
1225
|
+
return _this7.options.items[s].label || _this7.options.items[s].value;
|
|
1144
1226
|
}).join(this.options.multiValueDelimiter);
|
|
1145
1227
|
var headerValue = this.selectedItems.map(function (s) {
|
|
1146
|
-
return
|
|
1228
|
+
return _this7.options.items[s].value || _this7.options.items[s].label;
|
|
1147
1229
|
}).join(this.options.multiValueDelimiter);
|
|
1148
1230
|
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 ");
|
|
1149
1231
|
|
|
@@ -1426,10 +1508,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1426
1508
|
}, {
|
|
1427
1509
|
key: "renderItems",
|
|
1428
1510
|
value: function renderItems() {
|
|
1429
|
-
var
|
|
1511
|
+
var _this8 = this;
|
|
1430
1512
|
|
|
1431
1513
|
var html = this.options.items.map(function (r, i) {
|
|
1432
|
-
return "\n <li data-index='".concat(r.index, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(
|
|
1514
|
+
return "\n <li data-index='".concat(r.index, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(_this8.selectedItems.indexOf(r.index) !== -1 ? 'active' : '', "'>").concat(r.label, "</li>\n ");
|
|
1433
1515
|
}).join('');
|
|
1434
1516
|
var el = document.getElementById("".concat(this.elementId, "_items"));
|
|
1435
1517
|
|
|
@@ -1448,7 +1530,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1448
1530
|
}, {
|
|
1449
1531
|
key: "updateHeader",
|
|
1450
1532
|
value: function updateHeader(item) {
|
|
1451
|
-
var
|
|
1533
|
+
var _this9 = this;
|
|
1452
1534
|
|
|
1453
1535
|
var el = document.getElementById(this.elementId);
|
|
1454
1536
|
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
@@ -1495,17 +1577,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1495
1577
|
} else if (this.selectedItems.length > 1) {
|
|
1496
1578
|
if (this.options.showCompleteSelectedList === true) {
|
|
1497
1579
|
var selectedLabels = this.selectedItems.map(function (s) {
|
|
1498
|
-
return
|
|
1580
|
+
return _this9.options.items[s].label || _this9.options.items[s].value;
|
|
1499
1581
|
}).join(this.options.multiValueDelimiter);
|
|
1500
1582
|
var selectedValues = this.selectedItems.map(function (s) {
|
|
1501
|
-
return
|
|
1583
|
+
return _this9.options.items[s].value || _this9.options.items[s].label;
|
|
1502
1584
|
}).join(this.options.multiValueDelimiter);
|
|
1503
1585
|
labelEl.innerHTML = selectedLabels;
|
|
1504
1586
|
labelEl.setAttribute('data-info', selectedLabels);
|
|
1505
1587
|
inputEl.value = selectedValues;
|
|
1506
1588
|
} else {
|
|
1507
1589
|
var _selectedValues = this.selectedItems.map(function (s) {
|
|
1508
|
-
return
|
|
1590
|
+
return _this9.options.items[s].value || _this9.options.items[s].label;
|
|
1509
1591
|
}).join(this.options.multiValueDelimiter);
|
|
1510
1592
|
|
|
1511
1593
|
labelEl.innerHTML = "".concat(this.selectedItems.length, " selected");
|
|
@@ -1642,16 +1724,16 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1642
1724
|
}, {
|
|
1643
1725
|
key: "checkRecaptcha",
|
|
1644
1726
|
value: function checkRecaptcha() {
|
|
1645
|
-
var
|
|
1727
|
+
var _this10 = this;
|
|
1646
1728
|
|
|
1647
1729
|
return new Promise(function (resolve, reject) {
|
|
1648
|
-
if (
|
|
1730
|
+
if (_this10.options.useRecaptcha === true) {
|
|
1649
1731
|
// if (this.recaptchaValue) {
|
|
1650
1732
|
grecaptcha.ready(function () {
|
|
1651
1733
|
grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
|
|
1652
1734
|
action: 'submit'
|
|
1653
1735
|
}).then(function (token) {
|
|
1654
|
-
|
|
1736
|
+
_this10.apiService.add('google/checkrecaptcha', {
|
|
1655
1737
|
grecaptcharesponse: token
|
|
1656
1738
|
}).then(function (response) {
|
|
1657
1739
|
if (response.success && response.success === true) {
|
|
@@ -1714,14 +1796,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1714
1796
|
}, {
|
|
1715
1797
|
key: "processComponents",
|
|
1716
1798
|
value: function processComponents(components, callbackFn) {
|
|
1717
|
-
var
|
|
1799
|
+
var _this11 = this;
|
|
1718
1800
|
|
|
1719
1801
|
if (components.length === 0) {
|
|
1720
1802
|
callbackFn();
|
|
1721
1803
|
} else {
|
|
1722
1804
|
components.forEach(function (c) {
|
|
1723
1805
|
if (typeof WebsyDesigns[c.component] !== 'undefined') {
|
|
1724
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
1806
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this11.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
1725
1807
|
} else {// some user feedback here
|
|
1726
1808
|
}
|
|
1727
1809
|
});
|
|
@@ -1742,7 +1824,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1742
1824
|
}, {
|
|
1743
1825
|
key: "render",
|
|
1744
1826
|
value: function render(update, data) {
|
|
1745
|
-
var
|
|
1827
|
+
var _this12 = this;
|
|
1746
1828
|
|
|
1747
1829
|
var el = document.getElementById(this.elementId);
|
|
1748
1830
|
var componentsToProcess = [];
|
|
@@ -1752,11 +1834,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1752
1834
|
this.options.fields.forEach(function (f, i) {
|
|
1753
1835
|
if (f.component) {
|
|
1754
1836
|
componentsToProcess.push(f);
|
|
1755
|
-
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(
|
|
1837
|
+
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(_this12.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
|
|
1756
1838
|
} else if (f.type === 'longtext') {
|
|
1757
|
-
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(
|
|
1839
|
+
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(_this12.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 ");
|
|
1758
1840
|
} else {
|
|
1759
|
-
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(
|
|
1841
|
+
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(_this12.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 ");
|
|
1760
1842
|
}
|
|
1761
1843
|
});
|
|
1762
1844
|
html += "\n --><button class=\"websy-btn submit ".concat(this.options.submit.classes || '', "\">").concat(this.options.submit.text || 'Save', "</button>").concat(this.options.cancel ? '<!--' : '', "\n ");
|
|
@@ -1773,7 +1855,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1773
1855
|
|
|
1774
1856
|
el.innerHTML = html;
|
|
1775
1857
|
this.processComponents(componentsToProcess, function () {
|
|
1776
|
-
if (
|
|
1858
|
+
if (_this12.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
|
|
1777
1859
|
}
|
|
1778
1860
|
});
|
|
1779
1861
|
}
|
|
@@ -1781,7 +1863,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1781
1863
|
}, {
|
|
1782
1864
|
key: "submitForm",
|
|
1783
1865
|
value: function submitForm() {
|
|
1784
|
-
var
|
|
1866
|
+
var _this13 = this;
|
|
1785
1867
|
|
|
1786
1868
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
1787
1869
|
|
|
@@ -1795,32 +1877,32 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1795
1877
|
data[key] = value;
|
|
1796
1878
|
});
|
|
1797
1879
|
|
|
1798
|
-
if (
|
|
1799
|
-
var
|
|
1880
|
+
if (_this13.options.url) {
|
|
1881
|
+
var _this13$apiService;
|
|
1800
1882
|
|
|
1801
|
-
var params = [
|
|
1883
|
+
var params = [_this13.options.url];
|
|
1802
1884
|
|
|
1803
|
-
if (
|
|
1804
|
-
params.push(
|
|
1885
|
+
if (_this13.options.mode === 'update') {
|
|
1886
|
+
params.push(_this13.options.id);
|
|
1805
1887
|
}
|
|
1806
1888
|
|
|
1807
1889
|
params.push(data);
|
|
1808
1890
|
|
|
1809
|
-
(
|
|
1810
|
-
if (
|
|
1891
|
+
(_this13$apiService = _this13.apiService)[_this13.options.mode].apply(_this13$apiService, params).then(function (result) {
|
|
1892
|
+
if (_this13.options.clearAfterSave === true) {
|
|
1811
1893
|
// this.render()
|
|
1812
1894
|
formEl.reset();
|
|
1813
1895
|
}
|
|
1814
1896
|
|
|
1815
|
-
|
|
1897
|
+
_this13.options.onSuccess.call(_this13, result);
|
|
1816
1898
|
}, function (err) {
|
|
1817
1899
|
console.log('Error submitting form data:', err);
|
|
1818
1900
|
|
|
1819
|
-
|
|
1901
|
+
_this13.options.onError.call(_this13, err);
|
|
1820
1902
|
});
|
|
1821
|
-
} else if (
|
|
1822
|
-
|
|
1823
|
-
if (
|
|
1903
|
+
} else if (_this13.options.submitFn) {
|
|
1904
|
+
_this13.options.submitFn(data, function () {
|
|
1905
|
+
if (_this13.options.clearAfterSave === true) {
|
|
1824
1906
|
// this.render()
|
|
1825
1907
|
formEl.reset();
|
|
1826
1908
|
}
|
|
@@ -1840,17 +1922,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1840
1922
|
}, {
|
|
1841
1923
|
key: "data",
|
|
1842
1924
|
set: function set(d) {
|
|
1843
|
-
var
|
|
1925
|
+
var _this14 = this;
|
|
1844
1926
|
|
|
1845
1927
|
if (!this.options.fields) {
|
|
1846
1928
|
this.options.fields = [];
|
|
1847
1929
|
}
|
|
1848
1930
|
|
|
1849
1931
|
var _loop = function _loop(key) {
|
|
1850
|
-
|
|
1932
|
+
_this14.options.fields.forEach(function (f) {
|
|
1851
1933
|
if (f.field === key) {
|
|
1852
1934
|
f.value = d[key];
|
|
1853
|
-
var el = document.getElementById("".concat(
|
|
1935
|
+
var el = document.getElementById("".concat(_this14.elementId, "_input_").concat(f.field));
|
|
1854
1936
|
el.value = f.value;
|
|
1855
1937
|
}
|
|
1856
1938
|
});
|
|
@@ -2162,7 +2244,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2162
2244
|
|
|
2163
2245
|
var Pager = /*#__PURE__*/function () {
|
|
2164
2246
|
function Pager(elementId, options) {
|
|
2165
|
-
var
|
|
2247
|
+
var _this15 = this;
|
|
2166
2248
|
|
|
2167
2249
|
_classCallCheck(this, Pager);
|
|
2168
2250
|
|
|
@@ -2215,8 +2297,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2215
2297
|
allowClear: false,
|
|
2216
2298
|
disableSearch: true,
|
|
2217
2299
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
2218
|
-
if (
|
|
2219
|
-
|
|
2300
|
+
if (_this15.options.onChangePageSize) {
|
|
2301
|
+
_this15.options.onChangePageSize(selectedItem.value);
|
|
2220
2302
|
}
|
|
2221
2303
|
}
|
|
2222
2304
|
});
|
|
@@ -2240,13 +2322,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2240
2322
|
}, {
|
|
2241
2323
|
key: "render",
|
|
2242
2324
|
value: function render() {
|
|
2243
|
-
var
|
|
2325
|
+
var _this16 = this;
|
|
2244
2326
|
|
|
2245
2327
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
2246
2328
|
|
|
2247
2329
|
if (el) {
|
|
2248
2330
|
var pages = this.options.pages.map(function (item, index) {
|
|
2249
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
2331
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this16.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
2250
2332
|
});
|
|
2251
2333
|
var startIndex = 0;
|
|
2252
2334
|
|
|
@@ -2314,58 +2396,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2314
2396
|
_createClass(WebsyPDFButton, [{
|
|
2315
2397
|
key: "handleClick",
|
|
2316
2398
|
value: function handleClick(event) {
|
|
2317
|
-
var
|
|
2399
|
+
var _this17 = this;
|
|
2318
2400
|
|
|
2319
2401
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
2320
2402
|
this.loader.show();
|
|
2321
2403
|
setTimeout(function () {
|
|
2322
|
-
if (
|
|
2323
|
-
var el = document.getElementById(
|
|
2404
|
+
if (_this17.options.targetId) {
|
|
2405
|
+
var el = document.getElementById(_this17.options.targetId);
|
|
2324
2406
|
|
|
2325
2407
|
if (el) {
|
|
2326
2408
|
var pdfData = {
|
|
2327
2409
|
options: {}
|
|
2328
2410
|
};
|
|
2329
2411
|
|
|
2330
|
-
if (
|
|
2331
|
-
pdfData.options = _extends({},
|
|
2412
|
+
if (_this17.options.pdfOptions) {
|
|
2413
|
+
pdfData.options = _extends({}, _this17.options.pdfOptions);
|
|
2332
2414
|
}
|
|
2333
2415
|
|
|
2334
|
-
if (
|
|
2335
|
-
if (
|
|
2336
|
-
var headerEl = document.getElementById(
|
|
2416
|
+
if (_this17.options.header) {
|
|
2417
|
+
if (_this17.options.header.elementId) {
|
|
2418
|
+
var headerEl = document.getElementById(_this17.options.header.elementId);
|
|
2337
2419
|
|
|
2338
2420
|
if (headerEl) {
|
|
2339
2421
|
pdfData.header = headerEl.outerHTML;
|
|
2340
2422
|
|
|
2341
|
-
if (
|
|
2342
|
-
pdfData.options.headerCSS =
|
|
2423
|
+
if (_this17.options.header.css) {
|
|
2424
|
+
pdfData.options.headerCSS = _this17.options.header.css;
|
|
2343
2425
|
}
|
|
2344
2426
|
}
|
|
2345
|
-
} else if (
|
|
2346
|
-
pdfData.header =
|
|
2427
|
+
} else if (_this17.options.header.html) {
|
|
2428
|
+
pdfData.header = _this17.options.header.html;
|
|
2347
2429
|
|
|
2348
|
-
if (
|
|
2349
|
-
pdfData.options.headerCSS =
|
|
2430
|
+
if (_this17.options.header.css) {
|
|
2431
|
+
pdfData.options.headerCSS = _this17.options.header.css;
|
|
2350
2432
|
}
|
|
2351
2433
|
} else {
|
|
2352
|
-
pdfData.header =
|
|
2434
|
+
pdfData.header = _this17.options.header;
|
|
2353
2435
|
}
|
|
2354
2436
|
}
|
|
2355
2437
|
|
|
2356
|
-
if (
|
|
2357
|
-
if (
|
|
2358
|
-
var footerEl = document.getElementById(
|
|
2438
|
+
if (_this17.options.footer) {
|
|
2439
|
+
if (_this17.options.footer.elementId) {
|
|
2440
|
+
var footerEl = document.getElementById(_this17.options.footer.elementId);
|
|
2359
2441
|
|
|
2360
2442
|
if (footerEl) {
|
|
2361
2443
|
pdfData.footer = footerEl.outerHTML;
|
|
2362
2444
|
|
|
2363
|
-
if (
|
|
2364
|
-
pdfData.options.footerCSS =
|
|
2445
|
+
if (_this17.options.footer.css) {
|
|
2446
|
+
pdfData.options.footerCSS = _this17.options.footer.css;
|
|
2365
2447
|
}
|
|
2366
2448
|
}
|
|
2367
2449
|
} else {
|
|
2368
|
-
pdfData.footer =
|
|
2450
|
+
pdfData.footer = _this17.options.footer;
|
|
2369
2451
|
}
|
|
2370
2452
|
}
|
|
2371
2453
|
|
|
@@ -2374,31 +2456,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2374
2456
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
2375
2457
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
2376
2458
|
|
|
2377
|
-
|
|
2459
|
+
_this17.service.add('', pdfData, {
|
|
2378
2460
|
responseType: 'blob'
|
|
2379
2461
|
}).then(function (response) {
|
|
2380
|
-
|
|
2462
|
+
_this17.loader.hide();
|
|
2381
2463
|
|
|
2382
2464
|
var blob = new Blob([response], {
|
|
2383
2465
|
type: 'application/pdf'
|
|
2384
2466
|
});
|
|
2385
2467
|
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 ");
|
|
2386
2468
|
|
|
2387
|
-
if (
|
|
2469
|
+
if (_this17.options.directDownload === true) {
|
|
2388
2470
|
var fileName;
|
|
2389
2471
|
|
|
2390
|
-
if (typeof
|
|
2391
|
-
fileName =
|
|
2472
|
+
if (typeof _this17.options.fileName === 'function') {
|
|
2473
|
+
fileName = _this17.options.fileName() || 'Export';
|
|
2392
2474
|
} else {
|
|
2393
|
-
fileName =
|
|
2475
|
+
fileName = _this17.options.fileName || 'Export';
|
|
2394
2476
|
}
|
|
2395
2477
|
|
|
2396
2478
|
msg += "download='".concat(fileName, ".pdf'");
|
|
2397
2479
|
}
|
|
2398
2480
|
|
|
2399
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
2481
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this17.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
2400
2482
|
|
|
2401
|
-
|
|
2483
|
+
_this17.popup.show({
|
|
2402
2484
|
message: msg,
|
|
2403
2485
|
mask: true
|
|
2404
2486
|
});
|
|
@@ -2583,7 +2665,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
2583
2665
|
|
|
2584
2666
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
2585
2667
|
function ResponsiveText(elementId, options) {
|
|
2586
|
-
var
|
|
2668
|
+
var _this18 = this;
|
|
2587
2669
|
|
|
2588
2670
|
_classCallCheck(this, ResponsiveText);
|
|
2589
2671
|
|
|
@@ -2596,7 +2678,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
2596
2678
|
this.elementId = elementId;
|
|
2597
2679
|
this.canvas = document.createElement('canvas');
|
|
2598
2680
|
window.addEventListener('resize', function () {
|
|
2599
|
-
return
|
|
2681
|
+
return _this18.render();
|
|
2600
2682
|
});
|
|
2601
2683
|
var el = document.getElementById(this.elementId);
|
|
2602
2684
|
|
|
@@ -2815,7 +2897,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
2815
2897
|
|
|
2816
2898
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
2817
2899
|
function WebsyResultList(elementId, options) {
|
|
2818
|
-
var
|
|
2900
|
+
var _this19 = this;
|
|
2819
2901
|
|
|
2820
2902
|
_classCallCheck(this, WebsyResultList);
|
|
2821
2903
|
|
|
@@ -2843,9 +2925,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2843
2925
|
|
|
2844
2926
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
2845
2927
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
2846
|
-
|
|
2928
|
+
_this19.options.template = templateString;
|
|
2847
2929
|
|
|
2848
|
-
|
|
2930
|
+
_this19.render();
|
|
2849
2931
|
});
|
|
2850
2932
|
} else {
|
|
2851
2933
|
this.render();
|
|
@@ -2864,7 +2946,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2864
2946
|
}, {
|
|
2865
2947
|
key: "buildHTML",
|
|
2866
2948
|
value: function buildHTML(d) {
|
|
2867
|
-
var
|
|
2949
|
+
var _this20 = this;
|
|
2868
2950
|
|
|
2869
2951
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
2870
2952
|
var html = "";
|
|
@@ -2872,7 +2954,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2872
2954
|
if (this.options.template) {
|
|
2873
2955
|
if (d.length > 0) {
|
|
2874
2956
|
d.forEach(function (row, ix) {
|
|
2875
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(
|
|
2957
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(_this20.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
2876
2958
|
|
|
2877
2959
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
2878
2960
|
|
|
@@ -2992,7 +3074,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2992
3074
|
}, {
|
|
2993
3075
|
key: "handleClick",
|
|
2994
3076
|
value: function handleClick(event) {
|
|
2995
|
-
var
|
|
3077
|
+
var _this21 = this;
|
|
2996
3078
|
|
|
2997
3079
|
if (event.target.classList.contains('clickable')) {
|
|
2998
3080
|
var l = event.target.getAttribute('data-event');
|
|
@@ -3010,8 +3092,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3010
3092
|
l = l[0];
|
|
3011
3093
|
params = params.map(function (p) {
|
|
3012
3094
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
3013
|
-
if (
|
|
3014
|
-
p =
|
|
3095
|
+
if (_this21.rows[+id]) {
|
|
3096
|
+
p = _this21.rows[+id][p];
|
|
3015
3097
|
}
|
|
3016
3098
|
} else if (typeof p === 'string') {
|
|
3017
3099
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -3033,13 +3115,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3033
3115
|
}, {
|
|
3034
3116
|
key: "render",
|
|
3035
3117
|
value: function render() {
|
|
3036
|
-
var
|
|
3118
|
+
var _this22 = this;
|
|
3037
3119
|
|
|
3038
3120
|
if (this.options.entity) {
|
|
3039
3121
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3040
|
-
|
|
3122
|
+
_this22.rows = results.rows;
|
|
3041
3123
|
|
|
3042
|
-
|
|
3124
|
+
_this22.resize();
|
|
3043
3125
|
});
|
|
3044
3126
|
} else {
|
|
3045
3127
|
this.resize();
|
|
@@ -3118,14 +3200,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3118
3200
|
_createClass(WebsyRouter, [{
|
|
3119
3201
|
key: "addGroup",
|
|
3120
3202
|
value: function addGroup(group) {
|
|
3121
|
-
var
|
|
3203
|
+
var _this23 = this;
|
|
3122
3204
|
|
|
3123
3205
|
if (!this.groups[group]) {
|
|
3124
3206
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3125
3207
|
|
|
3126
3208
|
if (els) {
|
|
3127
3209
|
this.getClosestParent(els[0], function (parent) {
|
|
3128
|
-
|
|
3210
|
+
_this23.groups[group] = {
|
|
3129
3211
|
activeView: '',
|
|
3130
3212
|
views: [],
|
|
3131
3213
|
parent: parent.getAttribute('data-view')
|
|
@@ -3450,12 +3532,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3450
3532
|
}, {
|
|
3451
3533
|
key: "showComponents",
|
|
3452
3534
|
value: function showComponents(view) {
|
|
3453
|
-
var
|
|
3535
|
+
var _this24 = this;
|
|
3454
3536
|
|
|
3455
3537
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
3456
3538
|
this.options.views[view].components.forEach(function (c) {
|
|
3457
3539
|
if (typeof c.instance === 'undefined') {
|
|
3458
|
-
|
|
3540
|
+
_this24.prepComponent(c.elementId, c.options);
|
|
3459
3541
|
|
|
3460
3542
|
c.instance = new c.Component(c.elementId, c.options);
|
|
3461
3543
|
} else if (c.instance.render) {
|
|
@@ -3824,7 +3906,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
3824
3906
|
|
|
3825
3907
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
3826
3908
|
function WebsyTemplate(elementId, options) {
|
|
3827
|
-
var
|
|
3909
|
+
var _this25 = this;
|
|
3828
3910
|
|
|
3829
3911
|
_classCallCheck(this, WebsyTemplate);
|
|
3830
3912
|
|
|
@@ -3850,9 +3932,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3850
3932
|
|
|
3851
3933
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3852
3934
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3853
|
-
|
|
3935
|
+
_this25.options.template = templateString;
|
|
3854
3936
|
|
|
3855
|
-
|
|
3937
|
+
_this25.render();
|
|
3856
3938
|
});
|
|
3857
3939
|
} else {
|
|
3858
3940
|
this.render();
|
|
@@ -3862,7 +3944,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3862
3944
|
_createClass(WebsyTemplate, [{
|
|
3863
3945
|
key: "buildHTML",
|
|
3864
3946
|
value: function buildHTML() {
|
|
3865
|
-
var
|
|
3947
|
+
var _this26 = this;
|
|
3866
3948
|
|
|
3867
3949
|
var html = "";
|
|
3868
3950
|
|
|
@@ -3924,14 +4006,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3924
4006
|
}
|
|
3925
4007
|
|
|
3926
4008
|
if (polarity === true) {
|
|
3927
|
-
if (typeof
|
|
4009
|
+
if (typeof _this26.options.data[parts[0]] !== 'undefined' && _this26.options.data[parts[0]] === parts[1]) {
|
|
3928
4010
|
// remove the <if> tags
|
|
3929
4011
|
removeAll = false;
|
|
3930
4012
|
} else if (parts[0] === parts[1]) {
|
|
3931
4013
|
removeAll = false;
|
|
3932
4014
|
}
|
|
3933
4015
|
} else if (polarity === false) {
|
|
3934
|
-
if (typeof
|
|
4016
|
+
if (typeof _this26.options.data[parts[0]] !== 'undefined' && _this26.options.data[parts[0]] !== parts[1]) {
|
|
3935
4017
|
// remove the <if> tags
|
|
3936
4018
|
removeAll = false;
|
|
3937
4019
|
}
|
|
@@ -4177,10 +4259,10 @@ var WebsyUtils = {
|
|
|
4177
4259
|
var s = '';
|
|
4178
4260
|
var d = 1; // let out
|
|
4179
4261
|
|
|
4180
|
-
for (var
|
|
4181
|
-
if (n >= ranges[
|
|
4182
|
-
d = ranges[
|
|
4183
|
-
s = ranges[
|
|
4262
|
+
for (var _i8 = 0; _i8 < ranges.length; _i8++) {
|
|
4263
|
+
if (n >= ranges[_i8].divider) {
|
|
4264
|
+
d = ranges[_i8].divider;
|
|
4265
|
+
s = ranges[_i8].suffix; // out = (n / ranges[i].divider).toFixed(decimals).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$100,')
|
|
4184
4266
|
|
|
4185
4267
|
break;
|
|
4186
4268
|
}
|
|
@@ -4218,7 +4300,7 @@ var WebsyUtils = {
|
|
|
4218
4300
|
|
|
4219
4301
|
var WebsyTable = /*#__PURE__*/function () {
|
|
4220
4302
|
function WebsyTable(elementId, options) {
|
|
4221
|
-
var
|
|
4303
|
+
var _this27 = this;
|
|
4222
4304
|
|
|
4223
4305
|
_classCallCheck(this, WebsyTable);
|
|
4224
4306
|
|
|
@@ -4256,8 +4338,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4256
4338
|
allowClear: false,
|
|
4257
4339
|
disableSearch: true,
|
|
4258
4340
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4259
|
-
if (
|
|
4260
|
-
|
|
4341
|
+
if (_this27.options.onChangePageSize) {
|
|
4342
|
+
_this27.options.onChangePageSize(selectedItem.value);
|
|
4261
4343
|
}
|
|
4262
4344
|
}
|
|
4263
4345
|
});
|
|
@@ -4278,7 +4360,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4278
4360
|
_createClass(WebsyTable, [{
|
|
4279
4361
|
key: "appendRows",
|
|
4280
4362
|
value: function appendRows(data) {
|
|
4281
|
-
var
|
|
4363
|
+
var _this28 = this;
|
|
4282
4364
|
|
|
4283
4365
|
this.hideError();
|
|
4284
4366
|
var bodyHTML = '';
|
|
@@ -4286,15 +4368,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4286
4368
|
if (data) {
|
|
4287
4369
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4288
4370
|
return '<tr>' + r.map(function (c, i) {
|
|
4289
|
-
if (
|
|
4371
|
+
if (_this28.options.columns[i].show !== false) {
|
|
4290
4372
|
var style = '';
|
|
4291
4373
|
|
|
4292
4374
|
if (c.style) {
|
|
4293
4375
|
style += c.style;
|
|
4294
4376
|
}
|
|
4295
4377
|
|
|
4296
|
-
if (
|
|
4297
|
-
style += "width: ".concat(
|
|
4378
|
+
if (_this28.options.columns[i].width) {
|
|
4379
|
+
style += "width: ".concat(_this28.options.columns[i].width, "; ");
|
|
4298
4380
|
}
|
|
4299
4381
|
|
|
4300
4382
|
if (c.backgroundColor) {
|
|
@@ -4309,18 +4391,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4309
4391
|
style += "color: ".concat(c.color, "; ");
|
|
4310
4392
|
}
|
|
4311
4393
|
|
|
4312
|
-
if (
|
|
4313
|
-
return "\n <td \n data-row-index='".concat(
|
|
4314
|
-
} else if ((
|
|
4315
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
4394
|
+
if (_this28.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
4395
|
+
return "\n <td \n data-row-index='".concat(_this28.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this28.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(_this28.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this28.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
4396
|
+
} else if ((_this28.options.columns[i].showAsNavigatorLink === true || _this28.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
4397
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this28.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this28.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this28.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this28.options.columns[i].linkText || c.value, "</td>\n ");
|
|
4316
4398
|
} else {
|
|
4317
4399
|
var info = c.value;
|
|
4318
4400
|
|
|
4319
|
-
if (
|
|
4401
|
+
if (_this28.options.columns[i].showAsImage === true) {
|
|
4320
4402
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4321
4403
|
}
|
|
4322
4404
|
|
|
4323
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
4405
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this28.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this28.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 ");
|
|
4324
4406
|
}
|
|
4325
4407
|
}
|
|
4326
4408
|
}).join('') + '</tr>';
|
|
@@ -4492,7 +4574,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4492
4574
|
}, {
|
|
4493
4575
|
key: "render",
|
|
4494
4576
|
value: function render(data) {
|
|
4495
|
-
var
|
|
4577
|
+
var _this29 = this;
|
|
4496
4578
|
|
|
4497
4579
|
if (!this.options.columns) {
|
|
4498
4580
|
return;
|
|
@@ -4517,7 +4599,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4517
4599
|
|
|
4518
4600
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
4519
4601
|
if (c.show !== false) {
|
|
4520
|
-
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 ?
|
|
4602
|
+
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 ? _this29.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
4521
4603
|
}
|
|
4522
4604
|
}).join('') + '</tr>';
|
|
4523
4605
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -4536,7 +4618,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4536
4618
|
|
|
4537
4619
|
if (pagingEl) {
|
|
4538
4620
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
4539
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
4621
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this29.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
4540
4622
|
});
|
|
4541
4623
|
var startIndex = 0;
|
|
4542
4624
|
|
|
@@ -4604,7 +4686,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4604
4686
|
|
|
4605
4687
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
4606
4688
|
function WebsyTable2(elementId, options) {
|
|
4607
|
-
var
|
|
4689
|
+
var _this30 = this;
|
|
4608
4690
|
|
|
4609
4691
|
_classCallCheck(this, WebsyTable2);
|
|
4610
4692
|
|
|
@@ -4645,8 +4727,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4645
4727
|
allowClear: false,
|
|
4646
4728
|
disableSearch: true,
|
|
4647
4729
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4648
|
-
if (
|
|
4649
|
-
|
|
4730
|
+
if (_this30.options.onChangePageSize) {
|
|
4731
|
+
_this30.options.onChangePageSize(selectedItem.value);
|
|
4650
4732
|
}
|
|
4651
4733
|
}
|
|
4652
4734
|
});
|
|
@@ -4670,7 +4752,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4670
4752
|
_createClass(WebsyTable2, [{
|
|
4671
4753
|
key: "appendRows",
|
|
4672
4754
|
value: function appendRows(data) {
|
|
4673
|
-
var
|
|
4755
|
+
var _this31 = this;
|
|
4674
4756
|
|
|
4675
4757
|
this.hideError();
|
|
4676
4758
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -4679,15 +4761,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4679
4761
|
if (data) {
|
|
4680
4762
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4681
4763
|
return '<tr>' + r.map(function (c, i) {
|
|
4682
|
-
if (
|
|
4683
|
-
var style = "height: ".concat(
|
|
4764
|
+
if (_this31.options.columns[i].show !== false) {
|
|
4765
|
+
var style = "height: ".concat(_this31.options.cellSize, "px; line-height: ").concat(_this31.options.cellSize, "px;");
|
|
4684
4766
|
|
|
4685
4767
|
if (c.style) {
|
|
4686
4768
|
style += c.style;
|
|
4687
4769
|
}
|
|
4688
4770
|
|
|
4689
|
-
if (
|
|
4690
|
-
style += "width: ".concat(
|
|
4771
|
+
if (_this31.options.columns[i].width) {
|
|
4772
|
+
style += "width: ".concat(_this31.options.columns[i].width, "; ");
|
|
4691
4773
|
}
|
|
4692
4774
|
|
|
4693
4775
|
if (c.backgroundColor) {
|
|
@@ -4702,18 +4784,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4702
4784
|
style += "color: ".concat(c.color, "; ");
|
|
4703
4785
|
}
|
|
4704
4786
|
|
|
4705
|
-
if (
|
|
4706
|
-
return "\n <td \n data-row-index='".concat(
|
|
4707
|
-
} else if ((
|
|
4708
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
4787
|
+
if (_this31.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
4788
|
+
return "\n <td \n data-row-index='".concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this31.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(_this31.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this31.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
4789
|
+
} else if ((_this31.options.columns[i].showAsNavigatorLink === true || _this31.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
4790
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this31.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this31.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this31.options.columns[i].linkText || c.value, "</td>\n ");
|
|
4709
4791
|
} else {
|
|
4710
4792
|
var info = c.value;
|
|
4711
4793
|
|
|
4712
|
-
if (
|
|
4794
|
+
if (_this31.options.columns[i].showAsImage === true) {
|
|
4713
4795
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4714
4796
|
}
|
|
4715
4797
|
|
|
4716
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
4798
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this31.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 ");
|
|
4717
4799
|
}
|
|
4718
4800
|
}
|
|
4719
4801
|
}).join('') + '</tr>';
|
|
@@ -4971,7 +5053,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4971
5053
|
}, {
|
|
4972
5054
|
key: "render",
|
|
4973
5055
|
value: function render(data) {
|
|
4974
|
-
var
|
|
5056
|
+
var _this32 = this;
|
|
4975
5057
|
|
|
4976
5058
|
if (!this.options.columns) {
|
|
4977
5059
|
return;
|
|
@@ -5007,7 +5089,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5007
5089
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5008
5090
|
}
|
|
5009
5091
|
|
|
5010
|
-
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 ?
|
|
5092
|
+
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 ? _this32.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5011
5093
|
}
|
|
5012
5094
|
}).join('') + '</tr>';
|
|
5013
5095
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5018,7 +5100,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5018
5100
|
var dropdownHTML = "";
|
|
5019
5101
|
this.options.columns.forEach(function (c, i) {
|
|
5020
5102
|
if (c.searchable && c.searchField) {
|
|
5021
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5103
|
+
dropdownHTML += "\n <div id=\"".concat(_this32.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
5022
5104
|
}
|
|
5023
5105
|
});
|
|
5024
5106
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5040,7 +5122,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5040
5122
|
|
|
5041
5123
|
if (pagingEl) {
|
|
5042
5124
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5043
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5125
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this32.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5044
5126
|
});
|
|
5045
5127
|
var startIndex = 0;
|
|
5046
5128
|
|
|
@@ -5127,7 +5209,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5127
5209
|
}, {
|
|
5128
5210
|
key: "getColumnParameters",
|
|
5129
5211
|
value: function getColumnParameters(values) {
|
|
5130
|
-
var
|
|
5212
|
+
var _this33 = this;
|
|
5131
5213
|
|
|
5132
5214
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
5133
5215
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -5135,10 +5217,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5135
5217
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
5136
5218
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5137
5219
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
5138
|
-
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 ?
|
|
5220
|
+
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 ? _this33.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5139
5221
|
}).join('') + '</tr>';
|
|
5140
5222
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
5141
|
-
return "\n <td \n style='height: ".concat(
|
|
5223
|
+
return "\n <td \n style='height: ".concat(_this33.options.cellSize, "px; line-height: ").concat(_this33.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
5142
5224
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
5143
5225
|
|
|
5144
5226
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -5159,8 +5241,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5159
5241
|
|
|
5160
5242
|
|
|
5161
5243
|
if (accWidth < (tableContainerEl.offsetWidth || tableContainerEl.clientWidth) - nonScrollableWidth) {
|
|
5162
|
-
for (var
|
|
5163
|
-
cellWidths[
|
|
5244
|
+
for (var _i9 = this.options.leftColumns; _i9 < cellWidths.length; _i9++) {
|
|
5245
|
+
cellWidths[_i9] = ((tableContainerEl.offsetWidth || tableContainerEl.clientWidth) - nonScrollableWidth) / (cellWidths.length - this.options.leftColumns);
|
|
5164
5246
|
}
|
|
5165
5247
|
} // const cellWidth = firstDataCell.offsetWidth || firstDataCell.clientWidth
|
|
5166
5248
|
// tableEl.style.width = ''
|
|
@@ -5188,7 +5270,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5188
5270
|
|
|
5189
5271
|
var WebsyChart = /*#__PURE__*/function () {
|
|
5190
5272
|
function WebsyChart(elementId, options) {
|
|
5191
|
-
var
|
|
5273
|
+
var _this34 = this;
|
|
5192
5274
|
|
|
5193
5275
|
_classCallCheck(this, WebsyChart);
|
|
5194
5276
|
|
|
@@ -5237,22 +5319,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5237
5319
|
this.invertOverride = function (input, input2) {
|
|
5238
5320
|
var xAxis = 'bottomAxis';
|
|
5239
5321
|
|
|
5240
|
-
if (
|
|
5322
|
+
if (_this34.options.orientation === 'horizontal') {
|
|
5241
5323
|
xAxis = 'leftAxis';
|
|
5242
5324
|
}
|
|
5243
5325
|
|
|
5244
|
-
var width =
|
|
5326
|
+
var width = _this34[xAxis].step();
|
|
5245
5327
|
|
|
5246
5328
|
var output;
|
|
5247
5329
|
|
|
5248
|
-
var domain = _toConsumableArray(
|
|
5330
|
+
var domain = _toConsumableArray(_this34[xAxis].domain());
|
|
5249
5331
|
|
|
5250
|
-
if (
|
|
5332
|
+
if (_this34.options.orientation === 'horizontal') {
|
|
5251
5333
|
domain = domain.reverse();
|
|
5252
5334
|
}
|
|
5253
5335
|
|
|
5254
5336
|
for (var j = 0; j < domain.length; j++) {
|
|
5255
|
-
var breakA =
|
|
5337
|
+
var breakA = _this34[xAxis](domain[j]) - width / 2;
|
|
5256
5338
|
var breakB = breakA + width;
|
|
5257
5339
|
|
|
5258
5340
|
if (input > breakA && input <= breakB) {
|
|
@@ -5352,10 +5434,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5352
5434
|
}, {
|
|
5353
5435
|
key: "handleEventMouseMove",
|
|
5354
5436
|
value: function handleEventMouseMove(event, d) {
|
|
5355
|
-
var
|
|
5437
|
+
var _this35 = this;
|
|
5356
5438
|
|
|
5357
5439
|
var bisectDate = d3.bisector(function (d) {
|
|
5358
|
-
return
|
|
5440
|
+
return _this35.parseX(d.x.value);
|
|
5359
5441
|
}).left;
|
|
5360
5442
|
|
|
5361
5443
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -5394,8 +5476,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5394
5476
|
}
|
|
5395
5477
|
|
|
5396
5478
|
this.options.data.series.forEach(function (s) {
|
|
5397
|
-
if (
|
|
5398
|
-
xPoint =
|
|
5479
|
+
if (_this35.options.data[xData].scale !== 'Time') {
|
|
5480
|
+
xPoint = _this35[xAxis](_this35.parseX(xLabel));
|
|
5399
5481
|
s.data.forEach(function (d) {
|
|
5400
5482
|
if (d.x.value === xLabel) {
|
|
5401
5483
|
if (!tooltipTitle) {
|
|
@@ -5414,13 +5496,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5414
5496
|
var pointA = s.data[index - 1];
|
|
5415
5497
|
var pointB = s.data[index];
|
|
5416
5498
|
|
|
5417
|
-
if (
|
|
5499
|
+
if (_this35.options.orientation === 'horizontal') {
|
|
5418
5500
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
5419
5501
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
5420
5502
|
}
|
|
5421
5503
|
|
|
5422
5504
|
if (pointA && !pointB) {
|
|
5423
|
-
xPoint =
|
|
5505
|
+
xPoint = _this35[xAxis](_this35.parseX(pointA.x.value));
|
|
5424
5506
|
tooltipTitle = pointA.x.value;
|
|
5425
5507
|
|
|
5426
5508
|
if (!pointA.y.color) {
|
|
@@ -5430,12 +5512,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5430
5512
|
tooltipData.push(pointA.y);
|
|
5431
5513
|
|
|
5432
5514
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
5433
|
-
tooltipTitle = d3.timeFormat(
|
|
5515
|
+
tooltipTitle = d3.timeFormat(_this35.options.dateFormat || _this35.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
5434
5516
|
}
|
|
5435
5517
|
}
|
|
5436
5518
|
|
|
5437
5519
|
if (pointB && !pointA) {
|
|
5438
|
-
xPoint =
|
|
5520
|
+
xPoint = _this35[xAxis](_this35.parseX(pointB.x.value));
|
|
5439
5521
|
tooltipTitle = pointB.x.value;
|
|
5440
5522
|
|
|
5441
5523
|
if (!pointB.y.color) {
|
|
@@ -5445,14 +5527,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5445
5527
|
tooltipData.push(pointB.y);
|
|
5446
5528
|
|
|
5447
5529
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5448
|
-
tooltipTitle = d3.timeFormat(
|
|
5530
|
+
tooltipTitle = d3.timeFormat(_this35.options.dateFormat || _this35.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5449
5531
|
}
|
|
5450
5532
|
}
|
|
5451
5533
|
|
|
5452
5534
|
if (pointA && pointB) {
|
|
5453
|
-
var d0 =
|
|
5535
|
+
var d0 = _this35[xAxis](_this35.parseX(pointA.x.value));
|
|
5454
5536
|
|
|
5455
|
-
var d1 =
|
|
5537
|
+
var d1 = _this35[xAxis](_this35.parseX(pointB.x.value));
|
|
5456
5538
|
|
|
5457
5539
|
var mid = Math.abs(d0 - d1) / 2;
|
|
5458
5540
|
|
|
@@ -5461,7 +5543,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5461
5543
|
tooltipTitle = pointB.x.value;
|
|
5462
5544
|
|
|
5463
5545
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5464
|
-
tooltipTitle = d3.timeFormat(
|
|
5546
|
+
tooltipTitle = d3.timeFormat(_this35.options.dateFormat || _this35.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5465
5547
|
}
|
|
5466
5548
|
|
|
5467
5549
|
if (!pointB.y.color) {
|
|
@@ -5474,7 +5556,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5474
5556
|
tooltipTitle = pointA.x.value;
|
|
5475
5557
|
|
|
5476
5558
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5477
|
-
tooltipTitle = d3.timeFormat(
|
|
5559
|
+
tooltipTitle = d3.timeFormat(_this35.options.dateFormat || _this35.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5478
5560
|
}
|
|
5479
5561
|
|
|
5480
5562
|
if (!pointA.y.color) {
|
|
@@ -5579,7 +5661,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5579
5661
|
}, {
|
|
5580
5662
|
key: "render",
|
|
5581
5663
|
value: function render(options) {
|
|
5582
|
-
var
|
|
5664
|
+
var _this36 = this;
|
|
5583
5665
|
|
|
5584
5666
|
/* global d3 options WebsyUtils */
|
|
5585
5667
|
if (typeof options !== 'undefined') {
|
|
@@ -5648,7 +5730,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5648
5730
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
5649
5731
|
return {
|
|
5650
5732
|
value: s.label || s.key,
|
|
5651
|
-
color: s.color ||
|
|
5733
|
+
color: s.color || _this36.options.colors[i % _this36.options.colors.length]
|
|
5652
5734
|
};
|
|
5653
5735
|
});
|
|
5654
5736
|
|
|
@@ -5900,7 +5982,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5900
5982
|
|
|
5901
5983
|
if (this.options.data.bottom.formatter) {
|
|
5902
5984
|
bAxisFunc.tickFormat(function (d) {
|
|
5903
|
-
return
|
|
5985
|
+
return _this36.options.data.bottom.formatter(d);
|
|
5904
5986
|
});
|
|
5905
5987
|
}
|
|
5906
5988
|
|
|
@@ -5926,8 +6008,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5926
6008
|
|
|
5927
6009
|
if (this.options.margin.axisLeft > 0) {
|
|
5928
6010
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
5929
|
-
if (
|
|
5930
|
-
d =
|
|
6011
|
+
if (_this36.options.data.left.formatter) {
|
|
6012
|
+
d = _this36.options.data.left.formatter(d);
|
|
5931
6013
|
}
|
|
5932
6014
|
|
|
5933
6015
|
return d;
|
|
@@ -5964,8 +6046,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5964
6046
|
|
|
5965
6047
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
5966
6048
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
5967
|
-
if (
|
|
5968
|
-
d =
|
|
6049
|
+
if (_this36.options.data.right.formatter) {
|
|
6050
|
+
d = _this36.options.data.right.formatter(d);
|
|
5969
6051
|
}
|
|
5970
6052
|
|
|
5971
6053
|
return d;
|
|
@@ -5991,16 +6073,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5991
6073
|
|
|
5992
6074
|
this.options.data.series.forEach(function (series, index) {
|
|
5993
6075
|
if (!series.key) {
|
|
5994
|
-
series.key =
|
|
6076
|
+
series.key = _this36.createIdentity();
|
|
5995
6077
|
}
|
|
5996
6078
|
|
|
5997
6079
|
if (!series.color) {
|
|
5998
|
-
series.color =
|
|
6080
|
+
series.color = _this36.options.colors[index % _this36.options.colors.length];
|
|
5999
6081
|
}
|
|
6000
6082
|
|
|
6001
|
-
|
|
6083
|
+
_this36["render".concat(series.type || 'bar')](series, index);
|
|
6002
6084
|
|
|
6003
|
-
|
|
6085
|
+
_this36.renderLabels(series, index);
|
|
6004
6086
|
});
|
|
6005
6087
|
}
|
|
6006
6088
|
}
|
|
@@ -6008,17 +6090,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6008
6090
|
}, {
|
|
6009
6091
|
key: "renderarea",
|
|
6010
6092
|
value: function renderarea(series, index) {
|
|
6011
|
-
var
|
|
6093
|
+
var _this37 = this;
|
|
6012
6094
|
|
|
6013
6095
|
/* global d3 series index */
|
|
6014
6096
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
6015
6097
|
return d3.area().x(function (d) {
|
|
6016
|
-
return
|
|
6098
|
+
return _this37[xAxis](_this37.parseX(d.x.value));
|
|
6017
6099
|
}).y0(function (d) {
|
|
6018
|
-
return
|
|
6100
|
+
return _this37[yAxis](0);
|
|
6019
6101
|
}).y1(function (d) {
|
|
6020
|
-
return
|
|
6021
|
-
}).curve(d3[curveStyle ||
|
|
6102
|
+
return _this37[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6103
|
+
}).curve(d3[curveStyle || _this37.options.curveStyle]);
|
|
6022
6104
|
};
|
|
6023
6105
|
|
|
6024
6106
|
var xAxis = 'bottomAxis';
|
|
@@ -6193,15 +6275,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6193
6275
|
}, {
|
|
6194
6276
|
key: "renderline",
|
|
6195
6277
|
value: function renderline(series, index) {
|
|
6196
|
-
var
|
|
6278
|
+
var _this38 = this;
|
|
6197
6279
|
|
|
6198
6280
|
/* global series index d3 */
|
|
6199
6281
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
6200
6282
|
return d3.line().x(function (d) {
|
|
6201
|
-
return
|
|
6283
|
+
return _this38[xAxis](_this38.parseX(d.x.value));
|
|
6202
6284
|
}).y(function (d) {
|
|
6203
|
-
return
|
|
6204
|
-
}).curve(d3[curveStyle ||
|
|
6285
|
+
return _this38[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6286
|
+
}).curve(d3[curveStyle || _this38.options.curveStyle]);
|
|
6205
6287
|
};
|
|
6206
6288
|
|
|
6207
6289
|
var xAxis = 'bottomAxis';
|
|
@@ -6239,14 +6321,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6239
6321
|
}, {
|
|
6240
6322
|
key: "rendersymbol",
|
|
6241
6323
|
value: function rendersymbol(series, index) {
|
|
6242
|
-
var
|
|
6324
|
+
var _this39 = this;
|
|
6243
6325
|
|
|
6244
6326
|
/* global d3 series index series.key */
|
|
6245
6327
|
var drawSymbol = function drawSymbol(size) {
|
|
6246
6328
|
return d3.symbol() // .type(d => {
|
|
6247
6329
|
// return d3.symbols[0]
|
|
6248
6330
|
// })
|
|
6249
|
-
.size(size ||
|
|
6331
|
+
.size(size || _this39.options.symbolSize);
|
|
6250
6332
|
};
|
|
6251
6333
|
|
|
6252
6334
|
var xAxis = 'bottomAxis';
|
|
@@ -6264,7 +6346,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6264
6346
|
symbols.attr('d', function (d) {
|
|
6265
6347
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
6266
6348
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
6267
|
-
return "translate(".concat(
|
|
6349
|
+
return "translate(".concat(_this39[xAxis](_this39.parseX(d.x.value)), ", ").concat(_this39[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
6268
6350
|
}); // Enter
|
|
6269
6351
|
|
|
6270
6352
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -6273,7 +6355,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6273
6355
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
6274
6356
|
return "symbol symbol_".concat(series.key);
|
|
6275
6357
|
}).attr('transform', function (d) {
|
|
6276
|
-
return "translate(".concat(
|
|
6358
|
+
return "translate(".concat(_this39[xAxis](_this39.parseX(d.x.value)), ", ").concat(_this39[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
6277
6359
|
});
|
|
6278
6360
|
}
|
|
6279
6361
|
}, {
|
|
@@ -6428,7 +6510,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6428
6510
|
}, {
|
|
6429
6511
|
key: "resize",
|
|
6430
6512
|
value: function resize() {
|
|
6431
|
-
var
|
|
6513
|
+
var _this40 = this;
|
|
6432
6514
|
|
|
6433
6515
|
var el = document.getElementById(this.elementId);
|
|
6434
6516
|
|
|
@@ -6441,7 +6523,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6441
6523
|
// }
|
|
6442
6524
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
6443
6525
|
html += this._data.map(function (d, i) {
|
|
6444
|
-
return
|
|
6526
|
+
return _this40.getLegendItemHTML(d);
|
|
6445
6527
|
}).join('');
|
|
6446
6528
|
html += "\n <div>\n ";
|
|
6447
6529
|
el.innerHTML = html;
|
|
@@ -6613,7 +6695,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6613
6695
|
}, {
|
|
6614
6696
|
key: "render",
|
|
6615
6697
|
value: function render() {
|
|
6616
|
-
var
|
|
6698
|
+
var _this41 = this;
|
|
6617
6699
|
|
|
6618
6700
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
6619
6701
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -6622,7 +6704,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6622
6704
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
6623
6705
|
return {
|
|
6624
6706
|
value: s.label || s.key,
|
|
6625
|
-
color: s.color ||
|
|
6707
|
+
color: s.color || _this41.options.colors[i % _this41.options.colors.length]
|
|
6626
6708
|
};
|
|
6627
6709
|
});
|
|
6628
6710
|
var longestValue = legendData.map(function (s) {
|
|
@@ -6686,7 +6768,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6686
6768
|
|
|
6687
6769
|
if (this.polygons) {
|
|
6688
6770
|
this.polygons.forEach(function (p) {
|
|
6689
|
-
return
|
|
6771
|
+
return _this41.map.removeLayer(p);
|
|
6690
6772
|
});
|
|
6691
6773
|
}
|
|
6692
6774
|
|
|
@@ -6744,18 +6826,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6744
6826
|
}
|
|
6745
6827
|
|
|
6746
6828
|
if (!p.options.color) {
|
|
6747
|
-
p.options.color =
|
|
6829
|
+
p.options.color = _this41.options.colors[i % _this41.options.colors.length];
|
|
6748
6830
|
}
|
|
6749
6831
|
|
|
6750
6832
|
var pol = L.polygon(p.data.map(function (c) {
|
|
6751
6833
|
return c.map(function (d) {
|
|
6752
6834
|
return [d.Latitude, d.Longitude];
|
|
6753
6835
|
});
|
|
6754
|
-
}), p.options).addTo(
|
|
6836
|
+
}), p.options).addTo(_this41.map);
|
|
6755
6837
|
|
|
6756
|
-
|
|
6838
|
+
_this41.polygons.push(pol);
|
|
6757
6839
|
|
|
6758
|
-
|
|
6840
|
+
_this41.map.fitBounds(pol.getBounds());
|
|
6759
6841
|
});
|
|
6760
6842
|
} // if (this.data.markers.length > 0) {
|
|
6761
6843
|
// el.classList.remove('hidden')
|