@websy/websy-designs 1.3.1 → 1.3.2
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 +13 -4
- package/dist/websy-designs-es6.debug.js +26 -13
- package/dist/websy-designs-es6.js +24 -8
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +26 -13
- package/dist/websy-designs.js +24 -8
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -81,7 +81,7 @@ let convertHTMLToPDF = (html, name, callback, options_in = null, displayHeaderFo
|
|
|
81
81
|
// page.on('request', request => request.continue())
|
|
82
82
|
// })
|
|
83
83
|
page.setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36').then(() => {
|
|
84
|
-
page.setContent(html, {waitUntil: ['load', 'domcontentloaded', 'networkidle2', 'networkidle0']}).then(() => {
|
|
84
|
+
page.setContent(html, {waitUntil: process.env.PDF_WAIT_FOR || ['load', 'domcontentloaded', 'networkidle2', 'networkidle0']}).then(() => {
|
|
85
85
|
page.evaluateHandle('document.fonts.ready').then(() => {
|
|
86
86
|
report.pdfPage(page, options).then(pdf => {
|
|
87
87
|
browser.close()
|
|
@@ -92,9 +92,18 @@ let convertHTMLToPDF = (html, name, callback, options_in = null, displayHeaderFo
|
|
|
92
92
|
browser.close()
|
|
93
93
|
callback(error)
|
|
94
94
|
})
|
|
95
|
-
}, err =>
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
}, err => {
|
|
96
|
+
console.log('error evaluating handle in puppeteer', err)
|
|
97
|
+
callback(err)
|
|
98
|
+
})
|
|
99
|
+
}, err => {
|
|
100
|
+
console.log('error setting content in puppeteer', err)
|
|
101
|
+
callback(err)
|
|
102
|
+
})
|
|
103
|
+
}, err => {
|
|
104
|
+
console.log('error setting user agent in puppeteer', err)
|
|
105
|
+
callback(err)
|
|
106
|
+
})
|
|
98
107
|
// page.goto(process.env.PDF_PAGE || 'http://localhost:4000', {waitUntil: ['load', 'domcontentloaded', 'networkidle2', 'networkidle0']}).then(gotoResponse => {
|
|
99
108
|
// page.setViewport({width: 1500, height: 2000, deviceScaleFactor: 1}).then(() => {
|
|
100
109
|
// options.path = `${process.env.APP_ROOT}/pdf/${pdfId}.pdf`
|
|
@@ -550,8 +550,9 @@ class WebsyDatePicker {
|
|
|
550
550
|
let rangeEnd
|
|
551
551
|
if (this.options.mode === 'date') {
|
|
552
552
|
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + (i * this.oneDay)))
|
|
553
|
-
d.setUTCHours(12, 0, 0, 0)
|
|
553
|
+
// d.setUTCHours(12, 0, 0, 0)
|
|
554
554
|
d = d.getTime()
|
|
555
|
+
// console.log('highlighting', this.selectedRangeDates[0].getTime(), d)
|
|
555
556
|
rangeStart = this.selectedRangeDates[0].getTime()
|
|
556
557
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime()
|
|
557
558
|
}
|
|
@@ -560,8 +561,10 @@ class WebsyDatePicker {
|
|
|
560
561
|
rangeStart = this.selectedRangeDates[0]
|
|
561
562
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1]
|
|
562
563
|
}
|
|
563
|
-
else if (this.options.mode === 'monthyear') {
|
|
564
|
-
d = new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + i)
|
|
564
|
+
else if (this.options.mode === 'monthyear') {
|
|
565
|
+
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + i))
|
|
566
|
+
d = d.getTime()
|
|
567
|
+
console.log('highlighting', this.selectedRangeDates[0].getTime(), d)
|
|
565
568
|
rangeStart = this.selectedRangeDates[0].getTime()
|
|
566
569
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime()
|
|
567
570
|
}
|
|
@@ -6771,15 +6774,20 @@ if (this.options.showLabels === true || series.showLabels === true) {
|
|
|
6771
6774
|
.text(d => d.y.label || d.y.value)
|
|
6772
6775
|
.each(function (d, i) {
|
|
6773
6776
|
if (that.options.orientation === 'horizontal') {
|
|
6774
|
-
if (that.options.grouping === 'stacked') {
|
|
6777
|
+
if (that.options.grouping === 'stacked' && series.labelPosition !== 'outside') {
|
|
6775
6778
|
this.setAttribute('text-anchor', 'middle')
|
|
6776
6779
|
}
|
|
6777
6780
|
else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
6778
6781
|
this.setAttribute('text-anchor', 'end')
|
|
6779
|
-
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
6782
|
+
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
6780
6783
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
|
|
6781
6784
|
}
|
|
6782
|
-
else {
|
|
6785
|
+
else if (series.labelPosition === 'outside') {
|
|
6786
|
+
this.setAttribute('text-anchor', 'start')
|
|
6787
|
+
this.setAttribute('x', +(this.getAttribute('x')) + 8)
|
|
6788
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
|
|
6789
|
+
}
|
|
6790
|
+
else {
|
|
6783
6791
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
|
|
6784
6792
|
}
|
|
6785
6793
|
}
|
|
@@ -6803,15 +6811,20 @@ if (this.options.showLabels === true || series.showLabels === true) {
|
|
|
6803
6811
|
.text(d => d.y.label || d.y.value)
|
|
6804
6812
|
.each(function (d, i) {
|
|
6805
6813
|
if (that.options.orientation === 'horizontal') {
|
|
6806
|
-
if (that.options.grouping === 'stacked') {
|
|
6814
|
+
if (that.options.grouping === 'stacked' && series.labelPosition !== 'outside') {
|
|
6807
6815
|
this.setAttribute('text-anchor', 'middle')
|
|
6808
6816
|
}
|
|
6809
6817
|
else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
6810
6818
|
this.setAttribute('text-anchor', 'end')
|
|
6811
|
-
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
6819
|
+
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
6812
6820
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
|
|
6813
6821
|
}
|
|
6814
|
-
else {
|
|
6822
|
+
else if (series.labelPosition === 'outside') {
|
|
6823
|
+
this.setAttribute('text-anchor', 'start')
|
|
6824
|
+
this.setAttribute('x', +(this.getAttribute('x')) + 8)
|
|
6825
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
|
|
6826
|
+
}
|
|
6827
|
+
else {
|
|
6815
6828
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
|
|
6816
6829
|
}
|
|
6817
6830
|
}
|
|
@@ -6823,10 +6836,10 @@ if (this.options.showLabels === true || series.showLabels === true) {
|
|
|
6823
6836
|
})
|
|
6824
6837
|
}
|
|
6825
6838
|
|
|
6826
|
-
function getLabelX (d) {
|
|
6839
|
+
function getLabelX (d, labelPosition = 'inside') {
|
|
6827
6840
|
if (this.options.orientation === 'horizontal') {
|
|
6828
6841
|
if (this.options.grouping === 'stacked') {
|
|
6829
|
-
return this[yAxis](d.y.accumulative) + (this[yAxis](d.y.value) / 2)
|
|
6842
|
+
return this[yAxis](d.y.accumulative) + (this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1))
|
|
6830
6843
|
}
|
|
6831
6844
|
else {
|
|
6832
6845
|
return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) + 4
|
|
@@ -6836,13 +6849,13 @@ function getLabelX (d) {
|
|
|
6836
6849
|
return this[xAxis](this.parseX(d.x.value)) + (this[xAxis].bandwidth() / 2)
|
|
6837
6850
|
}
|
|
6838
6851
|
}
|
|
6839
|
-
function getLabelY (d) {
|
|
6852
|
+
function getLabelY (d, labelPosition = 'inside') {
|
|
6840
6853
|
if (this.options.orientation === 'horizontal') {
|
|
6841
6854
|
return this[xAxis](this.parseX(d.x.value)) + (this[xAxis].bandwidth() / 2)
|
|
6842
6855
|
}
|
|
6843
6856
|
else {
|
|
6844
6857
|
if (this.options.grouping === 'stacked') {
|
|
6845
|
-
|
|
6858
|
+
return this[yAxis](d.y.accumulative) + (this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1))
|
|
6846
6859
|
}
|
|
6847
6860
|
else {
|
|
6848
6861
|
return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) - 4
|
|
@@ -614,9 +614,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
614
614
|
var rangeEnd = void 0;
|
|
615
615
|
|
|
616
616
|
if (this.options.mode === 'date') {
|
|
617
|
-
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + _i * this.oneDay));
|
|
618
|
-
|
|
619
|
-
d = d.getTime();
|
|
617
|
+
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + _i * this.oneDay)); // d.setUTCHours(12, 0, 0, 0)
|
|
618
|
+
|
|
619
|
+
d = d.getTime(); // console.log('highlighting', this.selectedRangeDates[0].getTime(), d)
|
|
620
|
+
|
|
620
621
|
rangeStart = this.selectedRangeDates[0].getTime();
|
|
621
622
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
622
623
|
} else if (this.options.mode === 'year') {
|
|
@@ -624,7 +625,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
624
625
|
rangeStart = this.selectedRangeDates[0];
|
|
625
626
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
626
627
|
} else if (this.options.mode === 'monthyear') {
|
|
627
|
-
d = new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + _i);
|
|
628
|
+
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + _i));
|
|
629
|
+
d = d.getTime();
|
|
630
|
+
console.log('highlighting', this.selectedRangeDates[0].getTime(), d);
|
|
628
631
|
rangeStart = this.selectedRangeDates[0].getTime();
|
|
629
632
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
630
633
|
} else if (this.options.mode === 'hour') {
|
|
@@ -7431,12 +7434,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7431
7434
|
return d.y.label || d.y.value;
|
|
7432
7435
|
}).each(function (d, i) {
|
|
7433
7436
|
if (that.options.orientation === 'horizontal') {
|
|
7434
|
-
if (that.options.grouping === 'stacked') {
|
|
7437
|
+
if (that.options.grouping === 'stacked' && series.labelPosition !== 'outside') {
|
|
7435
7438
|
this.setAttribute('text-anchor', 'middle');
|
|
7436
7439
|
} else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
7437
7440
|
this.setAttribute('text-anchor', 'end');
|
|
7438
7441
|
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
7439
7442
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
7443
|
+
} else if (series.labelPosition === 'outside') {
|
|
7444
|
+
this.setAttribute('text-anchor', 'start');
|
|
7445
|
+
this.setAttribute('x', +this.getAttribute('x') + 8);
|
|
7446
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
7440
7447
|
} else {
|
|
7441
7448
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
7442
7449
|
}
|
|
@@ -7452,12 +7459,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7452
7459
|
return d.y.label || d.y.value;
|
|
7453
7460
|
}).each(function (d, i) {
|
|
7454
7461
|
if (that.options.orientation === 'horizontal') {
|
|
7455
|
-
if (that.options.grouping === 'stacked') {
|
|
7462
|
+
if (that.options.grouping === 'stacked' && series.labelPosition !== 'outside') {
|
|
7456
7463
|
this.setAttribute('text-anchor', 'middle');
|
|
7457
7464
|
} else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
7458
7465
|
this.setAttribute('text-anchor', 'end');
|
|
7459
7466
|
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
7460
7467
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
7468
|
+
} else if (series.labelPosition === 'outside') {
|
|
7469
|
+
this.setAttribute('text-anchor', 'start');
|
|
7470
|
+
this.setAttribute('x', +this.getAttribute('x') + 8);
|
|
7471
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
7461
7472
|
} else {
|
|
7462
7473
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
7463
7474
|
}
|
|
@@ -7470,9 +7481,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7470
7481
|
}
|
|
7471
7482
|
|
|
7472
7483
|
function getLabelX(d) {
|
|
7484
|
+
var labelPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'inside';
|
|
7485
|
+
|
|
7473
7486
|
if (this.options.orientation === 'horizontal') {
|
|
7474
7487
|
if (this.options.grouping === 'stacked') {
|
|
7475
|
-
return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / 2;
|
|
7488
|
+
return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
|
|
7476
7489
|
} else {
|
|
7477
7490
|
return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) + 4;
|
|
7478
7491
|
}
|
|
@@ -7482,10 +7495,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7482
7495
|
}
|
|
7483
7496
|
|
|
7484
7497
|
function getLabelY(d) {
|
|
7498
|
+
var labelPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'inside';
|
|
7499
|
+
|
|
7485
7500
|
if (this.options.orientation === 'horizontal') {
|
|
7486
7501
|
return this[xAxis](this.parseX(d.x.value)) + this[xAxis].bandwidth() / 2;
|
|
7487
7502
|
} else {
|
|
7488
|
-
if (this.options.grouping === 'stacked') {
|
|
7503
|
+
if (this.options.grouping === 'stacked') {
|
|
7504
|
+
return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
|
|
7489
7505
|
} else {
|
|
7490
7506
|
return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) - 4;
|
|
7491
7507
|
}
|