@websy/websy-designs 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/websy-designs-server.js +4 -4
- package/dist/websy-designs-es6.debug.js +498 -26
- package/dist/websy-designs-es6.js +528 -169
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +453 -25
- package/dist/websy-designs.js +513 -141
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +2 -1
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _websyDesignsQlikPluginEs = _interopRequireDefault(require("@websy/websy-designs-qlik-plugin/dist/websy-designs-qlik-plugin-es6"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
7
11
|
|
|
8
12
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
9
13
|
|
|
@@ -27,33 +31,6 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
27
31
|
|
|
28
32
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
29
33
|
|
|
30
|
-
/* global
|
|
31
|
-
include
|
|
32
|
-
WebsyPopupDialog
|
|
33
|
-
WebsyLoadingDialog
|
|
34
|
-
WebsyNavigationMenu
|
|
35
|
-
WebsyPubSub
|
|
36
|
-
WebsyForm
|
|
37
|
-
WebsyDatePicker
|
|
38
|
-
WebsyDropdown
|
|
39
|
-
WebsyRouter
|
|
40
|
-
WebsyResultList
|
|
41
|
-
WebsyTable
|
|
42
|
-
WebsyTable2
|
|
43
|
-
WebsyChart
|
|
44
|
-
WebsyChartTooltip
|
|
45
|
-
WebsyLegend
|
|
46
|
-
WebsyMap
|
|
47
|
-
WebsyKPI
|
|
48
|
-
WebsyPDFButton
|
|
49
|
-
Switch
|
|
50
|
-
WebsyTemplate
|
|
51
|
-
APIService
|
|
52
|
-
ButtonGroup
|
|
53
|
-
WebsyUtils
|
|
54
|
-
Pager
|
|
55
|
-
*/
|
|
56
|
-
|
|
57
34
|
/* global XMLHttpRequest fetch ENV */
|
|
58
35
|
var APIService = /*#__PURE__*/function () {
|
|
59
36
|
function APIService() {
|
|
@@ -311,6 +288,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
311
288
|
minAllowedYear: 1970,
|
|
312
289
|
maxAllowedYear: new Date().getFullYear(),
|
|
313
290
|
daysOfWeek: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
|
|
291
|
+
monthsOfYear: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
292
|
+
hours: new Array(24).fill(0).map(function (d, i) {
|
|
293
|
+
return (i < 10 ? '0' : '') + i + ':00';
|
|
294
|
+
}),
|
|
314
295
|
mode: 'date',
|
|
315
296
|
monthMap: {
|
|
316
297
|
0: 'Jan',
|
|
@@ -363,7 +344,21 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
363
344
|
}, {
|
|
364
345
|
label: 'Last 10 Years',
|
|
365
346
|
range: [new Date().getFullYear() - 9, DEFAULTS.maxAllowedYear]
|
|
366
|
-
}]
|
|
347
|
+
}],
|
|
348
|
+
monthyear: [{
|
|
349
|
+
label: 'All',
|
|
350
|
+
range: [DEFAULTS.minAllowedDate, DEFAULTS.maxAllowedDate]
|
|
351
|
+
}, {
|
|
352
|
+
label: 'Last 12 Months',
|
|
353
|
+
range: [this.floorDate(new Date(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() - 12))), this.floorDate(new Date(new Date().setDate(1)))]
|
|
354
|
+
}, {
|
|
355
|
+
label: 'Last 18 Months',
|
|
356
|
+
range: [this.floorDate(new Date(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() - 18))), this.floorDate(new Date(new Date().setDate(1)))]
|
|
357
|
+
}, {
|
|
358
|
+
label: 'Last 24 Months',
|
|
359
|
+
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
|
+
}],
|
|
361
|
+
hour: []
|
|
367
362
|
};
|
|
368
363
|
this.options = _extends({}, DEFAULTS, options);
|
|
369
364
|
this.selectedRange = this.options.defaultRange || 0;
|
|
@@ -387,7 +382,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
387
382
|
el.addEventListener('mouseup', this.handleMouseUp.bind(this));
|
|
388
383
|
document.addEventListener('keydown', this.handleKeyDown.bind(this));
|
|
389
384
|
document.addEventListener('keyup', this.handleKeyUp.bind(this));
|
|
390
|
-
var html = "\n <div class='websy-date-picker-container'>\n <span class='websy-dropdown-header-label'>".concat(this.options.label || 'Date', "</span>\n <div id=\"").concat(this.elementId, "_header\" class='websy-date-picker-header ").concat(this.options.allowClear === true ? 'allow-clear' : '', "'>\n <span id='").concat(this.elementId, "_selectedRange'>").concat(this.options.ranges[this.options.mode][this.selectedRange].label, "</span>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M23.677 18.52c.914 1.523-.183 3.472-1.967 3.472h-19.414c-1.784 0-2.881-1.949-1.967-3.472l9.709-16.18c.891-1.483 3.041-1.48 3.93 0l9.709 16.18z\"/></svg>\n ");
|
|
385
|
+
var html = "\n <div class='websy-date-picker-container ".concat(this.options.mode, "'>\n <span class='websy-dropdown-header-label'>").concat(this.options.label || 'Date', "</span>\n <div id=\"").concat(this.elementId, "_header\" class='websy-date-picker-header ").concat(this.options.allowClear === true ? 'allow-clear' : '', "'>\n <span id='").concat(this.elementId, "_selectedRange'>").concat(this.options.ranges[this.options.mode][this.selectedRange].label, "</span>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M23.677 18.52c.914 1.523-.183 3.472-1.967 3.472h-19.414c-1.784 0-2.881-1.949-1.967-3.472l9.709-16.18c.891-1.483 3.041-1.48 3.93 0l9.709 16.18z\"/></svg>\n ");
|
|
391
386
|
|
|
392
387
|
if (this.options.allowClear === true) {
|
|
393
388
|
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 ";
|
|
@@ -417,6 +412,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
417
412
|
|
|
418
413
|
if (confirm === true) {
|
|
419
414
|
if (this.options.onChange) {
|
|
415
|
+
console.log('confirm', this.selectedRangeDates);
|
|
416
|
+
console.log('confirm', this.currentselection);
|
|
417
|
+
|
|
420
418
|
if (this.customRangeSelected === true) {
|
|
421
419
|
this.options.onChange(this.selectedRangeDates, true);
|
|
422
420
|
} else {
|
|
@@ -490,7 +488,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
490
488
|
value: function handleMouseDown(event) {
|
|
491
489
|
if (this.shiftPressed === true && this.currentselection.length > 0) {
|
|
492
490
|
this.mouseDownId = this.currentselection[this.currentselection.length - 1];
|
|
493
|
-
this.selectDate(+event.target.id.split('_')[
|
|
491
|
+
this.selectDate(+event.target.id.split('_')[1]);
|
|
494
492
|
} else {
|
|
495
493
|
this.mouseDown = true;
|
|
496
494
|
this.dragging = false;
|
|
@@ -505,7 +503,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
505
503
|
this.customRangeSelected = false;
|
|
506
504
|
}
|
|
507
505
|
|
|
508
|
-
this.mouseDownId = +event.target.id.split('_')[
|
|
506
|
+
this.mouseDownId = +event.target.id.split('_')[1];
|
|
509
507
|
this.selectDate(this.mouseDownId);
|
|
510
508
|
}
|
|
511
509
|
}
|
|
@@ -519,9 +517,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
519
517
|
return;
|
|
520
518
|
}
|
|
521
519
|
|
|
522
|
-
if (event.target.id.split('_')[
|
|
520
|
+
if (event.target.id.split('_')[1] !== this.mouseDownId) {
|
|
523
521
|
this.dragging = true;
|
|
524
|
-
this.selectDate(+event.target.id.split('_')[
|
|
522
|
+
this.selectDate(+event.target.id.split('_')[1]);
|
|
525
523
|
}
|
|
526
524
|
}
|
|
527
525
|
}
|
|
@@ -553,6 +551,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
553
551
|
|
|
554
552
|
if (this.customRangeSelected === true) {
|
|
555
553
|
console.log('if date selection', this.currentselection);
|
|
554
|
+
console.log('if month selection', this.currentselection.map(function (d) {
|
|
555
|
+
return new Date(d);
|
|
556
|
+
}));
|
|
556
557
|
var diff;
|
|
557
558
|
|
|
558
559
|
if (this.options.mode === 'date') {
|
|
@@ -564,6 +565,12 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
564
565
|
|
|
565
566
|
if (this.selectedRangeDates[this.selectedRangeDates.length - 1] !== this.selectedRangeDates[0]) {// diff += 1
|
|
566
567
|
}
|
|
568
|
+
} else if (this.options.mode === 'monthyear') {
|
|
569
|
+
var yearDiff = (this.selectedRangeDates[this.selectedRangeDates.length - 1].getFullYear() - this.selectedRangeDates[0].getFullYear()) * 12;
|
|
570
|
+
diff = Math.floor(this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth() - this.selectedRangeDates[0].getMonth()) + yearDiff;
|
|
571
|
+
console.log('year diff', yearDiff);
|
|
572
|
+
console.log('diff', diff);
|
|
573
|
+
} else if (this.options.mode === 'hour') {//
|
|
567
574
|
}
|
|
568
575
|
|
|
569
576
|
for (var _i = 0; _i < diff + 1; _i++) {
|
|
@@ -580,14 +587,25 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
580
587
|
d = this.selectedRangeDates[0] + _i;
|
|
581
588
|
rangeStart = this.selectedRangeDates[0];
|
|
582
589
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
590
|
+
} else if (this.options.mode === 'monthyear') {
|
|
591
|
+
d = new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + _i);
|
|
592
|
+
rangeStart = this.selectedRangeDates[0].getTime();
|
|
593
|
+
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
594
|
+
} else if (this.options.mode === 'hour') {//
|
|
583
595
|
}
|
|
584
596
|
|
|
585
597
|
var dateEl = void 0;
|
|
586
598
|
|
|
587
599
|
if (this.options.mode === 'date') {
|
|
588
|
-
dateEl = document.getElementById("".concat(d, "_date"));
|
|
600
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_date"));
|
|
589
601
|
} else if (this.options.mode === 'year') {
|
|
590
|
-
dateEl = document.getElementById("".concat(d, "_year"));
|
|
602
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_year"));
|
|
603
|
+
} else if (this.options.mode === 'monthyear') {
|
|
604
|
+
console.log('d', d);
|
|
605
|
+
console.log(this.selectedRangeDates);
|
|
606
|
+
console.log(rangeStart, rangeEnd);
|
|
607
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_monthyear"));
|
|
608
|
+
} else if (this.options.mode === 'hour') {//
|
|
591
609
|
}
|
|
592
610
|
|
|
593
611
|
if (dateEl) {
|
|
@@ -607,9 +625,12 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
607
625
|
var dateEl;
|
|
608
626
|
|
|
609
627
|
if (_this2.options.mode === 'date') {
|
|
610
|
-
dateEl = document.getElementById("".concat(d, "_date"));
|
|
628
|
+
dateEl = document.getElementById("".concat(_this2.elementId, "_").concat(d, "_date"));
|
|
611
629
|
} else if (_this2.options.mode === 'year') {
|
|
612
|
-
dateEl = document.getElementById("".concat(d, "_year"));
|
|
630
|
+
dateEl = document.getElementById("".concat(_this2.elementId, "_").concat(d, "_year"));
|
|
631
|
+
} else if (_this2.options.mode === 'monthyear') {
|
|
632
|
+
dateEl = document.getElementById("".concat(_this2.elementId, "_").concat(d, "_monthyear"));
|
|
633
|
+
} else if (_this2.options.mode === 'hour') {//
|
|
613
634
|
}
|
|
614
635
|
|
|
615
636
|
dateEl.classList.add('selected');
|
|
@@ -668,6 +689,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
668
689
|
var disabled = [];
|
|
669
690
|
this.validDates = [];
|
|
670
691
|
this.validYears = [];
|
|
692
|
+
this.monthYears = {};
|
|
693
|
+
this.monthYearMonths = [];
|
|
671
694
|
|
|
672
695
|
if (disabledDates) {
|
|
673
696
|
disabled = disabledDates.map(function (d) {
|
|
@@ -675,6 +698,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
675
698
|
return d.getTime();
|
|
676
699
|
} else if (_this3.options.mode === 'year') {
|
|
677
700
|
return d;
|
|
701
|
+
} else if (_this3.options.mode === 'monthyear') {//
|
|
702
|
+
} else if (_this3.options.mode === 'hour') {//
|
|
678
703
|
}
|
|
679
704
|
|
|
680
705
|
return d.getTime();
|
|
@@ -691,13 +716,16 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
691
716
|
diff = Math.ceil((this.options.maxAllowedDate.getTime() - this.options.minAllowedDate.getTime()) / this.oneDay) + 1;
|
|
692
717
|
} else if (this.options.mode === 'year') {
|
|
693
718
|
diff = this.options.maxAllowedYear - this.options.minAllowedYear + 1;
|
|
719
|
+
} else if (this.options.mode === 'monthyear') {
|
|
720
|
+
diff = Math.ceil((this.options.maxAllowedDate.getTime() - this.options.minAllowedDate.getTime()) / this.oneDay) + 1;
|
|
721
|
+
} else if (this.options.mode === 'hour') {//
|
|
694
722
|
}
|
|
695
723
|
|
|
696
724
|
var months = {};
|
|
697
725
|
var yearList = [];
|
|
698
726
|
|
|
699
727
|
for (var i = 0; i < diff; i++) {
|
|
700
|
-
if (this.options.mode === 'date') {
|
|
728
|
+
if (this.options.mode === 'date' || this.options.mode === 'monthyear') {
|
|
701
729
|
var d = this.floorDate(new Date(this.options.minAllowedDate.getTime() + i * this.oneDay));
|
|
702
730
|
var monthYear = "".concat(this.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
703
731
|
|
|
@@ -705,6 +733,21 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
705
733
|
months[monthYear] = [];
|
|
706
734
|
}
|
|
707
735
|
|
|
736
|
+
if (!this.monthYears[d.getFullYear()]) {
|
|
737
|
+
this.monthYears[d.getFullYear()] = [];
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
if (this.monthYearMonths.indexOf("".concat(d.getMonth(), "-").concat(d.getFullYear())) === -1) {
|
|
741
|
+
this.monthYearMonths.push("".concat(d.getMonth(), "-").concat(d.getFullYear()));
|
|
742
|
+
this.monthYears[d.getFullYear()].push({
|
|
743
|
+
date: new Date(d.setDate(1)),
|
|
744
|
+
month: this.options.monthMap[d.getMonth()],
|
|
745
|
+
monthNum: d.getMonth(),
|
|
746
|
+
year: d.getFullYear(),
|
|
747
|
+
id: d.setDate(1)
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
|
|
708
751
|
if (disabled.indexOf(d.getTime()) === -1) {
|
|
709
752
|
this.validDates.push(d.getTime());
|
|
710
753
|
}
|
|
@@ -728,6 +771,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
728
771
|
if (disabled.indexOf(_d) === -1) {
|
|
729
772
|
this.validYears.push(_d);
|
|
730
773
|
}
|
|
774
|
+
} else if (this.options.mode === 'hour') {//
|
|
731
775
|
}
|
|
732
776
|
} // check each range to see if it can be enabled
|
|
733
777
|
|
|
@@ -735,7 +779,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
735
779
|
for (var _i2 = 0; _i2 < this.options.ranges[this.options.mode].length; _i2++) {
|
|
736
780
|
var r = this.options.ranges[this.options.mode][_i2];
|
|
737
781
|
|
|
738
|
-
if (this.options.mode === 'date') {
|
|
782
|
+
if (this.options.mode === 'date' || this.options.mode === 'monthyear') {
|
|
739
783
|
// check the first date
|
|
740
784
|
if (this.validDates.indexOf(r.range[0].getTime()) !== -1) {
|
|
741
785
|
r.disabled = false;
|
|
@@ -771,6 +815,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
771
815
|
}
|
|
772
816
|
}
|
|
773
817
|
}
|
|
818
|
+
} else if (this.options.mode === 'monthyear') {//
|
|
819
|
+
} else if (this.options.mode === 'hour') {//
|
|
774
820
|
}
|
|
775
821
|
}
|
|
776
822
|
|
|
@@ -797,7 +843,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
797
843
|
}
|
|
798
844
|
|
|
799
845
|
html += months[key].map(function (d) {
|
|
800
|
-
return "<li id='".concat(d.id, "_date' class='websy-dp-date ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.dayOfMonth, "</li>");
|
|
846
|
+
return "<li id='".concat(_this3.elementId, "_").concat(d.id, "_date' class='websy-dp-date ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.dayOfMonth, "</li>");
|
|
801
847
|
}).join('');
|
|
802
848
|
html += "\n </ul>\n </div>\n ";
|
|
803
849
|
}
|
|
@@ -810,9 +856,33 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
810
856
|
|
|
811
857
|
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'><ul>");
|
|
812
858
|
html += yearList.map(function (d) {
|
|
813
|
-
return "<li id='".concat(d.id, "_year' class='websy-dp-date websy-dp-year ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.year, "</li>");
|
|
859
|
+
return "<li id='".concat(_this3.elementId, "_").concat(d.id, "_year' class='websy-dp-date websy-dp-year ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.year, "</li>");
|
|
814
860
|
}).join('');
|
|
815
861
|
html += "</ul></div>";
|
|
862
|
+
} else if (this.options.mode === 'monthyear') {
|
|
863
|
+
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-monthyear-container'>");
|
|
864
|
+
|
|
865
|
+
for (var year in this.monthYears) {
|
|
866
|
+
html += "\n <ul>\n <li>".concat(year, "</li>\n ");
|
|
867
|
+
|
|
868
|
+
if (this.monthYears[year][0].monthNum > 0) {
|
|
869
|
+
var paddedMonths = [];
|
|
870
|
+
|
|
871
|
+
for (var _i6 = 0; _i6 < this.monthYears[year][0].monthNum; _i6++) {
|
|
872
|
+
paddedMonths.push("<li> </li>");
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
html += paddedMonths.join('');
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
html += this.monthYears[year].map(function (d) {
|
|
879
|
+
return "<li id='".concat(_this3.elementId, "_").concat(d.id, "_monthyear' data-year='").concat(d.year, "' class='websy-dp-date websy-dp-monthyear'>").concat(d.month, "</li>");
|
|
880
|
+
}).join('');
|
|
881
|
+
html += "</ul>";
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
html += "</div>";
|
|
885
|
+
} else if (this.options.mode === 'hour') {//
|
|
816
886
|
}
|
|
817
887
|
|
|
818
888
|
return html;
|
|
@@ -833,13 +903,15 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
833
903
|
var el;
|
|
834
904
|
|
|
835
905
|
if (this.options.mode === 'date') {
|
|
836
|
-
el = document.getElementById("".concat(this.selectedRangeDates[0].getTime(), "_date"));
|
|
906
|
+
el = document.getElementById("".concat(this.elementId, "_").concat(this.selectedRangeDates[0].getTime(), "_date"));
|
|
837
907
|
} else if (this.options.mode === 'year') {
|
|
838
908
|
if (this.options.sortDirection === 'desc') {
|
|
839
|
-
el = document.getElementById("".concat(this.selectedRangeDates[this.selectedRangeDates.length - 1], "_year"));
|
|
909
|
+
el = document.getElementById("".concat(this.elementId, "_").concat(this.selectedRangeDates[this.selectedRangeDates.length - 1], "_year"));
|
|
840
910
|
} else {
|
|
841
|
-
el = document.getElementById("".concat(this.selectedRangeDates[0], "_year"));
|
|
911
|
+
el = document.getElementById("".concat(this.elementId, "_").concat(this.selectedRangeDates[0], "_year"));
|
|
842
912
|
}
|
|
913
|
+
} else if (this.options.mode === 'monthyear') {//
|
|
914
|
+
} else if (this.options.mode === 'hour') {//
|
|
843
915
|
}
|
|
844
916
|
|
|
845
917
|
var parentEl = document.getElementById("".concat(this.elementId, "_dateList"));
|
|
@@ -865,6 +937,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
865
937
|
}
|
|
866
938
|
|
|
867
939
|
this.customRangeSelected = true;
|
|
940
|
+
console.log('current selection', this.currentselection);
|
|
868
941
|
} else {
|
|
869
942
|
this.currentselection.push(timestamp);
|
|
870
943
|
this.currentselection.sort(function (a, b) {
|
|
@@ -874,10 +947,13 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
874
947
|
}
|
|
875
948
|
}
|
|
876
949
|
|
|
877
|
-
if (this.options.mode === 'date') {
|
|
950
|
+
if (this.options.mode === 'date' || this.options.mode === 'monthyear') {
|
|
878
951
|
this.selectedRangeDates = [new Date(this.currentselection[0]), new Date(this.currentselection[1] || this.currentselection[0])];
|
|
952
|
+
console.log('selected range', this.selectedRangeDates);
|
|
879
953
|
} else if (this.options.mode === 'year') {
|
|
880
954
|
this.selectedRangeDates = [this.currentselection[0], this.currentselection[1] || this.currentselection[0]];
|
|
955
|
+
} else if (this.options.mode === 'monthyear') {//
|
|
956
|
+
} else if (this.options.mode === 'hour') {//
|
|
881
957
|
} // if (this.currentselection.length === 2) {
|
|
882
958
|
// this.currentselection = []
|
|
883
959
|
// }
|
|
@@ -933,7 +1009,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
933
1009
|
}, {
|
|
934
1010
|
key: "setDateBounds",
|
|
935
1011
|
value: function setDateBounds(range) {
|
|
936
|
-
if (['All Dates', 'All Years'].indexOf(this.options.ranges[this.options.mode][0].label) !== -1) {
|
|
1012
|
+
if (['All Dates', 'All Years', 'All'].indexOf(this.options.ranges[this.options.mode][0].label) !== -1) {
|
|
937
1013
|
this.options.ranges[this.options.mode][0].range = [range[0], range[1] || range[0]];
|
|
938
1014
|
}
|
|
939
1015
|
|
|
@@ -943,6 +1019,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
943
1019
|
} else if (this.options.mode === 'year') {
|
|
944
1020
|
this.options.minAllowedYear = range[0];
|
|
945
1021
|
this.options.maxAllowedYear = range[1] || range[0];
|
|
1022
|
+
} else if (this.options.mode === 'monthyear') {
|
|
1023
|
+
this.options.minAllowedDate = range[0];
|
|
1024
|
+
this.options.maxAllowedDate = range[1] || range[0];
|
|
1025
|
+
} else if (this.options.mode === 'hour') {//
|
|
946
1026
|
}
|
|
947
1027
|
}
|
|
948
1028
|
}, {
|
|
@@ -962,6 +1042,13 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
962
1042
|
return d.toLocaleDateString();
|
|
963
1043
|
} else if (_this5.options.mode === 'year') {
|
|
964
1044
|
return d;
|
|
1045
|
+
} else if (_this5.options.mode === 'monthyear') {
|
|
1046
|
+
if (!d.getMonth) {
|
|
1047
|
+
d = new Date(d);
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
return "".concat(_this5.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
1051
|
+
} else if (_this5.options.mode === 'hour') {//
|
|
965
1052
|
}
|
|
966
1053
|
});
|
|
967
1054
|
var start = list[0];
|
|
@@ -1023,7 +1110,8 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1023
1110
|
disabled: false,
|
|
1024
1111
|
minSearchCharacters: 2,
|
|
1025
1112
|
showCompleteSelectedList: false,
|
|
1026
|
-
closeAfterSelection: true
|
|
1113
|
+
closeAfterSelection: true,
|
|
1114
|
+
customActions: []
|
|
1027
1115
|
};
|
|
1028
1116
|
this.options = _extends({}, DEFAULTS, options);
|
|
1029
1117
|
|
|
@@ -1057,7 +1145,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1057
1145
|
var headerValue = this.selectedItems.map(function (s) {
|
|
1058
1146
|
return _this6.options.items[s].value || _this6.options.items[s].label;
|
|
1059
1147
|
}).join(this.options.multiValueDelimiter);
|
|
1060
|
-
var html = "\n <div id='".concat(this.elementId, "_container' class='websy-dropdown-container ").concat(this.options.disabled ? 'disabled' : '', " ").concat(this.options.disableSearch !== true ? 'with-search' : '', " ").concat(this.options.style, "'>\n <div id='").concat(this.elementId, "_header' class='websy-dropdown-header ").concat(this.selectedItems.length === 1 ? 'one-selected' : '', " ").concat(this.options.allowClear === true ? 'allow-clear' : '', "'>\n <svg class='search' width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>\n <span id='").concat(this.elementId, "_headerLabel' class='websy-dropdown-header-label'>").concat(this.options.label, "</span>\n <span data-info='").concat(headerLabel, "' class='websy-dropdown-header-value' id='").concat(this.elementId, "_selectedItems'>").concat(headerLabel, "</span>\n <input class='dropdown-input' id='").concat(this.elementId, "_input' name='").concat(this.options.field || this.options.label, "' value='").concat(headerValue, "'>\n <svg class='arrow' xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M23.677 18.52c.914 1.523-.183 3.472-1.967 3.472h-19.414c-1.784 0-2.881-1.949-1.967-3.472l9.709-16.18c.891-1.483 3.041-1.48 3.93 0l9.709 16.18z\"/></svg> \n ");
|
|
1148
|
+
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 ");
|
|
1061
1149
|
|
|
1062
1150
|
if (this.options.allowClear === true) {
|
|
1063
1151
|
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 ";
|
|
@@ -1065,6 +1153,14 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1065
1153
|
|
|
1066
1154
|
html += " \n </div>\n <div id='".concat(this.elementId, "_mask' class='websy-dropdown-mask'></div>\n <div id='").concat(this.elementId, "_content' class='websy-dropdown-content'>\n ");
|
|
1067
1155
|
|
|
1156
|
+
if (this.options.customActions.length > 0) {
|
|
1157
|
+
html += "\n <div class='websy-dropdown-action-container'>\n <button class='websy-dropdown-action-button'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 512 512\">><circle cx=\"256\" cy=\"256\" r=\"32\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><circle cx=\"416\" cy=\"256\" r=\"32\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><circle cx=\"96\" cy=\"256\" r=\"32\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/></svg>\n </button>\n <ul id='".concat(this.elementId, "_actionContainer'>\n ");
|
|
1158
|
+
this.options.customActions.forEach(function (a, i) {
|
|
1159
|
+
html += "\n <li class='websy-dropdown-custom-action' data-index='".concat(i, "'>").concat(a.label, "</li>\n ");
|
|
1160
|
+
});
|
|
1161
|
+
html += "\n </ul>\n </div>\n ";
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1068
1164
|
if (this.options.disableSearch !== true) {
|
|
1069
1165
|
html += "\n <input id='".concat(this.elementId, "_search' class='websy-dropdown-search' placeholder='").concat(this.options.searchPlaceholder || 'Search', "'>\n ");
|
|
1070
1166
|
}
|
|
@@ -1098,6 +1194,12 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1098
1194
|
var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
|
|
1099
1195
|
var contentEl = document.getElementById("".concat(this.elementId, "_content"));
|
|
1100
1196
|
var scrollEl = document.getElementById("".concat(this.elementId, "_itemsContainer"));
|
|
1197
|
+
var actionEl = document.getElementById("".concat(this.elementId, "_actionContainer"));
|
|
1198
|
+
|
|
1199
|
+
if (actionEl) {
|
|
1200
|
+
actionEl.classList.remove('active');
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1101
1203
|
var el = document.getElementById(this.elementId);
|
|
1102
1204
|
|
|
1103
1205
|
if (el) {
|
|
@@ -1140,6 +1242,18 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1140
1242
|
} else if (event.target.classList.contains('search')) {
|
|
1141
1243
|
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
1142
1244
|
el.classList.toggle('search-open');
|
|
1245
|
+
} else if (event.target.classList.contains('websy-dropdown-custom-action')) {
|
|
1246
|
+
var actionIndex = +event.target.getAttribute('data-index');
|
|
1247
|
+
|
|
1248
|
+
if (this.options.customActions[actionIndex] && this.options.customActions[actionIndex].fn) {
|
|
1249
|
+
this.options.customActions[actionIndex].fn();
|
|
1250
|
+
}
|
|
1251
|
+
} else if (event.target.classList.contains('websy-dropdown-action-button')) {
|
|
1252
|
+
var _el = document.getElementById("".concat(this.elementId, "_actionContainer"));
|
|
1253
|
+
|
|
1254
|
+
if (_el) {
|
|
1255
|
+
_el.classList.toggle('active');
|
|
1256
|
+
}
|
|
1143
1257
|
}
|
|
1144
1258
|
}
|
|
1145
1259
|
}, {
|
|
@@ -1752,6 +1866,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1752
1866
|
|
|
1753
1867
|
return WebsyForm;
|
|
1754
1868
|
}();
|
|
1869
|
+
/* global include */
|
|
1870
|
+
|
|
1871
|
+
|
|
1872
|
+
var WebsyIcons = {
|
|
1873
|
+
'search-icon': "\n <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 500 500\" xml:space=\"preserve\">\n<path d=\"M481.4,468.6c-17.2-17.2-34.4-34.4-51.6-51.6c-27.4-27.4-54.8-54.8-82.2-82.2c-4.8-4.8-9.5-9.5-14.3-14.3\n\tc29.4-32.5,47.4-75.5,47.4-122.7C380.7,97,298.7,15,197.9,15S15,97,15,197.9s82,182.9,182.9,182.9c47.2,0,90.3-18,122.7-47.4\n\tc15.7,15.7,31.4,31.4,47.1,47.1c27.4,27.4,54.8,54.8,82.2,82.2c6.3,6.3,12.5,12.5,18.8,18.8C476.8,489.6,489.6,476.8,481.4,468.6z\n\t M35,197.9C35,108.1,108.1,35,197.9,35s162.9,73.1,162.9,162.9s-73.1,162.9-162.9,162.9S35,287.7,35,197.9z\"/>\n</svg>\n\n ",
|
|
1874
|
+
'bag-icon': "\n <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 500 500\" style=\"enable-background:new 0 0 500 500;\" xml:space=\"preserve\">\n<path d=\"M456.6,472.3H43.4c-5.3,0-10.2-2.1-13.7-6c-3.6-3.9-5.2-9.2-4.5-14.4l37-285.4c1.2-9,9-15.9,18.2-15.9h339.2\n\tc9.2,0,17,6.8,18.2,15.8l37,285.4c0.7,5.2-1,10.5-4.5,14.4l0,0C466.8,470.1,461.9,472.3,456.6,472.3z M46.5,451.2h407l-36.3-279.6\n\tH82.8L46.5,451.2z\"/>\n<g>\n\t<path d=\"M361.3,157.1C357.3,94.8,308.4,46,249.9,46c-28,0-54.8,11.1-75.4,31.4c-20.7,20.3-33.5,47.9-35.9,77.8l-21.5-1.6\n\t\tc2.8-34.8,17.7-67.1,42.1-91C183.9,38.3,216.1,25,249.9,25c34.2,0,66.6,13.6,91.5,38.3c24.5,24.3,39.2,57.2,41.5,92.5L361.3,157.1z\n\t\t\"/>\n</g>\n</svg>\n\n ",
|
|
1875
|
+
'user-icon': "\n <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 500 500\" style=\"enable-background:new 0 0 500 500;\" xml:space=\"preserve\">\n<g>\n\t<path d=\"M248,260.5c-62,0-112.5-52.8-112.5-117.7S186,25,248,25s112.5,52.8,112.5,117.7S310,260.5,248,260.5z M248,45.9\n\t\tc-51,0-92.5,43.4-92.5,96.8s41.5,96.8,92.5,96.8c51,0,92.5-43.4,92.5-96.8S299,45.9,248,45.9z\"/>\n</g>\n<path d=\"M45,475C45,475,45,475,45,475c0-118.3,92-214.5,205-214.5c113,0,205,96.2,205,214.5c0,0,0,0,0,0h20c0,0,0,0,0,0\n\tc0-62.9-23.4-122-65.9-166.5c-42.5-44.5-99-69-159.1-69s-116.6,24.5-159.1,69C48.4,353,25,412.1,25,475c0,0,0,0,0,0H45z\"/>\n</svg>\n\n "
|
|
1876
|
+
};
|
|
1755
1877
|
|
|
1756
1878
|
var WebsyLoadingDialog = /*#__PURE__*/function () {
|
|
1757
1879
|
function WebsyLoadingDialog(elementId, options) {
|
|
@@ -2458,12 +2580,242 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
2458
2580
|
|
|
2459
2581
|
return WebsyPubSub;
|
|
2460
2582
|
}();
|
|
2583
|
+
|
|
2584
|
+
var ResponsiveText = /*#__PURE__*/function () {
|
|
2585
|
+
function ResponsiveText(elementId, options) {
|
|
2586
|
+
var _this17 = this;
|
|
2587
|
+
|
|
2588
|
+
_classCallCheck(this, ResponsiveText);
|
|
2589
|
+
|
|
2590
|
+
var DEFAULTS = {
|
|
2591
|
+
textAlign: 'center',
|
|
2592
|
+
verticalAlign: 'flex-end',
|
|
2593
|
+
wrapText: false
|
|
2594
|
+
};
|
|
2595
|
+
this.options = _extends({}, DEFAULTS, options);
|
|
2596
|
+
this.elementId = elementId;
|
|
2597
|
+
this.canvas = document.createElement('canvas');
|
|
2598
|
+
window.addEventListener('resize', function () {
|
|
2599
|
+
return _this17.render();
|
|
2600
|
+
});
|
|
2601
|
+
var el = document.getElementById(this.elementId);
|
|
2602
|
+
|
|
2603
|
+
if (el) {
|
|
2604
|
+
this.render();
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
|
|
2608
|
+
_createClass(ResponsiveText, [{
|
|
2609
|
+
key: "css",
|
|
2610
|
+
value: function css(element, property) {
|
|
2611
|
+
return window.getComputedStyle(element, null).getPropertyValue(property);
|
|
2612
|
+
}
|
|
2613
|
+
}, {
|
|
2614
|
+
key: "render",
|
|
2615
|
+
value: function render(text) {
|
|
2616
|
+
if (typeof text !== 'undefined') {
|
|
2617
|
+
this.options.text = text;
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2620
|
+
if (this.options.text) {
|
|
2621
|
+
var wrappingRequired = false;
|
|
2622
|
+
var el = document.getElementById(this.elementId);
|
|
2623
|
+
var cx = this.canvas.getContext('2d');
|
|
2624
|
+
var f = 0;
|
|
2625
|
+
var fits = false; // let el = document.getElementById(`${layout.qInfo.qId}_responsiveInner`)
|
|
2626
|
+
|
|
2627
|
+
var height = el.clientHeight;
|
|
2628
|
+
|
|
2629
|
+
if (typeof this.options.maxHeight === 'string' && this.options.maxHeight.indexOf('%') !== -1) {
|
|
2630
|
+
var p = +this.options.maxHeight.replace('%', '');
|
|
2631
|
+
|
|
2632
|
+
if (!isNaN(p)) {
|
|
2633
|
+
this.options.maxHeight = Math.floor(height * (p / 100));
|
|
2634
|
+
}
|
|
2635
|
+
} else if (typeof this.options.maxHeight === 'string' && this.options.maxHeight.indexOf('px') !== -1) {
|
|
2636
|
+
this.options.maxHeight = +this.options.maxHeight.replace('px', '');
|
|
2637
|
+
}
|
|
2638
|
+
|
|
2639
|
+
if (typeof this.options.minHeight === 'string' && this.options.minHeight.indexOf('%') !== -1) {
|
|
2640
|
+
var _p = +this.options.minHeight.replace('%', '');
|
|
2641
|
+
|
|
2642
|
+
if (!isNaN(_p)) {
|
|
2643
|
+
this.options.minHeight = Math.floor(height * (_p / 100));
|
|
2644
|
+
}
|
|
2645
|
+
} else if (typeof this.options.minHeight === 'string' && this.options.minHeight.indexOf('px') !== -1) {
|
|
2646
|
+
this.options.minHeight = +this.options.minHeight.replace('px', '');
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
var fontFamily = this.css(el, 'font-family');
|
|
2650
|
+
var fontWeight = this.css(el, 'font-weight');
|
|
2651
|
+
var allowedWidth = el.clientWidth;
|
|
2652
|
+
|
|
2653
|
+
if (allowedWidth === 0) {
|
|
2654
|
+
// check for a max-width property
|
|
2655
|
+
if (el.style.maxWidth && el.style.maxWidth !== 'auto') {
|
|
2656
|
+
if (el.parentElement.clientWidth > 0) {
|
|
2657
|
+
var calc = el.style.maxWidth;
|
|
2658
|
+
|
|
2659
|
+
if (calc.indexOf('calc') !== -1) {
|
|
2660
|
+
// this logic currently only handles calc statements using % and px
|
|
2661
|
+
// and only + or - formulas
|
|
2662
|
+
calc = calc.replace('calc(', '').replace(')', '');
|
|
2663
|
+
calc = calc.split(' ');
|
|
2664
|
+
|
|
2665
|
+
if (calc[0].indexOf('px') !== -1) {
|
|
2666
|
+
allowedWidth = calc[0].replace('px', '');
|
|
2667
|
+
} else if (calc[0].indexOf('%') !== -1) {
|
|
2668
|
+
allowedWidth = el.parentElement.clientWidth * (+calc[0].replace('%', '') / 100);
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2671
|
+
if (calc[2] && calc[4]) {
|
|
2672
|
+
// this means we have an operator and a second value
|
|
2673
|
+
// handle -
|
|
2674
|
+
if (calc[2] === '-') {
|
|
2675
|
+
if (calc[4].indexOf('px') !== -1) {
|
|
2676
|
+
allowedWidth -= +calc[4].replace('px', '');
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
if (calc[2] === '+') {
|
|
2681
|
+
if (calc[4].indexOf('px') !== -1) {
|
|
2682
|
+
allowedWidth += +calc[4].replace('px', '');
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
} else if (calc.indexOf('px') !== -1) {
|
|
2687
|
+
allowedWidth = +calc.replace('px', '');
|
|
2688
|
+
} else if (calc.indexOf('%') !== -1) {
|
|
2689
|
+
allowedWidth = el.parentElement.clientWidth * (+calc.replace('%', '') / 100);
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
} // console.log('max height', this.options.maxHeight);
|
|
2694
|
+
|
|
2695
|
+
|
|
2696
|
+
var innerElHeight = el.clientHeight;
|
|
2697
|
+
|
|
2698
|
+
while (fits === false) {
|
|
2699
|
+
f++;
|
|
2700
|
+
cx.font = "".concat(fontWeight, " ").concat(f, "px ").concat(fontFamily);
|
|
2701
|
+
var measurements = cx.measureText(this.options.text); // add support for safari where some elements end up with zero height
|
|
2702
|
+
|
|
2703
|
+
if (navigator.userAgent.indexOf('Safari') !== -1) {
|
|
2704
|
+
// get the closest parent that has a height
|
|
2705
|
+
var heightFound = false;
|
|
2706
|
+
var currEl = el;
|
|
2707
|
+
|
|
2708
|
+
while (heightFound === false) {
|
|
2709
|
+
if (currEl.clientHeight > 0) {
|
|
2710
|
+
innerElHeight = currEl.clientHeight;
|
|
2711
|
+
heightFound = true;
|
|
2712
|
+
} else if (currEl.parentNode) {
|
|
2713
|
+
currEl = currEl.parentNode;
|
|
2714
|
+
} else {
|
|
2715
|
+
// prevent the loop from running indefinitely
|
|
2716
|
+
heightFound = true;
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2721
|
+
if (typeof this.options.maxHeight !== 'undefined' && f === this.options.maxHeight) {
|
|
2722
|
+
f = this.options.maxHeight;
|
|
2723
|
+
height = measurements.actualBoundingBoxAscent;
|
|
2724
|
+
fits = true;
|
|
2725
|
+
} else if (measurements.width > allowedWidth || measurements.actualBoundingBoxAscent >= innerElHeight) {
|
|
2726
|
+
f--;
|
|
2727
|
+
height = measurements.actualBoundingBoxAscent;
|
|
2728
|
+
fits = true;
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2731
|
+
|
|
2732
|
+
if (this.options.minHeight === '') {
|
|
2733
|
+
this.options.minHeight = undefined;
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
if (typeof this.options.minHeight !== 'undefined') {
|
|
2737
|
+
if (this.options.minHeight > f && this.options.wrapText === true) {
|
|
2738
|
+
// we run the process again but this time separating the words onto separate lines
|
|
2739
|
+
// this currently only supports wrapping onto 2 lines
|
|
2740
|
+
wrappingRequired = true;
|
|
2741
|
+
fits = false;
|
|
2742
|
+
f = this.options.minHeight;
|
|
2743
|
+
var spaceCount = this.options.text.match(/ /g);
|
|
2744
|
+
|
|
2745
|
+
if (spaceCount && spaceCount.length > 0) {
|
|
2746
|
+
spaceCount = spaceCount.length;
|
|
2747
|
+
var words = this.options.text.split(' ');
|
|
2748
|
+
|
|
2749
|
+
while (fits === false) {
|
|
2750
|
+
f++;
|
|
2751
|
+
cx.font = "".concat(fontWeight, " ").concat(f, "px ").concat(fontFamily);
|
|
2752
|
+
|
|
2753
|
+
for (var i = spaceCount; i > 0; i--) {
|
|
2754
|
+
var fitsCount = 0;
|
|
2755
|
+
var lines = [words.slice(0, i).join(' '), words.slice(i, words.length).join(' ')];
|
|
2756
|
+
var longestLine = lines.reduce(function (a, b) {
|
|
2757
|
+
return a.length > b.length ? a : b;
|
|
2758
|
+
}, ''); // lines.forEach(l => {
|
|
2759
|
+
|
|
2760
|
+
var _measurements = cx.measureText(longestLine); // add support for safari where some elements end up with zero height
|
|
2761
|
+
|
|
2762
|
+
|
|
2763
|
+
if (navigator.userAgent.indexOf('Safari') !== -1) {
|
|
2764
|
+
// get the closest parent that has a height
|
|
2765
|
+
var _heightFound = false;
|
|
2766
|
+
var _currEl = el;
|
|
2767
|
+
|
|
2768
|
+
while (_heightFound === false) {
|
|
2769
|
+
if (_currEl.clientHeight > 0) {
|
|
2770
|
+
innerElHeight = _currEl.clientHeight;
|
|
2771
|
+
_heightFound = true;
|
|
2772
|
+
} else if (_currEl.parentNode) {
|
|
2773
|
+
_currEl = _currEl.parentNode;
|
|
2774
|
+
} else {
|
|
2775
|
+
// prevent the loop from running indefinitely
|
|
2776
|
+
_heightFound = true;
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2781
|
+
if (typeof this.options.maxHeight !== 'undefined' && f === this.options.maxHeight) {
|
|
2782
|
+
f = this.options.maxHeight;
|
|
2783
|
+
height = _measurements.actualBoundingBoxAscent;
|
|
2784
|
+
fits = true;
|
|
2785
|
+
break;
|
|
2786
|
+
} else if (_measurements.width > allowedWidth || _measurements.actualBoundingBoxAscent >= innerElHeight / 2 * 0.75) {
|
|
2787
|
+
f--;
|
|
2788
|
+
height = _measurements.actualBoundingBoxAscent;
|
|
2789
|
+
fits = true;
|
|
2790
|
+
break;
|
|
2791
|
+
} // })
|
|
2792
|
+
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
}
|
|
2796
|
+
|
|
2797
|
+
if (typeof this.options.minHeight !== 'undefined' && this.options.minHeight > f) {
|
|
2798
|
+
f = this.options.minHeight;
|
|
2799
|
+
}
|
|
2800
|
+
} else if (this.options.minHeight > f) {
|
|
2801
|
+
f = this.options.minHeight;
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
|
|
2805
|
+
var spanHeight = Math.min(innerElHeight, height);
|
|
2806
|
+
el.innerHTML = "\n <div \n class='websy-responsive-text' \n style='\n justify-content: ".concat(this.options.verticalAlign, ";\n font-size: ").concat(f, "px;\n font-weight: ").concat(fontWeight || 'normal', ";\n '\n > \n <span\n style='\n white-space: ").concat(this.options.wrapText === true ? 'normal' : 'nowrap', ";\n height: ").concat(Math.floor(wrappingRequired === true ? spanHeight * (1 * 1 / 3) * 2 : spanHeight), "px;\n line-height: ").concat(Math.ceil(wrappingRequired === true ? f * 1.2 : spanHeight), "px;\n justify-content: ").concat(this.options.textAlign, ";\n text-align: ").concat(this.options.textAlign, ";\n '\n >").concat(this.options.text, "</span>\n </div>\n ");
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
}]);
|
|
2810
|
+
|
|
2811
|
+
return ResponsiveText;
|
|
2812
|
+
}();
|
|
2461
2813
|
/* global WebsyDesigns */
|
|
2462
2814
|
|
|
2463
2815
|
|
|
2464
2816
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
2465
2817
|
function WebsyResultList(elementId, options) {
|
|
2466
|
-
var
|
|
2818
|
+
var _this18 = this;
|
|
2467
2819
|
|
|
2468
2820
|
_classCallCheck(this, WebsyResultList);
|
|
2469
2821
|
|
|
@@ -2491,9 +2843,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2491
2843
|
|
|
2492
2844
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
2493
2845
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
2494
|
-
|
|
2846
|
+
_this18.options.template = templateString;
|
|
2495
2847
|
|
|
2496
|
-
|
|
2848
|
+
_this18.render();
|
|
2497
2849
|
});
|
|
2498
2850
|
} else {
|
|
2499
2851
|
this.render();
|
|
@@ -2512,7 +2864,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2512
2864
|
}, {
|
|
2513
2865
|
key: "buildHTML",
|
|
2514
2866
|
value: function buildHTML(d) {
|
|
2515
|
-
var
|
|
2867
|
+
var _this19 = this;
|
|
2516
2868
|
|
|
2517
2869
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
2518
2870
|
var html = "";
|
|
@@ -2520,7 +2872,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2520
2872
|
if (this.options.template) {
|
|
2521
2873
|
if (d.length > 0) {
|
|
2522
2874
|
d.forEach(function (row, ix) {
|
|
2523
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(
|
|
2875
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(_this19.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
2524
2876
|
|
|
2525
2877
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
2526
2878
|
|
|
@@ -2640,7 +2992,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2640
2992
|
}, {
|
|
2641
2993
|
key: "handleClick",
|
|
2642
2994
|
value: function handleClick(event) {
|
|
2643
|
-
var
|
|
2995
|
+
var _this20 = this;
|
|
2644
2996
|
|
|
2645
2997
|
if (event.target.classList.contains('clickable')) {
|
|
2646
2998
|
var l = event.target.getAttribute('data-event');
|
|
@@ -2658,8 +3010,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2658
3010
|
l = l[0];
|
|
2659
3011
|
params = params.map(function (p) {
|
|
2660
3012
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
2661
|
-
if (
|
|
2662
|
-
p =
|
|
3013
|
+
if (_this20.rows[+id]) {
|
|
3014
|
+
p = _this20.rows[+id][p];
|
|
2663
3015
|
}
|
|
2664
3016
|
} else if (typeof p === 'string') {
|
|
2665
3017
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -2681,13 +3033,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2681
3033
|
}, {
|
|
2682
3034
|
key: "render",
|
|
2683
3035
|
value: function render() {
|
|
2684
|
-
var
|
|
3036
|
+
var _this21 = this;
|
|
2685
3037
|
|
|
2686
3038
|
if (this.options.entity) {
|
|
2687
3039
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
2688
|
-
|
|
3040
|
+
_this21.rows = results.rows;
|
|
2689
3041
|
|
|
2690
|
-
|
|
3042
|
+
_this21.resize();
|
|
2691
3043
|
});
|
|
2692
3044
|
} else {
|
|
2693
3045
|
this.resize();
|
|
@@ -2766,14 +3118,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
2766
3118
|
_createClass(WebsyRouter, [{
|
|
2767
3119
|
key: "addGroup",
|
|
2768
3120
|
value: function addGroup(group) {
|
|
2769
|
-
var
|
|
3121
|
+
var _this22 = this;
|
|
2770
3122
|
|
|
2771
3123
|
if (!this.groups[group]) {
|
|
2772
3124
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
2773
3125
|
|
|
2774
3126
|
if (els) {
|
|
2775
3127
|
this.getClosestParent(els[0], function (parent) {
|
|
2776
|
-
|
|
3128
|
+
_this22.groups[group] = {
|
|
2777
3129
|
activeView: '',
|
|
2778
3130
|
views: [],
|
|
2779
3131
|
parent: parent.getAttribute('data-view')
|
|
@@ -3098,12 +3450,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3098
3450
|
}, {
|
|
3099
3451
|
key: "showComponents",
|
|
3100
3452
|
value: function showComponents(view) {
|
|
3101
|
-
var
|
|
3453
|
+
var _this23 = this;
|
|
3102
3454
|
|
|
3103
3455
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
3104
3456
|
this.options.views[view].components.forEach(function (c) {
|
|
3105
3457
|
if (typeof c.instance === 'undefined') {
|
|
3106
|
-
|
|
3458
|
+
_this23.prepComponent(c.elementId, c.options);
|
|
3107
3459
|
|
|
3108
3460
|
c.instance = new c.Component(c.elementId, c.options);
|
|
3109
3461
|
} else if (c.instance.render) {
|
|
@@ -3472,7 +3824,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
3472
3824
|
|
|
3473
3825
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
3474
3826
|
function WebsyTemplate(elementId, options) {
|
|
3475
|
-
var
|
|
3827
|
+
var _this24 = this;
|
|
3476
3828
|
|
|
3477
3829
|
_classCallCheck(this, WebsyTemplate);
|
|
3478
3830
|
|
|
@@ -3498,9 +3850,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3498
3850
|
|
|
3499
3851
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3500
3852
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3501
|
-
|
|
3853
|
+
_this24.options.template = templateString;
|
|
3502
3854
|
|
|
3503
|
-
|
|
3855
|
+
_this24.render();
|
|
3504
3856
|
});
|
|
3505
3857
|
} else {
|
|
3506
3858
|
this.render();
|
|
@@ -3510,7 +3862,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3510
3862
|
_createClass(WebsyTemplate, [{
|
|
3511
3863
|
key: "buildHTML",
|
|
3512
3864
|
value: function buildHTML() {
|
|
3513
|
-
var
|
|
3865
|
+
var _this25 = this;
|
|
3514
3866
|
|
|
3515
3867
|
var html = "";
|
|
3516
3868
|
|
|
@@ -3572,14 +3924,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3572
3924
|
}
|
|
3573
3925
|
|
|
3574
3926
|
if (polarity === true) {
|
|
3575
|
-
if (typeof
|
|
3927
|
+
if (typeof _this25.options.data[parts[0]] !== 'undefined' && _this25.options.data[parts[0]] === parts[1]) {
|
|
3576
3928
|
// remove the <if> tags
|
|
3577
3929
|
removeAll = false;
|
|
3578
3930
|
} else if (parts[0] === parts[1]) {
|
|
3579
3931
|
removeAll = false;
|
|
3580
3932
|
}
|
|
3581
3933
|
} else if (polarity === false) {
|
|
3582
|
-
if (typeof
|
|
3934
|
+
if (typeof _this25.options.data[parts[0]] !== 'undefined' && _this25.options.data[parts[0]] !== parts[1]) {
|
|
3583
3935
|
// remove the <if> tags
|
|
3584
3936
|
removeAll = false;
|
|
3585
3937
|
}
|
|
@@ -3825,10 +4177,10 @@ var WebsyUtils = {
|
|
|
3825
4177
|
var s = '';
|
|
3826
4178
|
var d = 1; // let out
|
|
3827
4179
|
|
|
3828
|
-
for (var
|
|
3829
|
-
if (n >= ranges[
|
|
3830
|
-
d = ranges[
|
|
3831
|
-
s = ranges[
|
|
4180
|
+
for (var _i7 = 0; _i7 < ranges.length; _i7++) {
|
|
4181
|
+
if (n >= ranges[_i7].divider) {
|
|
4182
|
+
d = ranges[_i7].divider;
|
|
4183
|
+
s = ranges[_i7].suffix; // out = (n / ranges[i].divider).toFixed(decimals).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$100,')
|
|
3832
4184
|
|
|
3833
4185
|
break;
|
|
3834
4186
|
}
|
|
@@ -3866,7 +4218,7 @@ var WebsyUtils = {
|
|
|
3866
4218
|
|
|
3867
4219
|
var WebsyTable = /*#__PURE__*/function () {
|
|
3868
4220
|
function WebsyTable(elementId, options) {
|
|
3869
|
-
var
|
|
4221
|
+
var _this26 = this;
|
|
3870
4222
|
|
|
3871
4223
|
_classCallCheck(this, WebsyTable);
|
|
3872
4224
|
|
|
@@ -3904,8 +4256,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3904
4256
|
allowClear: false,
|
|
3905
4257
|
disableSearch: true,
|
|
3906
4258
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
3907
|
-
if (
|
|
3908
|
-
|
|
4259
|
+
if (_this26.options.onChangePageSize) {
|
|
4260
|
+
_this26.options.onChangePageSize(selectedItem.value);
|
|
3909
4261
|
}
|
|
3910
4262
|
}
|
|
3911
4263
|
});
|
|
@@ -3926,7 +4278,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3926
4278
|
_createClass(WebsyTable, [{
|
|
3927
4279
|
key: "appendRows",
|
|
3928
4280
|
value: function appendRows(data) {
|
|
3929
|
-
var
|
|
4281
|
+
var _this27 = this;
|
|
3930
4282
|
|
|
3931
4283
|
this.hideError();
|
|
3932
4284
|
var bodyHTML = '';
|
|
@@ -3934,15 +4286,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3934
4286
|
if (data) {
|
|
3935
4287
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
3936
4288
|
return '<tr>' + r.map(function (c, i) {
|
|
3937
|
-
if (
|
|
4289
|
+
if (_this27.options.columns[i].show !== false) {
|
|
3938
4290
|
var style = '';
|
|
3939
4291
|
|
|
3940
4292
|
if (c.style) {
|
|
3941
4293
|
style += c.style;
|
|
3942
4294
|
}
|
|
3943
4295
|
|
|
3944
|
-
if (
|
|
3945
|
-
style += "width: ".concat(
|
|
4296
|
+
if (_this27.options.columns[i].width) {
|
|
4297
|
+
style += "width: ".concat(_this27.options.columns[i].width, "; ");
|
|
3946
4298
|
}
|
|
3947
4299
|
|
|
3948
4300
|
if (c.backgroundColor) {
|
|
@@ -3957,18 +4309,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3957
4309
|
style += "color: ".concat(c.color, "; ");
|
|
3958
4310
|
}
|
|
3959
4311
|
|
|
3960
|
-
if (
|
|
3961
|
-
return "\n <td \n data-row-index='".concat(
|
|
3962
|
-
} else if ((
|
|
3963
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
4312
|
+
if (_this27.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
4313
|
+
return "\n <td \n data-row-index='".concat(_this27.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this27.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(_this27.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this27.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
4314
|
+
} else if ((_this27.options.columns[i].showAsNavigatorLink === true || _this27.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
4315
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this27.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this27.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this27.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this27.options.columns[i].linkText || c.value, "</td>\n ");
|
|
3964
4316
|
} else {
|
|
3965
4317
|
var info = c.value;
|
|
3966
4318
|
|
|
3967
|
-
if (
|
|
4319
|
+
if (_this27.options.columns[i].showAsImage === true) {
|
|
3968
4320
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
3969
4321
|
}
|
|
3970
4322
|
|
|
3971
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
4323
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this27.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this27.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 ");
|
|
3972
4324
|
}
|
|
3973
4325
|
}
|
|
3974
4326
|
}).join('') + '</tr>';
|
|
@@ -4140,7 +4492,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4140
4492
|
}, {
|
|
4141
4493
|
key: "render",
|
|
4142
4494
|
value: function render(data) {
|
|
4143
|
-
var
|
|
4495
|
+
var _this28 = this;
|
|
4144
4496
|
|
|
4145
4497
|
if (!this.options.columns) {
|
|
4146
4498
|
return;
|
|
@@ -4165,7 +4517,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4165
4517
|
|
|
4166
4518
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
4167
4519
|
if (c.show !== false) {
|
|
4168
|
-
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 ?
|
|
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 ? _this28.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
4169
4521
|
}
|
|
4170
4522
|
}).join('') + '</tr>';
|
|
4171
4523
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -4184,7 +4536,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4184
4536
|
|
|
4185
4537
|
if (pagingEl) {
|
|
4186
4538
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
4187
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
4539
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this28.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
4188
4540
|
});
|
|
4189
4541
|
var startIndex = 0;
|
|
4190
4542
|
|
|
@@ -4252,7 +4604,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4252
4604
|
|
|
4253
4605
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
4254
4606
|
function WebsyTable2(elementId, options) {
|
|
4255
|
-
var
|
|
4607
|
+
var _this29 = this;
|
|
4256
4608
|
|
|
4257
4609
|
_classCallCheck(this, WebsyTable2);
|
|
4258
4610
|
|
|
@@ -4293,8 +4645,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4293
4645
|
allowClear: false,
|
|
4294
4646
|
disableSearch: true,
|
|
4295
4647
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4296
|
-
if (
|
|
4297
|
-
|
|
4648
|
+
if (_this29.options.onChangePageSize) {
|
|
4649
|
+
_this29.options.onChangePageSize(selectedItem.value);
|
|
4298
4650
|
}
|
|
4299
4651
|
}
|
|
4300
4652
|
});
|
|
@@ -4318,7 +4670,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4318
4670
|
_createClass(WebsyTable2, [{
|
|
4319
4671
|
key: "appendRows",
|
|
4320
4672
|
value: function appendRows(data) {
|
|
4321
|
-
var
|
|
4673
|
+
var _this30 = this;
|
|
4322
4674
|
|
|
4323
4675
|
this.hideError();
|
|
4324
4676
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -4327,15 +4679,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4327
4679
|
if (data) {
|
|
4328
4680
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4329
4681
|
return '<tr>' + r.map(function (c, i) {
|
|
4330
|
-
if (
|
|
4331
|
-
var style = "height: ".concat(
|
|
4682
|
+
if (_this30.options.columns[i].show !== false) {
|
|
4683
|
+
var style = "height: ".concat(_this30.options.cellSize, "px; line-height: ").concat(_this30.options.cellSize, "px;");
|
|
4332
4684
|
|
|
4333
4685
|
if (c.style) {
|
|
4334
4686
|
style += c.style;
|
|
4335
4687
|
}
|
|
4336
4688
|
|
|
4337
|
-
if (
|
|
4338
|
-
style += "width: ".concat(
|
|
4689
|
+
if (_this30.options.columns[i].width) {
|
|
4690
|
+
style += "width: ".concat(_this30.options.columns[i].width, "; ");
|
|
4339
4691
|
}
|
|
4340
4692
|
|
|
4341
4693
|
if (c.backgroundColor) {
|
|
@@ -4350,18 +4702,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4350
4702
|
style += "color: ".concat(c.color, "; ");
|
|
4351
4703
|
}
|
|
4352
4704
|
|
|
4353
|
-
if (
|
|
4354
|
-
return "\n <td \n data-row-index='".concat(
|
|
4355
|
-
} else if ((
|
|
4356
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
4705
|
+
if (_this30.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
4706
|
+
return "\n <td \n data-row-index='".concat(_this30.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this30.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this30.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this30.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
4707
|
+
} else if ((_this30.options.columns[i].showAsNavigatorLink === true || _this30.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
4708
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this30.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this30.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this30.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this30.options.columns[i].linkText || c.value, "</td>\n ");
|
|
4357
4709
|
} else {
|
|
4358
4710
|
var info = c.value;
|
|
4359
4711
|
|
|
4360
|
-
if (
|
|
4712
|
+
if (_this30.options.columns[i].showAsImage === true) {
|
|
4361
4713
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4362
4714
|
}
|
|
4363
4715
|
|
|
4364
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
4716
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this30.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this30.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
|
|
4365
4717
|
}
|
|
4366
4718
|
}
|
|
4367
4719
|
}).join('') + '</tr>';
|
|
@@ -4486,7 +4838,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4486
4838
|
value: function handleGlobalMouseUp(event) {
|
|
4487
4839
|
this.scrolling = false;
|
|
4488
4840
|
var el = document.getElementById(this.elementId);
|
|
4489
|
-
|
|
4841
|
+
|
|
4842
|
+
if (el) {
|
|
4843
|
+
el.classList.remove('scrolling');
|
|
4844
|
+
}
|
|
4490
4845
|
}
|
|
4491
4846
|
}, {
|
|
4492
4847
|
key: "handleMouseUp",
|
|
@@ -4616,7 +4971,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4616
4971
|
}, {
|
|
4617
4972
|
key: "render",
|
|
4618
4973
|
value: function render(data) {
|
|
4619
|
-
var
|
|
4974
|
+
var _this31 = this;
|
|
4620
4975
|
|
|
4621
4976
|
if (!this.options.columns) {
|
|
4622
4977
|
return;
|
|
@@ -4652,7 +5007,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4652
5007
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
4653
5008
|
}
|
|
4654
5009
|
|
|
4655
|
-
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 ?
|
|
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 ? _this31.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
4656
5011
|
}
|
|
4657
5012
|
}).join('') + '</tr>';
|
|
4658
5013
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -4663,7 +5018,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4663
5018
|
var dropdownHTML = "";
|
|
4664
5019
|
this.options.columns.forEach(function (c, i) {
|
|
4665
5020
|
if (c.searchable && c.searchField) {
|
|
4666
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5021
|
+
dropdownHTML += "\n <div id=\"".concat(_this31.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
4667
5022
|
}
|
|
4668
5023
|
});
|
|
4669
5024
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -4685,7 +5040,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4685
5040
|
|
|
4686
5041
|
if (pagingEl) {
|
|
4687
5042
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
4688
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5043
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this31.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
4689
5044
|
});
|
|
4690
5045
|
var startIndex = 0;
|
|
4691
5046
|
|
|
@@ -4772,7 +5127,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4772
5127
|
}, {
|
|
4773
5128
|
key: "getColumnParameters",
|
|
4774
5129
|
value: function getColumnParameters(values) {
|
|
4775
|
-
var
|
|
5130
|
+
var _this32 = this;
|
|
4776
5131
|
|
|
4777
5132
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
4778
5133
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -4780,10 +5135,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4780
5135
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
4781
5136
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
4782
5137
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
4783
|
-
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 ?
|
|
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 ? _this32.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
4784
5139
|
}).join('') + '</tr>';
|
|
4785
5140
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
4786
|
-
return "\n <td \n style='height: ".concat(
|
|
5141
|
+
return "\n <td \n style='height: ".concat(_this32.options.cellSize, "px; line-height: ").concat(_this32.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
4787
5142
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
4788
5143
|
|
|
4789
5144
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -4804,8 +5159,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4804
5159
|
|
|
4805
5160
|
|
|
4806
5161
|
if (accWidth < (tableContainerEl.offsetWidth || tableContainerEl.clientWidth) - nonScrollableWidth) {
|
|
4807
|
-
for (var
|
|
4808
|
-
cellWidths[
|
|
5162
|
+
for (var _i8 = this.options.leftColumns; _i8 < cellWidths.length; _i8++) {
|
|
5163
|
+
cellWidths[_i8] = ((tableContainerEl.offsetWidth || tableContainerEl.clientWidth) - nonScrollableWidth) / (cellWidths.length - this.options.leftColumns);
|
|
4809
5164
|
}
|
|
4810
5165
|
} // const cellWidth = firstDataCell.offsetWidth || firstDataCell.clientWidth
|
|
4811
5166
|
// tableEl.style.width = ''
|
|
@@ -4833,7 +5188,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4833
5188
|
|
|
4834
5189
|
var WebsyChart = /*#__PURE__*/function () {
|
|
4835
5190
|
function WebsyChart(elementId, options) {
|
|
4836
|
-
var
|
|
5191
|
+
var _this33 = this;
|
|
4837
5192
|
|
|
4838
5193
|
_classCallCheck(this, WebsyChart);
|
|
4839
5194
|
|
|
@@ -4882,22 +5237,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4882
5237
|
this.invertOverride = function (input, input2) {
|
|
4883
5238
|
var xAxis = 'bottomAxis';
|
|
4884
5239
|
|
|
4885
|
-
if (
|
|
5240
|
+
if (_this33.options.orientation === 'horizontal') {
|
|
4886
5241
|
xAxis = 'leftAxis';
|
|
4887
5242
|
}
|
|
4888
5243
|
|
|
4889
|
-
var width =
|
|
5244
|
+
var width = _this33[xAxis].step();
|
|
4890
5245
|
|
|
4891
5246
|
var output;
|
|
4892
5247
|
|
|
4893
|
-
var domain = _toConsumableArray(
|
|
5248
|
+
var domain = _toConsumableArray(_this33[xAxis].domain());
|
|
4894
5249
|
|
|
4895
|
-
if (
|
|
5250
|
+
if (_this33.options.orientation === 'horizontal') {
|
|
4896
5251
|
domain = domain.reverse();
|
|
4897
5252
|
}
|
|
4898
5253
|
|
|
4899
5254
|
for (var j = 0; j < domain.length; j++) {
|
|
4900
|
-
var breakA =
|
|
5255
|
+
var breakA = _this33[xAxis](domain[j]) - width / 2;
|
|
4901
5256
|
var breakB = breakA + width;
|
|
4902
5257
|
|
|
4903
5258
|
if (input > breakA && input <= breakB) {
|
|
@@ -4997,10 +5352,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4997
5352
|
}, {
|
|
4998
5353
|
key: "handleEventMouseMove",
|
|
4999
5354
|
value: function handleEventMouseMove(event, d) {
|
|
5000
|
-
var
|
|
5355
|
+
var _this34 = this;
|
|
5001
5356
|
|
|
5002
5357
|
var bisectDate = d3.bisector(function (d) {
|
|
5003
|
-
return
|
|
5358
|
+
return _this34.parseX(d.x.value);
|
|
5004
5359
|
}).left;
|
|
5005
5360
|
|
|
5006
5361
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -5039,8 +5394,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5039
5394
|
}
|
|
5040
5395
|
|
|
5041
5396
|
this.options.data.series.forEach(function (s) {
|
|
5042
|
-
if (
|
|
5043
|
-
xPoint =
|
|
5397
|
+
if (_this34.options.data[xData].scale !== 'Time') {
|
|
5398
|
+
xPoint = _this34[xAxis](_this34.parseX(xLabel));
|
|
5044
5399
|
s.data.forEach(function (d) {
|
|
5045
5400
|
if (d.x.value === xLabel) {
|
|
5046
5401
|
if (!tooltipTitle) {
|
|
@@ -5059,13 +5414,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5059
5414
|
var pointA = s.data[index - 1];
|
|
5060
5415
|
var pointB = s.data[index];
|
|
5061
5416
|
|
|
5062
|
-
if (
|
|
5417
|
+
if (_this34.options.orientation === 'horizontal') {
|
|
5063
5418
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
5064
5419
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
5065
5420
|
}
|
|
5066
5421
|
|
|
5067
5422
|
if (pointA && !pointB) {
|
|
5068
|
-
xPoint =
|
|
5423
|
+
xPoint = _this34[xAxis](_this34.parseX(pointA.x.value));
|
|
5069
5424
|
tooltipTitle = pointA.x.value;
|
|
5070
5425
|
|
|
5071
5426
|
if (!pointA.y.color) {
|
|
@@ -5075,12 +5430,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5075
5430
|
tooltipData.push(pointA.y);
|
|
5076
5431
|
|
|
5077
5432
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
5078
|
-
tooltipTitle = d3.timeFormat(
|
|
5433
|
+
tooltipTitle = d3.timeFormat(_this34.options.dateFormat || _this34.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
5079
5434
|
}
|
|
5080
5435
|
}
|
|
5081
5436
|
|
|
5082
5437
|
if (pointB && !pointA) {
|
|
5083
|
-
xPoint =
|
|
5438
|
+
xPoint = _this34[xAxis](_this34.parseX(pointB.x.value));
|
|
5084
5439
|
tooltipTitle = pointB.x.value;
|
|
5085
5440
|
|
|
5086
5441
|
if (!pointB.y.color) {
|
|
@@ -5090,14 +5445,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5090
5445
|
tooltipData.push(pointB.y);
|
|
5091
5446
|
|
|
5092
5447
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5093
|
-
tooltipTitle = d3.timeFormat(
|
|
5448
|
+
tooltipTitle = d3.timeFormat(_this34.options.dateFormat || _this34.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5094
5449
|
}
|
|
5095
5450
|
}
|
|
5096
5451
|
|
|
5097
5452
|
if (pointA && pointB) {
|
|
5098
|
-
var d0 =
|
|
5453
|
+
var d0 = _this34[xAxis](_this34.parseX(pointA.x.value));
|
|
5099
5454
|
|
|
5100
|
-
var d1 =
|
|
5455
|
+
var d1 = _this34[xAxis](_this34.parseX(pointB.x.value));
|
|
5101
5456
|
|
|
5102
5457
|
var mid = Math.abs(d0 - d1) / 2;
|
|
5103
5458
|
|
|
@@ -5106,7 +5461,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5106
5461
|
tooltipTitle = pointB.x.value;
|
|
5107
5462
|
|
|
5108
5463
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5109
|
-
tooltipTitle = d3.timeFormat(
|
|
5464
|
+
tooltipTitle = d3.timeFormat(_this34.options.dateFormat || _this34.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5110
5465
|
}
|
|
5111
5466
|
|
|
5112
5467
|
if (!pointB.y.color) {
|
|
@@ -5119,7 +5474,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5119
5474
|
tooltipTitle = pointA.x.value;
|
|
5120
5475
|
|
|
5121
5476
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5122
|
-
tooltipTitle = d3.timeFormat(
|
|
5477
|
+
tooltipTitle = d3.timeFormat(_this34.options.dateFormat || _this34.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5123
5478
|
}
|
|
5124
5479
|
|
|
5125
5480
|
if (!pointA.y.color) {
|
|
@@ -5224,7 +5579,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5224
5579
|
}, {
|
|
5225
5580
|
key: "render",
|
|
5226
5581
|
value: function render(options) {
|
|
5227
|
-
var
|
|
5582
|
+
var _this35 = this;
|
|
5228
5583
|
|
|
5229
5584
|
/* global d3 options WebsyUtils */
|
|
5230
5585
|
if (typeof options !== 'undefined') {
|
|
@@ -5293,7 +5648,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5293
5648
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
5294
5649
|
return {
|
|
5295
5650
|
value: s.label || s.key,
|
|
5296
|
-
color: s.color ||
|
|
5651
|
+
color: s.color || _this35.options.colors[i % _this35.options.colors.length]
|
|
5297
5652
|
};
|
|
5298
5653
|
});
|
|
5299
5654
|
|
|
@@ -5545,7 +5900,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5545
5900
|
|
|
5546
5901
|
if (this.options.data.bottom.formatter) {
|
|
5547
5902
|
bAxisFunc.tickFormat(function (d) {
|
|
5548
|
-
return
|
|
5903
|
+
return _this35.options.data.bottom.formatter(d);
|
|
5549
5904
|
});
|
|
5550
5905
|
}
|
|
5551
5906
|
|
|
@@ -5571,8 +5926,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5571
5926
|
|
|
5572
5927
|
if (this.options.margin.axisLeft > 0) {
|
|
5573
5928
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
5574
|
-
if (
|
|
5575
|
-
d =
|
|
5929
|
+
if (_this35.options.data.left.formatter) {
|
|
5930
|
+
d = _this35.options.data.left.formatter(d);
|
|
5576
5931
|
}
|
|
5577
5932
|
|
|
5578
5933
|
return d;
|
|
@@ -5609,8 +5964,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5609
5964
|
|
|
5610
5965
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
5611
5966
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
5612
|
-
if (
|
|
5613
|
-
d =
|
|
5967
|
+
if (_this35.options.data.right.formatter) {
|
|
5968
|
+
d = _this35.options.data.right.formatter(d);
|
|
5614
5969
|
}
|
|
5615
5970
|
|
|
5616
5971
|
return d;
|
|
@@ -5636,16 +5991,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5636
5991
|
|
|
5637
5992
|
this.options.data.series.forEach(function (series, index) {
|
|
5638
5993
|
if (!series.key) {
|
|
5639
|
-
series.key =
|
|
5994
|
+
series.key = _this35.createIdentity();
|
|
5640
5995
|
}
|
|
5641
5996
|
|
|
5642
5997
|
if (!series.color) {
|
|
5643
|
-
series.color =
|
|
5998
|
+
series.color = _this35.options.colors[index % _this35.options.colors.length];
|
|
5644
5999
|
}
|
|
5645
6000
|
|
|
5646
|
-
|
|
6001
|
+
_this35["render".concat(series.type || 'bar')](series, index);
|
|
5647
6002
|
|
|
5648
|
-
|
|
6003
|
+
_this35.renderLabels(series, index);
|
|
5649
6004
|
});
|
|
5650
6005
|
}
|
|
5651
6006
|
}
|
|
@@ -5653,17 +6008,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5653
6008
|
}, {
|
|
5654
6009
|
key: "renderarea",
|
|
5655
6010
|
value: function renderarea(series, index) {
|
|
5656
|
-
var
|
|
6011
|
+
var _this36 = this;
|
|
5657
6012
|
|
|
5658
6013
|
/* global d3 series index */
|
|
5659
6014
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
5660
6015
|
return d3.area().x(function (d) {
|
|
5661
|
-
return
|
|
6016
|
+
return _this36[xAxis](_this36.parseX(d.x.value));
|
|
5662
6017
|
}).y0(function (d) {
|
|
5663
|
-
return
|
|
6018
|
+
return _this36[yAxis](0);
|
|
5664
6019
|
}).y1(function (d) {
|
|
5665
|
-
return
|
|
5666
|
-
}).curve(d3[curveStyle ||
|
|
6020
|
+
return _this36[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6021
|
+
}).curve(d3[curveStyle || _this36.options.curveStyle]);
|
|
5667
6022
|
};
|
|
5668
6023
|
|
|
5669
6024
|
var xAxis = 'bottomAxis';
|
|
@@ -5838,15 +6193,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5838
6193
|
}, {
|
|
5839
6194
|
key: "renderline",
|
|
5840
6195
|
value: function renderline(series, index) {
|
|
5841
|
-
var
|
|
6196
|
+
var _this37 = this;
|
|
5842
6197
|
|
|
5843
6198
|
/* global series index d3 */
|
|
5844
6199
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
5845
6200
|
return d3.line().x(function (d) {
|
|
5846
|
-
return
|
|
6201
|
+
return _this37[xAxis](_this37.parseX(d.x.value));
|
|
5847
6202
|
}).y(function (d) {
|
|
5848
|
-
return
|
|
5849
|
-
}).curve(d3[curveStyle ||
|
|
6203
|
+
return _this37[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6204
|
+
}).curve(d3[curveStyle || _this37.options.curveStyle]);
|
|
5850
6205
|
};
|
|
5851
6206
|
|
|
5852
6207
|
var xAxis = 'bottomAxis';
|
|
@@ -5884,14 +6239,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5884
6239
|
}, {
|
|
5885
6240
|
key: "rendersymbol",
|
|
5886
6241
|
value: function rendersymbol(series, index) {
|
|
5887
|
-
var
|
|
6242
|
+
var _this38 = this;
|
|
5888
6243
|
|
|
5889
6244
|
/* global d3 series index series.key */
|
|
5890
6245
|
var drawSymbol = function drawSymbol(size) {
|
|
5891
6246
|
return d3.symbol() // .type(d => {
|
|
5892
6247
|
// return d3.symbols[0]
|
|
5893
6248
|
// })
|
|
5894
|
-
.size(size ||
|
|
6249
|
+
.size(size || _this38.options.symbolSize);
|
|
5895
6250
|
};
|
|
5896
6251
|
|
|
5897
6252
|
var xAxis = 'bottomAxis';
|
|
@@ -5909,7 +6264,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5909
6264
|
symbols.attr('d', function (d) {
|
|
5910
6265
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
5911
6266
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
5912
|
-
return "translate(".concat(
|
|
6267
|
+
return "translate(".concat(_this38[xAxis](_this38.parseX(d.x.value)), ", ").concat(_this38[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
5913
6268
|
}); // Enter
|
|
5914
6269
|
|
|
5915
6270
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -5918,7 +6273,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5918
6273
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
5919
6274
|
return "symbol symbol_".concat(series.key);
|
|
5920
6275
|
}).attr('transform', function (d) {
|
|
5921
|
-
return "translate(".concat(
|
|
6276
|
+
return "translate(".concat(_this38[xAxis](_this38.parseX(d.x.value)), ", ").concat(_this38[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
5922
6277
|
});
|
|
5923
6278
|
}
|
|
5924
6279
|
}, {
|
|
@@ -6073,7 +6428,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6073
6428
|
}, {
|
|
6074
6429
|
key: "resize",
|
|
6075
6430
|
value: function resize() {
|
|
6076
|
-
var
|
|
6431
|
+
var _this39 = this;
|
|
6077
6432
|
|
|
6078
6433
|
var el = document.getElementById(this.elementId);
|
|
6079
6434
|
|
|
@@ -6086,7 +6441,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6086
6441
|
// }
|
|
6087
6442
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
6088
6443
|
html += this._data.map(function (d, i) {
|
|
6089
|
-
return
|
|
6444
|
+
return _this39.getLegendItemHTML(d);
|
|
6090
6445
|
}).join('');
|
|
6091
6446
|
html += "\n <div>\n ";
|
|
6092
6447
|
el.innerHTML = html;
|
|
@@ -6234,8 +6589,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6234
6589
|
var el = document.getElementById(this.elementId);
|
|
6235
6590
|
|
|
6236
6591
|
if (el) {
|
|
6237
|
-
if (typeof d3 === 'undefined') {
|
|
6238
|
-
console.error('d3 library has not been loaded');
|
|
6592
|
+
if (typeof d3 === 'undefined') {// console.error('d3 library has not been loaded')
|
|
6239
6593
|
}
|
|
6240
6594
|
|
|
6241
6595
|
if (typeof L === 'undefined') {
|
|
@@ -6259,7 +6613,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6259
6613
|
}, {
|
|
6260
6614
|
key: "render",
|
|
6261
6615
|
value: function render() {
|
|
6262
|
-
var
|
|
6616
|
+
var _this40 = this;
|
|
6263
6617
|
|
|
6264
6618
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
6265
6619
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -6268,7 +6622,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6268
6622
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
6269
6623
|
return {
|
|
6270
6624
|
value: s.label || s.key,
|
|
6271
|
-
color: s.color ||
|
|
6625
|
+
color: s.color || _this40.options.colors[i % _this40.options.colors.length]
|
|
6272
6626
|
};
|
|
6273
6627
|
});
|
|
6274
6628
|
var longestValue = legendData.map(function (s) {
|
|
@@ -6332,7 +6686,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6332
6686
|
|
|
6333
6687
|
if (this.polygons) {
|
|
6334
6688
|
this.polygons.forEach(function (p) {
|
|
6335
|
-
return
|
|
6689
|
+
return _this40.map.removeLayer(p);
|
|
6336
6690
|
});
|
|
6337
6691
|
}
|
|
6338
6692
|
|
|
@@ -6390,18 +6744,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6390
6744
|
}
|
|
6391
6745
|
|
|
6392
6746
|
if (!p.options.color) {
|
|
6393
|
-
p.options.color =
|
|
6747
|
+
p.options.color = _this40.options.colors[i % _this40.options.colors.length];
|
|
6394
6748
|
}
|
|
6395
6749
|
|
|
6396
6750
|
var pol = L.polygon(p.data.map(function (c) {
|
|
6397
6751
|
return c.map(function (d) {
|
|
6398
6752
|
return [d.Latitude, d.Longitude];
|
|
6399
6753
|
});
|
|
6400
|
-
}), p.options).addTo(
|
|
6754
|
+
}), p.options).addTo(_this40.map);
|
|
6401
6755
|
|
|
6402
|
-
|
|
6756
|
+
_this40.polygons.push(pol);
|
|
6403
6757
|
|
|
6404
|
-
|
|
6758
|
+
_this40.map.fitBounds(pol.getBounds());
|
|
6405
6759
|
});
|
|
6406
6760
|
} // if (this.data.markers.length > 0) {
|
|
6407
6761
|
// el.classList.remove('hidden')
|
|
@@ -6553,7 +6907,12 @@ var WebsyDesigns = {
|
|
|
6553
6907
|
ButtonGroup: ButtonGroup,
|
|
6554
6908
|
WebsySwitch: Switch,
|
|
6555
6909
|
Pager: Pager,
|
|
6556
|
-
Switch: Switch
|
|
6910
|
+
Switch: Switch,
|
|
6911
|
+
ResponsiveText: ResponsiveText,
|
|
6912
|
+
WebsyResponsiveText: ResponsiveText,
|
|
6913
|
+
QlikPlugin: _websyDesignsQlikPluginEs["default"],
|
|
6914
|
+
Icons: WebsyIcons,
|
|
6915
|
+
WebsyIcons: WebsyIcons
|
|
6557
6916
|
};
|
|
6558
6917
|
WebsyDesigns.service = new WebsyDesigns.APIService('');
|
|
6559
6918
|
var _default = WebsyDesigns;
|