taxtank-core 2.0.14 → 2.0.16
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 +22 -5
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/index.d.ts +4 -0
- package/package.json +1 -1
@@ -4715,10 +4715,13 @@ class ServiceSubscription extends ServiceSubscription$1 {
|
|
4715
4715
|
if (!this.promoCode) {
|
4716
4716
|
return 0;
|
4717
4717
|
}
|
4718
|
-
|
4719
|
-
|
4720
|
-
|
4721
|
-
|
4718
|
+
let discountApplicable = this.initialPrice;
|
4719
|
+
if (this.promoCode.products.length) {
|
4720
|
+
discountApplicable = this.items
|
4721
|
+
.map(item => item.price)
|
4722
|
+
.filter(price => this.promoCode.getProductsIds().includes(price.product.id))
|
4723
|
+
.reduce((sum, price) => sum + price.amount, 0);
|
4724
|
+
}
|
4722
4725
|
if (this.promoCode.amountOff) {
|
4723
4726
|
return Math.min(discountApplicable, this.promoCode.amountOff);
|
4724
4727
|
}
|
@@ -20555,7 +20558,8 @@ class PdfFromHtmlTableService extends PdfFromTableService {
|
|
20555
20558
|
tables.forEach((table) => {
|
20556
20559
|
table.querySelectorAll('tbody .mat-mdc-row')
|
20557
20560
|
.forEach(row => row.classList.contains('expandable-row') ? row.remove() : '');
|
20558
|
-
this.
|
20561
|
+
const captionText = this.getCaptionText(table.caption);
|
20562
|
+
this.addCaption(pdf, captionText, pageBreak);
|
20559
20563
|
pdf.autoTable({
|
20560
20564
|
html: table,
|
20561
20565
|
...customOptions,
|
@@ -20566,6 +20570,17 @@ class PdfFromHtmlTableService extends PdfFromTableService {
|
|
20566
20570
|
});
|
20567
20571
|
return pdf;
|
20568
20572
|
}
|
20573
|
+
/**
|
20574
|
+
* extracts formatted text from caption's html
|
20575
|
+
*/
|
20576
|
+
getCaptionText(caption) {
|
20577
|
+
if (!caption) {
|
20578
|
+
return '';
|
20579
|
+
}
|
20580
|
+
return caption.children.length ?
|
20581
|
+
Array.from(caption.children).map((node) => node.textContent).join('\n') :
|
20582
|
+
caption.innerText;
|
20583
|
+
}
|
20569
20584
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: PdfFromHtmlTableService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
20570
20585
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: PdfFromHtmlTableService, providedIn: 'root' }); }
|
20571
20586
|
}
|
@@ -20923,6 +20938,8 @@ class XlsxService {
|
|
20923
20938
|
SheetNames: [],
|
20924
20939
|
Sheets: {}
|
20925
20940
|
};
|
20941
|
+
// sets the starting cell coordinate for writing data
|
20942
|
+
xlsx.utils.sheet_add_aoa(worksheet, [['']], { origin: 'A1' });
|
20926
20943
|
tables.forEach((data) => {
|
20927
20944
|
// add caption for the current table
|
20928
20945
|
xlsx.utils.sheet_add_aoa(worksheet, [[data.caption?.innerText]], { origin: -1 });
|