@websy/websy-designs 0.0.99 → 0.0.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/helpers/v1/pdfHelper.js +44 -39
- package/dist/server/helpers/v1/pgHelper.js +8 -4
- package/dist/server/websy-designs-server.js +1 -1
- package/dist/websy-designs-flttr.min.css +1 -1
- package/dist/websy-designs.debug.js +202 -47
- package/dist/websy-designs.js +321 -146
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
package/dist/websy-designs.js
CHANGED
|
@@ -413,6 +413,24 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
413
413
|
}
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
|
+
}, {
|
|
417
|
+
key: "confirmValidation",
|
|
418
|
+
value: function confirmValidation() {
|
|
419
|
+
var el = document.getElementById("".concat(this.elementId, "_validationFail"));
|
|
420
|
+
|
|
421
|
+
if (el) {
|
|
422
|
+
el.innerHTML = '';
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}, {
|
|
426
|
+
key: "failValidation",
|
|
427
|
+
value: function failValidation(msg) {
|
|
428
|
+
var el = document.getElementById("".concat(this.elementId, "_validationFail"));
|
|
429
|
+
|
|
430
|
+
if (el) {
|
|
431
|
+
el.innerHTML = msg;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
416
434
|
}, {
|
|
417
435
|
key: "handleClick",
|
|
418
436
|
value: function handleClick(event) {
|
|
@@ -430,6 +448,22 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
430
448
|
}, {
|
|
431
449
|
key: "handleKeyUp",
|
|
432
450
|
value: function handleKeyUp(event) {}
|
|
451
|
+
}, {
|
|
452
|
+
key: "processComponents",
|
|
453
|
+
value: function processComponents(components, callbackFn) {
|
|
454
|
+
var _this2 = this;
|
|
455
|
+
|
|
456
|
+
if (components.length === 0) {
|
|
457
|
+
callbackFn();
|
|
458
|
+
} else {
|
|
459
|
+
components.forEach(function (c) {
|
|
460
|
+
if (typeof WebsyDesigns[c.component] !== 'undefined') {
|
|
461
|
+
var comp = new WebsyDesigns[c.component]("".concat(_this2.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
462
|
+
} else {// some user feedback here
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
}
|
|
433
467
|
}, {
|
|
434
468
|
key: "recaptchaReady",
|
|
435
469
|
value: function recaptchaReady() {
|
|
@@ -445,20 +479,24 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
445
479
|
}, {
|
|
446
480
|
key: "render",
|
|
447
481
|
value: function render(update, data) {
|
|
448
|
-
var
|
|
482
|
+
var _this3 = this;
|
|
449
483
|
|
|
450
484
|
var el = document.getElementById(this.elementId);
|
|
485
|
+
var componentsToProcess = [];
|
|
451
486
|
|
|
452
487
|
if (el) {
|
|
453
488
|
var html = "\n <form id=\"".concat(this.elementId, "Form\">\n ");
|
|
454
489
|
this.options.fields.forEach(function (f) {
|
|
455
|
-
if (f.
|
|
456
|
-
|
|
490
|
+
if (f.component) {
|
|
491
|
+
componentsToProcess.push(f);
|
|
492
|
+
html += "\n ".concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(_this3.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n ");
|
|
493
|
+
} else if (f.type === 'longtext') {
|
|
494
|
+
html += "\n ".concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(_this3.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n class=\"websy-input websy-textarea ").concat(f.classes, "\"\n ></textarea>\n ");
|
|
457
495
|
} else {
|
|
458
|
-
html += "\n ".concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(
|
|
496
|
+
html += "\n ".concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(_this3.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input ").concat(f.classes, "\" \n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n ");
|
|
459
497
|
}
|
|
460
498
|
});
|
|
461
|
-
html += " \n </form>\n ";
|
|
499
|
+
html += " \n </form>\n <div id=\"".concat(this.elementId, "_validationFail\" class=\"websy-validation-failure\"></div>\n ");
|
|
462
500
|
|
|
463
501
|
if (this.options.useRecaptcha === true) {
|
|
464
502
|
html += "\n <div id='".concat(this.elementId, "_recaptcha'></div>\n ");
|
|
@@ -466,16 +504,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
466
504
|
|
|
467
505
|
html += "\n <button class=\"websy-btn submit ".concat(this.options.submit.classes, "\">").concat(this.options.submit.text || 'Save', "</button>\n ");
|
|
468
506
|
el.innerHTML = html;
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
507
|
+
this.processComponents(componentsToProcess, function () {
|
|
508
|
+
if (_this3.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
|
|
509
|
+
_this3.recaptchaReady();
|
|
510
|
+
}
|
|
511
|
+
});
|
|
473
512
|
}
|
|
474
513
|
}
|
|
475
514
|
}, {
|
|
476
515
|
key: "submitForm",
|
|
477
516
|
value: function submitForm() {
|
|
478
|
-
var
|
|
517
|
+
var _this4 = this;
|
|
479
518
|
|
|
480
519
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
481
520
|
|
|
@@ -489,26 +528,26 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
489
528
|
data[key] = value;
|
|
490
529
|
});
|
|
491
530
|
|
|
492
|
-
if (
|
|
493
|
-
|
|
494
|
-
if (
|
|
531
|
+
if (_this4.options.url) {
|
|
532
|
+
_this4.apiService.add(_this4.options.url, data).then(function (result) {
|
|
533
|
+
if (_this4.options.clearAfterSave === true) {
|
|
495
534
|
// this.render()
|
|
496
535
|
formEl.reset();
|
|
497
536
|
}
|
|
498
537
|
|
|
499
|
-
|
|
538
|
+
_this4.options.onSuccess.call(_this4, result);
|
|
500
539
|
}, function (err) {
|
|
501
540
|
console.log('Error submitting form data:', err);
|
|
502
541
|
|
|
503
|
-
|
|
542
|
+
_this4.options.onError.call(_this4, err);
|
|
543
|
+
});
|
|
544
|
+
} else if (_this4.options.submitFn) {
|
|
545
|
+
_this4.options.submitFn(data, function () {
|
|
546
|
+
if (_this4.options.clearAfterSave === true) {
|
|
547
|
+
// this.render()
|
|
548
|
+
formEl.reset();
|
|
549
|
+
}
|
|
504
550
|
});
|
|
505
|
-
} else if (_this3.options.submitFn) {
|
|
506
|
-
_this3.options.submitFn(data);
|
|
507
|
-
|
|
508
|
-
if (_this3.options.clearAfterSave === true) {
|
|
509
|
-
// this.render()
|
|
510
|
-
formEl.reset();
|
|
511
|
-
}
|
|
512
551
|
}
|
|
513
552
|
} else {
|
|
514
553
|
console.log('bad recaptcha');
|
|
@@ -524,17 +563,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
524
563
|
}, {
|
|
525
564
|
key: "data",
|
|
526
565
|
set: function set(d) {
|
|
527
|
-
var
|
|
566
|
+
var _this5 = this;
|
|
528
567
|
|
|
529
568
|
if (!this.options.fields) {
|
|
530
569
|
this.options.fields = [];
|
|
531
570
|
}
|
|
532
571
|
|
|
533
572
|
var _loop = function _loop(key) {
|
|
534
|
-
|
|
573
|
+
_this5.options.fields.forEach(function (f) {
|
|
535
574
|
if (f.field === key) {
|
|
536
575
|
f.value = d[key];
|
|
537
|
-
var el = document.getElementById("".concat(
|
|
576
|
+
var el = document.getElementById("".concat(_this5.elementId, "_input_").concat(f.field));
|
|
538
577
|
el.value = f.value;
|
|
539
578
|
}
|
|
540
579
|
});
|
|
@@ -560,8 +599,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
560
599
|
this.validDates = [];
|
|
561
600
|
var DEFAULTS = {
|
|
562
601
|
defaultRange: 0,
|
|
563
|
-
minAllowedDate: floorDate(new Date(new Date(new Date().setFullYear(new Date().getFullYear() -
|
|
564
|
-
maxAllowedDate: floorDate(new Date(new Date()
|
|
602
|
+
minAllowedDate: this.floorDate(new Date(new Date(new Date().setFullYear(new Date().getFullYear() - 1)).setDate(1))),
|
|
603
|
+
maxAllowedDate: this.floorDate(new Date(new Date())),
|
|
565
604
|
daysOfWeek: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
|
|
566
605
|
monthMap: {
|
|
567
606
|
0: 'Jan',
|
|
@@ -584,25 +623,25 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
584
623
|
range: [DEFAULTS.minAllowedDate, DEFAULTS.maxAllowedDate]
|
|
585
624
|
}, {
|
|
586
625
|
label: 'Today',
|
|
587
|
-
range: [floorDate(new Date())]
|
|
626
|
+
range: [this.floorDate(new Date())]
|
|
588
627
|
}, {
|
|
589
628
|
label: 'Yesterday',
|
|
590
|
-
range: [floorDate(new Date().setDate(new Date().getDate() - 1))]
|
|
629
|
+
range: [this.floorDate(new Date().setDate(new Date().getDate() - 1))]
|
|
591
630
|
}, {
|
|
592
631
|
label: 'Last 7 Days',
|
|
593
|
-
range: [floorDate(new Date().setDate(new Date().getDate() - 6)), floorDate(new Date())]
|
|
632
|
+
range: [this.floorDate(new Date().setDate(new Date().getDate() - 6)), this.floorDate(new Date())]
|
|
594
633
|
}, {
|
|
595
634
|
label: 'This Month',
|
|
596
|
-
range: [floorDate(new Date().setDate(1)), floorDate(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() + 1) - this.oneDay)]
|
|
635
|
+
range: [this.floorDate(new Date().setDate(1)), this.floorDate(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() + 1) - this.oneDay)]
|
|
597
636
|
}, {
|
|
598
637
|
label: 'Last Month',
|
|
599
|
-
range: [floorDate(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() - 1)), floorDate(new Date(new Date().setDate(1)).setMonth(new Date().getMonth()) - this.oneDay)]
|
|
638
|
+
range: [this.floorDate(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() - 1)), this.floorDate(new Date(new Date().setDate(1)).setMonth(new Date().getMonth()) - this.oneDay)]
|
|
600
639
|
}, {
|
|
601
640
|
label: 'This Year',
|
|
602
|
-
range: [floorDate(new Date("1/1/".concat(new Date().getFullYear()))), floorDate(new Date("12/31/".concat(new Date().getFullYear())))]
|
|
641
|
+
range: [this.floorDate(new Date("1/1/".concat(new Date().getFullYear()))), this.floorDate(new Date("12/31/".concat(new Date().getFullYear())))]
|
|
603
642
|
}, {
|
|
604
643
|
label: 'Last Year',
|
|
605
|
-
range: [floorDate(new Date("1/1/".concat(new Date().getFullYear() - 1))), floorDate(new Date("12/31/".concat(new Date().getFullYear() - 1)))]
|
|
644
|
+
range: [this.floorDate(new Date("1/1/".concat(new Date().getFullYear() - 1))), this.floorDate(new Date("12/31/".concat(new Date().getFullYear() - 1)))]
|
|
606
645
|
}];
|
|
607
646
|
this.options = _extends({}, DEFAULTS, options);
|
|
608
647
|
this.selectedRange = this.options.defaultRange || 0;
|
|
@@ -625,14 +664,6 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
625
664
|
} else {
|
|
626
665
|
console.log('No element found with Id', elementId);
|
|
627
666
|
}
|
|
628
|
-
|
|
629
|
-
function floorDate(d) {
|
|
630
|
-
if (typeof d === 'number') {
|
|
631
|
-
d = new Date(d);
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
return new Date(d.setHours(0, 0, 0));
|
|
635
|
-
}
|
|
636
667
|
}
|
|
637
668
|
|
|
638
669
|
_createClass(WebsyDatePicker, [{
|
|
@@ -654,6 +685,15 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
654
685
|
this.selectedRange = this.priorSelectedRange;
|
|
655
686
|
}
|
|
656
687
|
}
|
|
688
|
+
}, {
|
|
689
|
+
key: "floorDate",
|
|
690
|
+
value: function floorDate(d) {
|
|
691
|
+
if (typeof d === 'number') {
|
|
692
|
+
d = new Date(d);
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
return new Date(d.setHours(0, 0, 0, 0));
|
|
696
|
+
}
|
|
657
697
|
}, {
|
|
658
698
|
key: "handleClick",
|
|
659
699
|
value: function handleClick(event) {
|
|
@@ -705,7 +745,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
705
745
|
}
|
|
706
746
|
|
|
707
747
|
for (var _i = 0; _i < daysDiff + 1; _i++) {
|
|
708
|
-
var d = new Date(this.selectedRangeDates[0].getTime() + _i * this.oneDay)
|
|
748
|
+
var d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + _i * this.oneDay));
|
|
709
749
|
var dateEl = document.getElementById("".concat(d.getTime(), "_date"));
|
|
710
750
|
|
|
711
751
|
if (dateEl) {
|
|
@@ -759,6 +799,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
759
799
|
key: "renderDates",
|
|
760
800
|
value: function renderDates(disabledDates) {
|
|
761
801
|
var disabled = [];
|
|
802
|
+
this.validDates = [];
|
|
762
803
|
|
|
763
804
|
if (disabledDates) {
|
|
764
805
|
disabled = disabledDates.map(function (d) {
|
|
@@ -774,8 +815,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
774
815
|
var months = {};
|
|
775
816
|
|
|
776
817
|
for (var i = 0; i < daysDiff; i++) {
|
|
777
|
-
var d = new Date(this.options.minAllowedDate.getTime() + i * this.oneDay)
|
|
778
|
-
d.setHours(0);
|
|
818
|
+
var d = this.floorDate(new Date(this.options.minAllowedDate.getTime() + i * this.oneDay));
|
|
779
819
|
var monthYear = "".concat(this.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
780
820
|
|
|
781
821
|
if (!months[monthYear]) {
|
|
@@ -805,13 +845,15 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
805
845
|
// check the last date
|
|
806
846
|
if (this.validDates.indexOf(r.range[1].getTime()) !== -1) {
|
|
807
847
|
r.disabled = false;
|
|
808
|
-
}
|
|
809
|
-
|
|
848
|
+
} else {
|
|
849
|
+
// check the full range until a match is found
|
|
850
|
+
for (var _i3 = r.range[0].getTime(); _i3 <= r.range[1].getTime(); _i3 += this.oneDay) {
|
|
851
|
+
var testDate = this.floorDate(new Date(_i3));
|
|
810
852
|
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
853
|
+
if (this.validDates.indexOf(testDate.getTime()) !== -1) {
|
|
854
|
+
r.disabled = false;
|
|
855
|
+
break;
|
|
856
|
+
}
|
|
815
857
|
}
|
|
816
858
|
}
|
|
817
859
|
}
|
|
@@ -849,10 +891,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
849
891
|
}, {
|
|
850
892
|
key: "renderRanges",
|
|
851
893
|
value: function renderRanges() {
|
|
852
|
-
var
|
|
894
|
+
var _this6 = this;
|
|
853
895
|
|
|
854
896
|
return this.options.ranges.map(function (r, i) {
|
|
855
|
-
return "\n <li data-index='".concat(i, "' class='websy-date-picker-range ").concat(i ===
|
|
897
|
+
return "\n <li data-index='".concat(i, "' class='websy-date-picker-range ").concat(i === _this6.selectedRange ? 'active' : '', " ").concat(r.disabled === true ? 'websy-disabled-range' : '', "'>").concat(r.label, "</li>\n ");
|
|
856
898
|
}).join('');
|
|
857
899
|
}
|
|
858
900
|
}, {
|
|
@@ -968,14 +1010,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
968
1010
|
|
|
969
1011
|
var DEFAULTS = {
|
|
970
1012
|
multiSelect: false,
|
|
1013
|
+
multiValueDelimiter: ',',
|
|
971
1014
|
allowClear: true,
|
|
972
1015
|
style: 'plain',
|
|
973
1016
|
items: [],
|
|
974
1017
|
label: '',
|
|
975
|
-
minSearchCharacters: 2
|
|
1018
|
+
minSearchCharacters: 2,
|
|
1019
|
+
showCompleteSelectedList: false
|
|
976
1020
|
};
|
|
977
1021
|
this.options = _extends({}, DEFAULTS, options);
|
|
978
|
-
this.
|
|
1022
|
+
this.tooltipTimeoutFn = null;
|
|
1023
|
+
this.selectedItems = this.options.selectedItems || [];
|
|
979
1024
|
|
|
980
1025
|
if (!elementId) {
|
|
981
1026
|
console.log('No element Id provided');
|
|
@@ -988,6 +1033,8 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
988
1033
|
this.elementId = elementId;
|
|
989
1034
|
el.addEventListener('click', this.handleClick.bind(this));
|
|
990
1035
|
el.addEventListener('keyup', this.handleKeyUp.bind(this));
|
|
1036
|
+
el.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
1037
|
+
el.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
991
1038
|
this.render();
|
|
992
1039
|
} else {
|
|
993
1040
|
console.log('No element found with Id', elementId);
|
|
@@ -1062,6 +1109,46 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1062
1109
|
}
|
|
1063
1110
|
}
|
|
1064
1111
|
}
|
|
1112
|
+
}, {
|
|
1113
|
+
key: "handleMouseMove",
|
|
1114
|
+
value: function handleMouseMove(event) {
|
|
1115
|
+
if (this.tooltipTimeoutFn) {
|
|
1116
|
+
event.target.classList.remove('websy-delayed');
|
|
1117
|
+
event.target.classList.remove('websy-delayed-info');
|
|
1118
|
+
|
|
1119
|
+
if (event.target.children[1]) {
|
|
1120
|
+
event.target.children[1].classList.remove('websy-delayed-info');
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
clearTimeout(this.tooltipTimeoutFn);
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
if (event.target.tagName === 'LI') {
|
|
1127
|
+
this.tooltipTimeoutFn = setTimeout(function () {
|
|
1128
|
+
event.target.classList.add('websy-delayed');
|
|
1129
|
+
}, 500);
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
if (event.target.classList.contains('websy-dropdown-header') && event.target.children[1]) {
|
|
1133
|
+
this.tooltipTimeoutFn = setTimeout(function () {
|
|
1134
|
+
event.target.children[1].classList.add('websy-delayed-info');
|
|
1135
|
+
}, 500);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
}, {
|
|
1139
|
+
key: "handleMouseOut",
|
|
1140
|
+
value: function handleMouseOut(event) {
|
|
1141
|
+
if (this.tooltipTimeoutFn) {
|
|
1142
|
+
event.target.classList.remove('websy-delayed');
|
|
1143
|
+
event.target.classList.remove('websy-delayed-info');
|
|
1144
|
+
|
|
1145
|
+
if (event.target.children[1]) {
|
|
1146
|
+
event.target.children[1].classList.remove('websy-delayed-info');
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
clearTimeout(this.tooltipTimeoutFn);
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1065
1152
|
}, {
|
|
1066
1153
|
key: "open",
|
|
1067
1154
|
value: function open(options) {
|
|
@@ -1082,7 +1169,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1082
1169
|
}, {
|
|
1083
1170
|
key: "render",
|
|
1084
1171
|
value: function render() {
|
|
1085
|
-
var
|
|
1172
|
+
var _this7 = this;
|
|
1086
1173
|
|
|
1087
1174
|
if (!this.elementId) {
|
|
1088
1175
|
console.log('No element Id provided for Websy Dropdown');
|
|
@@ -1090,9 +1177,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1090
1177
|
}
|
|
1091
1178
|
|
|
1092
1179
|
var el = document.getElementById(this.elementId);
|
|
1093
|
-
var
|
|
1094
|
-
return
|
|
1095
|
-
}).join(
|
|
1180
|
+
var headerValue = this.selectedItems.map(function (s) {
|
|
1181
|
+
return _this7.options.items[s].label;
|
|
1182
|
+
}).join(this.options.multiValueDelimiter);
|
|
1183
|
+
var html = "\n <div class='websy-dropdown-container ".concat(this.options.disableSearch !== true ? 'with-search' : '', "'>\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 <span id='").concat(this.elementId, "_headerLabel' class='websy-dropdown-header-label'>").concat(this.options.label, "</span>\n <span data-info='").concat(headerValue, "' class='websy-dropdown-header-value' id='").concat(this.elementId, "_selectedItems'>").concat(headerValue, "</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 ");
|
|
1096
1184
|
|
|
1097
1185
|
if (this.options.allowClear === true) {
|
|
1098
1186
|
html += "\n <svg class='clear' xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 512 512\"><title>ionicons-v5-l</title><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>\n ";
|
|
@@ -1111,10 +1199,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1111
1199
|
}, {
|
|
1112
1200
|
key: "renderItems",
|
|
1113
1201
|
value: function renderItems() {
|
|
1114
|
-
var
|
|
1202
|
+
var _this8 = this;
|
|
1115
1203
|
|
|
1116
1204
|
var html = this.options.items.map(function (r, i) {
|
|
1117
|
-
return "\n <li data-index='".concat(i, "' class='websy-dropdown-item ").concat(
|
|
1205
|
+
return "\n <li data-index='".concat(i, "' class='websy-dropdown-item ").concat(_this8.selectedItems.indexOf(i) !== -1 ? 'active' : '', "'>").concat(r.label, "</li>\n ");
|
|
1118
1206
|
}).join('');
|
|
1119
1207
|
var el = document.getElementById("".concat(this.elementId, "_items"));
|
|
1120
1208
|
|
|
@@ -1133,10 +1221,13 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1133
1221
|
}, {
|
|
1134
1222
|
key: "updateHeader",
|
|
1135
1223
|
value: function updateHeader(item) {
|
|
1224
|
+
var _this9 = this;
|
|
1225
|
+
|
|
1136
1226
|
var el = document.getElementById(this.elementId);
|
|
1137
1227
|
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
1138
1228
|
var headerLabelEl = document.getElementById("".concat(this.elementId, "_headerLabel"));
|
|
1139
1229
|
var labelEl = document.getElementById("".concat(this.elementId, "_selectedItems"));
|
|
1230
|
+
var inputEl = document.getElementById("".concat(this.elementId, "_input"));
|
|
1140
1231
|
var itemEls = el.querySelectorAll(".websy-dropdown-item");
|
|
1141
1232
|
|
|
1142
1233
|
for (var i = 0; i < itemEls.length; i++) {
|
|
@@ -1158,17 +1249,36 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1158
1249
|
if (this.selectedItems.length === 1) {
|
|
1159
1250
|
headerEl.classList.add('one-selected');
|
|
1160
1251
|
} else if (this.selectedItems.length > 1) {
|
|
1161
|
-
|
|
1252
|
+
if (this.options.showCompleteSelectedList === true) {
|
|
1253
|
+
headerEl.classList.add('one-selected');
|
|
1254
|
+
} else {
|
|
1255
|
+
headerEl.classList.add('multi-selected');
|
|
1256
|
+
}
|
|
1162
1257
|
}
|
|
1163
1258
|
}
|
|
1164
1259
|
|
|
1165
1260
|
if (labelEl) {
|
|
1166
1261
|
if (this.selectedItems.length === 1) {
|
|
1167
1262
|
labelEl.innerHTML = item.label;
|
|
1263
|
+
labelEl.setAttribute('data-info', item.label);
|
|
1264
|
+
inputEl.value = item.label;
|
|
1168
1265
|
} else if (this.selectedItems.length > 1) {
|
|
1169
|
-
|
|
1266
|
+
if (this.options.showCompleteSelectedList === true) {
|
|
1267
|
+
var selectedValues = this.selectedItems.map(function (s) {
|
|
1268
|
+
return _this9.options.items[s].label;
|
|
1269
|
+
}).join(this.options.multiValueDelimiter);
|
|
1270
|
+
labelEl.innerHTML = selectedValues;
|
|
1271
|
+
labelEl.setAttribute('data-info', selectedValues);
|
|
1272
|
+
inputEl.value = selectedValues;
|
|
1273
|
+
} else {
|
|
1274
|
+
labelEl.innerHTML = "".concat(this.selectedItems.length, " selected");
|
|
1275
|
+
labelEl.setAttribute('data-info', '');
|
|
1276
|
+
inputEl.value = this.selectedItems.join(this.options.multiValueDelimiter);
|
|
1277
|
+
}
|
|
1170
1278
|
} else {
|
|
1171
1279
|
labelEl.innerHTML = '';
|
|
1280
|
+
labelEl.setAttribute('data-info', '');
|
|
1281
|
+
inputEl.value = '';
|
|
1172
1282
|
}
|
|
1173
1283
|
}
|
|
1174
1284
|
}
|
|
@@ -1231,7 +1341,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1231
1341
|
|
|
1232
1342
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
1233
1343
|
function WebsyResultList(elementId, options) {
|
|
1234
|
-
var
|
|
1344
|
+
var _this10 = this;
|
|
1235
1345
|
|
|
1236
1346
|
_classCallCheck(this, WebsyResultList);
|
|
1237
1347
|
|
|
@@ -1259,9 +1369,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
1259
1369
|
|
|
1260
1370
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
1261
1371
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
1262
|
-
|
|
1372
|
+
_this10.options.template = templateString;
|
|
1263
1373
|
|
|
1264
|
-
|
|
1374
|
+
_this10.render();
|
|
1265
1375
|
});
|
|
1266
1376
|
} else {
|
|
1267
1377
|
this.render();
|
|
@@ -1280,7 +1390,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
1280
1390
|
}, {
|
|
1281
1391
|
key: "buildHTML",
|
|
1282
1392
|
value: function buildHTML(d) {
|
|
1283
|
-
var
|
|
1393
|
+
var _this11 = this;
|
|
1284
1394
|
|
|
1285
1395
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1286
1396
|
var html = "";
|
|
@@ -1288,7 +1398,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
1288
1398
|
if (this.options.template) {
|
|
1289
1399
|
if (d.length > 0) {
|
|
1290
1400
|
d.forEach(function (row, ix) {
|
|
1291
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(
|
|
1401
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(_this11.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
1292
1402
|
|
|
1293
1403
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
1294
1404
|
|
|
@@ -1408,7 +1518,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
1408
1518
|
}, {
|
|
1409
1519
|
key: "handleClick",
|
|
1410
1520
|
value: function handleClick(event) {
|
|
1411
|
-
var
|
|
1521
|
+
var _this12 = this;
|
|
1412
1522
|
|
|
1413
1523
|
if (event.target.classList.contains('clickable')) {
|
|
1414
1524
|
var l = event.target.getAttribute('data-event');
|
|
@@ -1426,8 +1536,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
1426
1536
|
l = l[0];
|
|
1427
1537
|
params = params.map(function (p) {
|
|
1428
1538
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
1429
|
-
if (
|
|
1430
|
-
p =
|
|
1539
|
+
if (_this12.rows[+id]) {
|
|
1540
|
+
p = _this12.rows[+id][p];
|
|
1431
1541
|
}
|
|
1432
1542
|
} else if (typeof p === 'string') {
|
|
1433
1543
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -1449,13 +1559,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
1449
1559
|
}, {
|
|
1450
1560
|
key: "render",
|
|
1451
1561
|
value: function render() {
|
|
1452
|
-
var
|
|
1562
|
+
var _this13 = this;
|
|
1453
1563
|
|
|
1454
1564
|
if (this.options.entity) {
|
|
1455
1565
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
1456
|
-
|
|
1566
|
+
_this13.rows = results.rows;
|
|
1457
1567
|
|
|
1458
|
-
|
|
1568
|
+
_this13.resize();
|
|
1459
1569
|
});
|
|
1460
1570
|
} else {
|
|
1461
1571
|
this.resize();
|
|
@@ -1619,7 +1729,7 @@ var APIService = /*#__PURE__*/function () {
|
|
|
1619
1729
|
console.log('using this');
|
|
1620
1730
|
|
|
1621
1731
|
xhr.onload = function () {
|
|
1622
|
-
if (xhr.status === 401) {
|
|
1732
|
+
if (xhr.status === 401 || xhr.status === 403) {
|
|
1623
1733
|
if (ENV && ENV.AUTH_REDIRECT) {
|
|
1624
1734
|
window.location = ENV.AUTH_REDIRECT;
|
|
1625
1735
|
} else {
|
|
@@ -1719,52 +1829,52 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
1719
1829
|
_createClass(WebsyPDFButton, [{
|
|
1720
1830
|
key: "handleClick",
|
|
1721
1831
|
value: function handleClick(event) {
|
|
1722
|
-
var
|
|
1832
|
+
var _this14 = this;
|
|
1723
1833
|
|
|
1724
1834
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
1725
1835
|
this.loader.show();
|
|
1726
1836
|
setTimeout(function () {
|
|
1727
|
-
if (
|
|
1728
|
-
var el = document.getElementById(
|
|
1837
|
+
if (_this14.options.targetId) {
|
|
1838
|
+
var el = document.getElementById(_this14.options.targetId);
|
|
1729
1839
|
|
|
1730
1840
|
if (el) {
|
|
1731
1841
|
var pdfData = {
|
|
1732
1842
|
options: {}
|
|
1733
1843
|
};
|
|
1734
1844
|
|
|
1735
|
-
if (
|
|
1736
|
-
pdfData.options = _extends({},
|
|
1845
|
+
if (_this14.options.pdfOptions) {
|
|
1846
|
+
pdfData.options = _extends({}, _this14.options.pdfOptions);
|
|
1737
1847
|
}
|
|
1738
1848
|
|
|
1739
|
-
if (
|
|
1740
|
-
if (
|
|
1741
|
-
var headerEl = document.getElementById(
|
|
1849
|
+
if (_this14.options.header) {
|
|
1850
|
+
if (_this14.options.header.elementId) {
|
|
1851
|
+
var headerEl = document.getElementById(_this14.options.header.elementId);
|
|
1742
1852
|
|
|
1743
1853
|
if (headerEl) {
|
|
1744
1854
|
pdfData.header = headerEl.outerHTML;
|
|
1745
1855
|
|
|
1746
|
-
if (
|
|
1747
|
-
pdfData.options.headerCSS =
|
|
1856
|
+
if (_this14.options.header.css) {
|
|
1857
|
+
pdfData.options.headerCSS = _this14.options.header.css;
|
|
1748
1858
|
}
|
|
1749
1859
|
}
|
|
1750
1860
|
} else {
|
|
1751
|
-
pdfData.header =
|
|
1861
|
+
pdfData.header = _this14.options.header;
|
|
1752
1862
|
}
|
|
1753
1863
|
}
|
|
1754
1864
|
|
|
1755
|
-
if (
|
|
1756
|
-
if (
|
|
1757
|
-
var footerEl = document.getElementById(
|
|
1865
|
+
if (_this14.options.footer) {
|
|
1866
|
+
if (_this14.options.footer.elementId) {
|
|
1867
|
+
var footerEl = document.getElementById(_this14.options.footer.elementId);
|
|
1758
1868
|
|
|
1759
1869
|
if (footerEl) {
|
|
1760
1870
|
pdfData.footer = footerEl.outerHTML;
|
|
1761
1871
|
|
|
1762
|
-
if (
|
|
1763
|
-
pdfData.options.footerCSS =
|
|
1872
|
+
if (_this14.options.footer.css) {
|
|
1873
|
+
pdfData.options.footerCSS = _this14.options.footer.css;
|
|
1764
1874
|
}
|
|
1765
1875
|
}
|
|
1766
1876
|
} else {
|
|
1767
|
-
pdfData.footer =
|
|
1877
|
+
pdfData.footer = _this14.options.footer;
|
|
1768
1878
|
}
|
|
1769
1879
|
}
|
|
1770
1880
|
|
|
@@ -1773,16 +1883,16 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
1773
1883
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
1774
1884
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
1775
1885
|
|
|
1776
|
-
|
|
1886
|
+
_this14.service.add('', pdfData, {
|
|
1777
1887
|
responseType: 'blob'
|
|
1778
1888
|
}).then(function (response) {
|
|
1779
|
-
|
|
1889
|
+
_this14.loader.hide();
|
|
1780
1890
|
|
|
1781
1891
|
var blob = new Blob([response], {
|
|
1782
1892
|
type: 'application/pdf'
|
|
1783
1893
|
});
|
|
1784
1894
|
|
|
1785
|
-
|
|
1895
|
+
_this14.popup.show({
|
|
1786
1896
|
message: "\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 <button class='websy-btn'>Download</button>\n </a>\n </div>\n "),
|
|
1787
1897
|
mask: true
|
|
1788
1898
|
});
|
|
@@ -1814,12 +1924,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
1814
1924
|
this.options = _extends({}, DEFAULTS, options);
|
|
1815
1925
|
this.rowCount = 0;
|
|
1816
1926
|
this.busy = false;
|
|
1927
|
+
this.tooltipTimeoutFn = null;
|
|
1817
1928
|
this.data = [];
|
|
1818
1929
|
var el = document.getElementById(this.elementId);
|
|
1819
1930
|
|
|
1820
1931
|
if (el) {
|
|
1821
1932
|
el.innerHTML = "\n <div id='".concat(this.elementId, "_tableContainer' class='websy-vis-table'>\n <!--<div class=\"download-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M16 11h5l-9 10-9-10h5v-11h8v11zm1 11h-10v2h10v-2z\"/></svg>\n </div>-->\n <table>\n <thead id=\"").concat(this.elementId, "_head\">\n </thead>\n <tbody id=\"").concat(this.elementId, "_body\">\n </tbody>\n </table>\n </div>\n ");
|
|
1822
1933
|
el.addEventListener('click', this.handleClick.bind(this));
|
|
1934
|
+
el.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
1935
|
+
el.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
1823
1936
|
var scrollEl = document.getElementById("".concat(this.elementId, "_tableContainer"));
|
|
1824
1937
|
scrollEl.addEventListener('scroll', this.handleScroll.bind(this));
|
|
1825
1938
|
this.render();
|
|
@@ -1831,22 +1944,22 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
1831
1944
|
_createClass(WebsyTable, [{
|
|
1832
1945
|
key: "appendRows",
|
|
1833
1946
|
value: function appendRows(data) {
|
|
1834
|
-
var
|
|
1947
|
+
var _this15 = this;
|
|
1835
1948
|
|
|
1836
1949
|
var bodyHTML = '';
|
|
1837
1950
|
|
|
1838
1951
|
if (data) {
|
|
1839
1952
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
1840
1953
|
return '<tr>' + r.map(function (c, i) {
|
|
1841
|
-
if (
|
|
1842
|
-
if (
|
|
1843
|
-
return "\n <td class='".concat(
|
|
1954
|
+
if (_this15.options.columns[i].show !== false) {
|
|
1955
|
+
if (_this15.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
1956
|
+
return "\n <td class='".concat(_this15.options.columns[i].classes || '', "' ").concat(_this15.options.columns[i].width ? 'style="width: ' + _this15.options.columns[i].width + '"' : '', "><a href='").concat(c.value, "' target='").concat(c.openInNewTab === true ? '_blank' : '_self', "'>").concat(_this15.options.columns[i].linkText || 'Link', "</a></td>\n ");
|
|
1844
1957
|
}
|
|
1845
1958
|
|
|
1846
|
-
if (
|
|
1847
|
-
return "\n <td data-view='".concat(c.value, "' data-row-index='").concat(
|
|
1959
|
+
if (_this15.options.columns[i].showAsNavigatorLink === true && c.value.trim() !== '') {
|
|
1960
|
+
return "\n <td data-view='".concat(c.value, "' data-row-index='").concat(_this15.rowCount + rowIndex, "' data-col-index='").concat(i, "' class='trigger-item ").concat(_this15.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this15.options.columns[i].classes || '', "' ").concat(_this15.options.columns[i].width ? 'style="width: ' + _this15.options.columns[i].width + '"' : '', ">").concat(_this15.options.columns[i].linkText || 'Link', "</td>\n ");
|
|
1848
1961
|
} else {
|
|
1849
|
-
return "\n <td class='".concat(
|
|
1962
|
+
return "\n <td data-info='".concat(c.value, "' class='").concat(_this15.options.columns[i].classes || '', "' ").concat(_this15.options.columns[i].width ? 'style="width: ' + (_this15.options.columns[i].width || 'auto') + '"' : '', ">").concat(c.value, "</td>\n ");
|
|
1850
1963
|
}
|
|
1851
1964
|
}
|
|
1852
1965
|
}).join('') + '</tr>';
|
|
@@ -1877,7 +1990,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
1877
1990
|
if (this.options.onSort) {
|
|
1878
1991
|
this.options.onSort(event, column, colIndex);
|
|
1879
1992
|
} else {
|
|
1880
|
-
this.internalSort();
|
|
1993
|
+
this.internalSort(column, colIndex);
|
|
1881
1994
|
} // const colIndex = +event.target.getAttribute('data-index')
|
|
1882
1995
|
// const dimIndex = +event.target.getAttribute('data-dim-index')
|
|
1883
1996
|
// const expIndex = +event.target.getAttribute('data-exp-index')
|
|
@@ -1912,6 +2025,28 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
1912
2025
|
}
|
|
1913
2026
|
}
|
|
1914
2027
|
}
|
|
2028
|
+
}, {
|
|
2029
|
+
key: "handleMouseMove",
|
|
2030
|
+
value: function handleMouseMove(event) {
|
|
2031
|
+
if (this.tooltipTimeoutFn) {
|
|
2032
|
+
event.target.classList.remove('websy-delayed-info');
|
|
2033
|
+
clearTimeout(this.tooltipTimeoutFn);
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
if (event.target.tagName === 'TD') {
|
|
2037
|
+
this.tooltipTimeoutFn = setTimeout(function () {
|
|
2038
|
+
event.target.classList.add('websy-delayed-info');
|
|
2039
|
+
}, 500);
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
}, {
|
|
2043
|
+
key: "handleMouseOut",
|
|
2044
|
+
value: function handleMouseOut(event) {
|
|
2045
|
+
if (this.tooltipTimeoutFn) {
|
|
2046
|
+
event.target.classList.remove('websy-delayed-info');
|
|
2047
|
+
clearTimeout(this.tooltipTimeoutFn);
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
1915
2050
|
}, {
|
|
1916
2051
|
key: "handleScroll",
|
|
1917
2052
|
value: function handleScroll(event) {
|
|
@@ -1921,11 +2056,49 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
1921
2056
|
}
|
|
1922
2057
|
}, {
|
|
1923
2058
|
key: "internalSort",
|
|
1924
|
-
value: function internalSort() {
|
|
2059
|
+
value: function internalSort(column, colIndex) {
|
|
2060
|
+
this.options.columns.forEach(function (c, i) {
|
|
2061
|
+
c.activeSort = i === colIndex;
|
|
2062
|
+
});
|
|
2063
|
+
|
|
2064
|
+
if (column.sortFunction) {
|
|
2065
|
+
this.data = column.sortFunction(this.data, column);
|
|
2066
|
+
} else {
|
|
2067
|
+
var sortProp = 'value';
|
|
2068
|
+
var sortOrder = column.sort === 'asc' ? 'desc' : 'asc';
|
|
2069
|
+
column.sort = sortOrder;
|
|
2070
|
+
var sortType = column.sortType || 'alphanumeric';
|
|
2071
|
+
|
|
2072
|
+
if (column.sortProp) {
|
|
2073
|
+
sortProp = column.sortProp;
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
this.data.sort(function (a, b) {
|
|
2077
|
+
switch (sortType) {
|
|
2078
|
+
case 'numeric':
|
|
2079
|
+
if (sortOrder === 'asc') {
|
|
2080
|
+
return a[colIndex][sortProp] - b[colIndex][sortProp];
|
|
2081
|
+
} else {
|
|
2082
|
+
return b[colIndex][sortProp] - a[colIndex][sortProp];
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
default:
|
|
2086
|
+
if (sortOrder === 'asc') {
|
|
2087
|
+
return a[colIndex][sortProp] > b[colIndex][sortProp] ? 1 : -1;
|
|
2088
|
+
} else {
|
|
2089
|
+
return a[colIndex][sortProp] < b[colIndex][sortProp] ? 1 : -1;
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
}
|
|
2093
|
+
});
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
this.render(this.data);
|
|
2097
|
+
}
|
|
1925
2098
|
}, {
|
|
1926
2099
|
key: "render",
|
|
1927
2100
|
value: function render(data) {
|
|
1928
|
-
var
|
|
2101
|
+
var _this16 = this;
|
|
1929
2102
|
|
|
1930
2103
|
if (!this.options.columns) {
|
|
1931
2104
|
return;
|
|
@@ -1948,14 +2121,14 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
1948
2121
|
|
|
1949
2122
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
1950
2123
|
if (c.show !== false) {
|
|
1951
|
-
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 ?
|
|
2124
|
+
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 ? _this16.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
1952
2125
|
}
|
|
1953
2126
|
}).join('') + '</tr>';
|
|
1954
2127
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
1955
2128
|
headEl.innerHTML = headHTML;
|
|
1956
2129
|
|
|
1957
2130
|
if (data) {
|
|
1958
|
-
this.data = this.data.concat(data)
|
|
2131
|
+
// this.data = this.data.concat(data)
|
|
1959
2132
|
this.appendRows(data);
|
|
1960
2133
|
}
|
|
1961
2134
|
}
|
|
@@ -2076,11 +2249,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
2076
2249
|
}, {
|
|
2077
2250
|
key: "handleEventMouseMove",
|
|
2078
2251
|
value: function handleEventMouseMove(event, d) {
|
|
2079
|
-
var
|
|
2252
|
+
var _this17 = this;
|
|
2080
2253
|
|
|
2081
2254
|
// console.log('mouse move', event, d, d3.pointer(event))
|
|
2082
2255
|
var bisectDate = d3.bisector(function (d) {
|
|
2083
|
-
return
|
|
2256
|
+
return _this17.parseX(d.x.value);
|
|
2084
2257
|
}).left;
|
|
2085
2258
|
|
|
2086
2259
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -2099,18 +2272,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
2099
2272
|
var pointB = s.data[index];
|
|
2100
2273
|
|
|
2101
2274
|
if (pointA) {
|
|
2102
|
-
xPoint =
|
|
2275
|
+
xPoint = _this17.bottomAxis(_this17.parseX(pointA.x.value));
|
|
2103
2276
|
tooltipTitle = pointA.x.value;
|
|
2104
2277
|
|
|
2105
2278
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
2106
|
-
tooltipTitle = d3.timeFormat(
|
|
2279
|
+
tooltipTitle = d3.timeFormat(_this17.options.dateFormat)(pointA.x.value);
|
|
2107
2280
|
}
|
|
2108
2281
|
}
|
|
2109
2282
|
|
|
2110
2283
|
if (pointA && pointB) {
|
|
2111
|
-
var d0 =
|
|
2284
|
+
var d0 = _this17.bottomAxis(_this17.parseX(pointA.x.value));
|
|
2112
2285
|
|
|
2113
|
-
var d1 =
|
|
2286
|
+
var d1 = _this17.bottomAxis(_this17.parseX(pointB.x.value));
|
|
2114
2287
|
|
|
2115
2288
|
var mid = Math.abs(d0 - d1) / 2;
|
|
2116
2289
|
|
|
@@ -2119,7 +2292,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
2119
2292
|
tooltipTitle = pointB.x.value;
|
|
2120
2293
|
|
|
2121
2294
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
2122
|
-
tooltipTitle = d3.timeFormat(
|
|
2295
|
+
tooltipTitle = d3.timeFormat(_this17.options.dateFormat)(pointB.x.value);
|
|
2123
2296
|
}
|
|
2124
2297
|
|
|
2125
2298
|
tooltipData.push(pointB.y);
|
|
@@ -2181,7 +2354,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
2181
2354
|
}, {
|
|
2182
2355
|
key: "render",
|
|
2183
2356
|
value: function render(options) {
|
|
2184
|
-
var
|
|
2357
|
+
var _this18 = this;
|
|
2185
2358
|
|
|
2186
2359
|
/* global d3 options */
|
|
2187
2360
|
if (typeof options !== 'undefined') {
|
|
@@ -2389,7 +2562,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
2389
2562
|
|
|
2390
2563
|
if (this.options.data.bottom.formatter) {
|
|
2391
2564
|
bAxisFunc.tickFormat(function (d) {
|
|
2392
|
-
return
|
|
2565
|
+
return _this18.options.data.bottom.formatter(d);
|
|
2393
2566
|
});
|
|
2394
2567
|
}
|
|
2395
2568
|
|
|
@@ -2415,8 +2588,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
2415
2588
|
|
|
2416
2589
|
if (this.options.margin.axisLeft > 0) {
|
|
2417
2590
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
2418
|
-
if (
|
|
2419
|
-
d =
|
|
2591
|
+
if (_this18.options.data.left.formatter) {
|
|
2592
|
+
d = _this18.options.data.left.formatter(d);
|
|
2420
2593
|
}
|
|
2421
2594
|
|
|
2422
2595
|
return d;
|
|
@@ -2451,8 +2624,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
2451
2624
|
|
|
2452
2625
|
if (this.options.margin.axisRight > 0) {
|
|
2453
2626
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
2454
|
-
if (
|
|
2455
|
-
d =
|
|
2627
|
+
if (_this18.options.data.right.formatter) {
|
|
2628
|
+
d = _this18.options.data.right.formatter(d);
|
|
2456
2629
|
}
|
|
2457
2630
|
|
|
2458
2631
|
return d;
|
|
@@ -2478,14 +2651,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
2478
2651
|
|
|
2479
2652
|
this.options.data.series.forEach(function (series, index) {
|
|
2480
2653
|
if (!series.key) {
|
|
2481
|
-
series.key =
|
|
2654
|
+
series.key = _this18.createIdentity();
|
|
2482
2655
|
}
|
|
2483
2656
|
|
|
2484
2657
|
if (!series.color) {
|
|
2485
|
-
series.color =
|
|
2658
|
+
series.color = _this18.options.colors[index % _this18.options.colors.length];
|
|
2486
2659
|
}
|
|
2487
2660
|
|
|
2488
|
-
|
|
2661
|
+
_this18["render".concat(series.type || 'bar')](series, index);
|
|
2489
2662
|
});
|
|
2490
2663
|
}
|
|
2491
2664
|
}
|
|
@@ -2493,17 +2666,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
2493
2666
|
}, {
|
|
2494
2667
|
key: "renderarea",
|
|
2495
2668
|
value: function renderarea(series, index) {
|
|
2496
|
-
var
|
|
2669
|
+
var _this19 = this;
|
|
2497
2670
|
|
|
2498
2671
|
/* global d3 series index */
|
|
2499
2672
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
2500
2673
|
return d3.area().x(function (d) {
|
|
2501
|
-
return
|
|
2674
|
+
return _this19[xAxis](_this19.parseX(d.x.value));
|
|
2502
2675
|
}).y0(function (d) {
|
|
2503
|
-
return
|
|
2676
|
+
return _this19[yAxis](0);
|
|
2504
2677
|
}).y1(function (d) {
|
|
2505
|
-
return
|
|
2506
|
-
}).curve(d3[curveStyle ||
|
|
2678
|
+
return _this19[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
2679
|
+
}).curve(d3[curveStyle || _this19.options.curveStyle]);
|
|
2507
2680
|
};
|
|
2508
2681
|
|
|
2509
2682
|
var xAxis = 'bottomAxis';
|
|
@@ -2591,15 +2764,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
2591
2764
|
}, {
|
|
2592
2765
|
key: "renderline",
|
|
2593
2766
|
value: function renderline(series, index) {
|
|
2594
|
-
var
|
|
2767
|
+
var _this20 = this;
|
|
2595
2768
|
|
|
2596
2769
|
/* global series index d3 */
|
|
2597
2770
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
2598
2771
|
return d3.line().x(function (d) {
|
|
2599
|
-
return
|
|
2772
|
+
return _this20[xAxis](_this20.parseX(d.x.value));
|
|
2600
2773
|
}).y(function (d) {
|
|
2601
|
-
return
|
|
2602
|
-
}).curve(d3[curveStyle ||
|
|
2774
|
+
return _this20[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
2775
|
+
}).curve(d3[curveStyle || _this20.options.curveStyle]);
|
|
2603
2776
|
};
|
|
2604
2777
|
|
|
2605
2778
|
var xAxis = 'bottomAxis';
|
|
@@ -2636,14 +2809,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
2636
2809
|
}, {
|
|
2637
2810
|
key: "rendersymbol",
|
|
2638
2811
|
value: function rendersymbol(series, index) {
|
|
2639
|
-
var
|
|
2812
|
+
var _this21 = this;
|
|
2640
2813
|
|
|
2641
2814
|
/* global d3 series index series.key */
|
|
2642
2815
|
var drawSymbol = function drawSymbol(size) {
|
|
2643
2816
|
return d3.symbol() // .type(d => {
|
|
2644
2817
|
// return d3.symbols[0]
|
|
2645
2818
|
// })
|
|
2646
|
-
.size(size ||
|
|
2819
|
+
.size(size || _this21.options.symbolSize);
|
|
2647
2820
|
};
|
|
2648
2821
|
|
|
2649
2822
|
var xAxis = 'bottomAxis';
|
|
@@ -2661,7 +2834,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
2661
2834
|
symbols.attr('d', function (d) {
|
|
2662
2835
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
2663
2836
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
2664
|
-
return "translate(".concat(
|
|
2837
|
+
return "translate(".concat(_this21[xAxis](_this21.parseX(d.x.value)), ", ").concat(_this21[yAxis](d.y.value), ")");
|
|
2665
2838
|
}); // Enter
|
|
2666
2839
|
|
|
2667
2840
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -2669,7 +2842,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
2669
2842
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
2670
2843
|
return "symbol symbol_".concat(series.key);
|
|
2671
2844
|
}).attr('transform', function (d) {
|
|
2672
|
-
return "translate(".concat(
|
|
2845
|
+
return "translate(".concat(_this21[xAxis](_this21.parseX(d.x.value)), ", ").concat(_this21[yAxis](d.y.value), ")");
|
|
2673
2846
|
});
|
|
2674
2847
|
}
|
|
2675
2848
|
}, {
|
|
@@ -2875,7 +3048,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
2875
3048
|
}, {
|
|
2876
3049
|
key: "render",
|
|
2877
3050
|
value: function render() {
|
|
2878
|
-
var
|
|
3051
|
+
var _this22 = this;
|
|
2879
3052
|
|
|
2880
3053
|
var el = document.getElementById("".concat(this.options.elementId, "_map"));
|
|
2881
3054
|
var t = L.tileLayer(this.options.tileUrl, {
|
|
@@ -2942,30 +3115,30 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
2942
3115
|
if (r.Latitude.qNum !== 0 && r.Longitude.qNum !== 0) {
|
|
2943
3116
|
var markerOptions = {};
|
|
2944
3117
|
|
|
2945
|
-
if (
|
|
3118
|
+
if (_this22.options.simpleMarker === true) {
|
|
2946
3119
|
markerOptions.icon = L.divIcon({
|
|
2947
3120
|
className: 'simple-marker'
|
|
2948
3121
|
});
|
|
2949
3122
|
}
|
|
2950
3123
|
|
|
2951
|
-
if (
|
|
3124
|
+
if (_this22.options.markerUrl) {
|
|
2952
3125
|
markerOptions.icon = L.icon({
|
|
2953
|
-
iconUrl:
|
|
3126
|
+
iconUrl: _this22.options.markerUrl
|
|
2954
3127
|
});
|
|
2955
3128
|
}
|
|
2956
3129
|
|
|
2957
3130
|
markerOptions.data = r;
|
|
2958
3131
|
var m = L.marker([r.Latitude.qText, r.Longitude.qText], markerOptions);
|
|
2959
|
-
m.on('click',
|
|
3132
|
+
m.on('click', _this22.handleMapClick.bind(_this22));
|
|
2960
3133
|
|
|
2961
|
-
if (
|
|
2962
|
-
m.addTo(
|
|
3134
|
+
if (_this22.options.useClustering === false) {
|
|
3135
|
+
m.addTo(_this22.map);
|
|
2963
3136
|
}
|
|
2964
3137
|
|
|
2965
|
-
|
|
3138
|
+
_this22.markers.push(m);
|
|
2966
3139
|
|
|
2967
|
-
if (
|
|
2968
|
-
|
|
3140
|
+
if (_this22.options.useClustering === true) {
|
|
3141
|
+
_this22.cluster.addLayer(m);
|
|
2969
3142
|
}
|
|
2970
3143
|
}
|
|
2971
3144
|
});
|
|
@@ -2980,6 +3153,8 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
2980
3153
|
var g = L.featureGroup(this.markers);
|
|
2981
3154
|
this.map.fitBounds(g.getBounds());
|
|
2982
3155
|
this.map.invalidateSize();
|
|
3156
|
+
} else if (this.geo) {
|
|
3157
|
+
this.map.fitBounds(this.geo.getBounds());
|
|
2983
3158
|
} else if (this.options.center) {
|
|
2984
3159
|
this.map.setView(this.options.center, this.options.zoom || null);
|
|
2985
3160
|
}
|