taxtank-core 2.0.55 → 2.0.58
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/fesm2022/taxtank-core.mjs +50 -10
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -20612,22 +20612,25 @@ applyPlugin(jsPDF);
|
|
|
20612
20612
|
class JsPdf extends jsPDF {
|
|
20613
20613
|
}
|
|
20614
20614
|
|
|
20615
|
-
|
|
20615
|
+
/**
|
|
20616
|
+
* Settings for generated PDF file from DOM elements
|
|
20617
|
+
*/
|
|
20616
20618
|
const FILE_SETTINGS$1 = {
|
|
20617
20619
|
margin: 10,
|
|
20618
20620
|
filename: 'export.pdf',
|
|
20619
20621
|
image: { type: 'jpeg', quality: 0.95 },
|
|
20620
20622
|
html2canvas: {
|
|
20623
|
+
scale: 1,
|
|
20621
20624
|
windowWidth: 1200,
|
|
20622
20625
|
windowHeight: 900,
|
|
20623
|
-
|
|
20624
|
-
foreignObjectRendering: true,
|
|
20626
|
+
foreignObjectRendering: false,
|
|
20625
20627
|
letterRendering: false,
|
|
20626
20628
|
useCORS: true,
|
|
20627
|
-
|
|
20628
|
-
|
|
20629
|
+
logging: true,
|
|
20630
|
+
},
|
|
20631
|
+
pagebreak: {
|
|
20632
|
+
mode: 'avoid-all'
|
|
20629
20633
|
},
|
|
20630
|
-
pagebreak: { mode: 'avoid-all' },
|
|
20631
20634
|
jsPDF: {
|
|
20632
20635
|
unit: 'mm',
|
|
20633
20636
|
format: 'a3',
|
|
@@ -20644,6 +20647,44 @@ const FILE_SETTINGS$1 = {
|
|
|
20644
20647
|
* in which all the styles that the user sees on the page will be saved
|
|
20645
20648
|
*/
|
|
20646
20649
|
class PdfFromDomElementService {
|
|
20650
|
+
createIsolatedDocument(elements) {
|
|
20651
|
+
// Создаём скрытый iframe, чтобы клонер html2canvas не копировал всю SPA
|
|
20652
|
+
const iframe = document.createElement('iframe');
|
|
20653
|
+
Object.assign(iframe.style, {
|
|
20654
|
+
position: 'fixed',
|
|
20655
|
+
left: '-99999px',
|
|
20656
|
+
top: '0',
|
|
20657
|
+
width: '1200px',
|
|
20658
|
+
height: '900px',
|
|
20659
|
+
visibility: 'hidden'
|
|
20660
|
+
});
|
|
20661
|
+
document.body.appendChild(iframe);
|
|
20662
|
+
const idoc = iframe.contentDocument;
|
|
20663
|
+
idoc.open();
|
|
20664
|
+
idoc.write(`
|
|
20665
|
+
<!doctype html>
|
|
20666
|
+
<html>
|
|
20667
|
+
<head>
|
|
20668
|
+
<meta charset="utf-8"/>
|
|
20669
|
+
<style>
|
|
20670
|
+
body{margin:0;background:#fff;font-family:Arial,Helvetica,sans-serif;}
|
|
20671
|
+
.pdf-export input.mat-mdc-input-element{
|
|
20672
|
+
height:30px;margin-top:20px;padding:0 15px;
|
|
20673
|
+
}
|
|
20674
|
+
</style>
|
|
20675
|
+
</head>
|
|
20676
|
+
<body><div id="pdf-root"></div></body>
|
|
20677
|
+
</html>
|
|
20678
|
+
`);
|
|
20679
|
+
idoc.close();
|
|
20680
|
+
const pdfRoot = idoc.getElementById('pdf-root');
|
|
20681
|
+
elements.forEach((el) => pdfRoot.append(el.cloneNode(true)));
|
|
20682
|
+
// await (idoc as any).fonts?.ready?.catch(() => {});
|
|
20683
|
+
// await Promise.all(
|
|
20684
|
+
// Array.from(pdfRoot.querySelectorAll('img')).map(img => img.decode?.().catch(() => {}))
|
|
20685
|
+
// );
|
|
20686
|
+
return pdfRoot;
|
|
20687
|
+
}
|
|
20647
20688
|
init(elements, fileSettings) {
|
|
20648
20689
|
const options = FILE_SETTINGS$1;
|
|
20649
20690
|
if (fileSettings) {
|
|
@@ -20655,10 +20696,9 @@ class PdfFromDomElementService {
|
|
|
20655
20696
|
elements.forEach((element) => {
|
|
20656
20697
|
htmlWrapper.append(element.cloneNode(true));
|
|
20657
20698
|
});
|
|
20658
|
-
|
|
20699
|
+
const pdfRoot = this.createIsolatedDocument(elements);
|
|
20659
20700
|
// Set PDF options, save file and return result as Observable
|
|
20660
|
-
return html2pdf().from(
|
|
20661
|
-
});
|
|
20701
|
+
return html2pdf().from(pdfRoot).set(options);
|
|
20662
20702
|
}
|
|
20663
20703
|
download(elements, fileSettings) {
|
|
20664
20704
|
const start = new Date();
|
|
@@ -23300,7 +23340,7 @@ class BudgetRuleForm extends AbstractForm {
|
|
|
23300
23340
|
startDate: new FormControl(rule.startDate, Validators.required),
|
|
23301
23341
|
endDate: new FormControl({ value: rule.endDate, disabled: !rule.frequency }),
|
|
23302
23342
|
inCalendar: new FormControl(rule.inCalendar),
|
|
23303
|
-
frequency: new FormControl(rule.frequency
|
|
23343
|
+
frequency: new FormControl(rule.frequency),
|
|
23304
23344
|
description: new FormControl(rule.description),
|
|
23305
23345
|
bankAccount: new FormControl(rule.endDate, conditionalValidator(() => !!this.value.inCalendar, Validators.required)),
|
|
23306
23346
|
property: new FormControl(rule.property, conditionalValidator(() => this.value.tankType === TankTypeEnum.PROPERTY, Validators.required)),
|