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