taxtank-core 0.7.1 → 0.7.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.
@@ -1283,6 +1283,12 @@
1283
1283
  Collection.prototype.toArray = function () {
1284
1284
  return __spreadArray([], __read(this.items));
1285
1285
  };
1286
+ /**
1287
+ * Filter items by specific provided callback
1288
+ */
1289
+ Collection.prototype.filter = function (callback) {
1290
+ return new Collection(this.items.filter(callback));
1291
+ };
1286
1292
  Object.defineProperty(Collection.prototype, "first", {
1287
1293
  get: function () {
1288
1294
  return first__default["default"](this.items);
@@ -5600,7 +5606,7 @@
5600
5606
  * @TODO new FinancialYear(this.writeOffDate) === new FinancialYear()
5601
5607
  */
5602
5608
  Depreciation.prototype.isLowValuePool = function () {
5603
- return this.isAsset && !this.isWrittenOff() &&
5609
+ return this.isAsset &&
5604
5610
  this.calculation === exports.DepreciationCalculationEnum.DIMINISHING &&
5605
5611
  this.amount > Depreciation.WRITTEN_OFF_THRESHOLD &&
5606
5612
  this.amount <= Depreciation.LOW_VALUE_POOL_THRESHOLD;
@@ -5706,6 +5712,9 @@
5706
5712
  __decorate([
5707
5713
  classTransformer.Type(function () { return Date; })
5708
5714
  ], Depreciation.prototype, "date", void 0);
5715
+ __decorate([
5716
+ classTransformer.Type(function () { return Date; })
5717
+ ], Depreciation.prototype, "lowValuePoolDate", void 0);
5709
5718
  __decorate([
5710
5719
  classTransformer.Type(function () { return Date; })
5711
5720
  ], Depreciation.prototype, "writeOffManualDate", void 0);
@@ -6697,6 +6706,12 @@
6697
6706
  return DataTableColumn;
6698
6707
  }());
6699
6708
 
6709
+ exports.DepreciationLvpRateEnum = void 0;
6710
+ (function (DepreciationLvpRateEnum) {
6711
+ DepreciationLvpRateEnum[DepreciationLvpRateEnum["FIRST_YEAR"] = 0.1875] = "FIRST_YEAR";
6712
+ DepreciationLvpRateEnum[DepreciationLvpRateEnum["DEFAULT"] = 0.375] = "DEFAULT";
6713
+ })(exports.DepreciationLvpRateEnum || (exports.DepreciationLvpRateEnum = {}));
6714
+
6700
6715
  exports.DepreciationGroupEnum = void 0;
6701
6716
  (function (DepreciationGroupEnum) {
6702
6717
  DepreciationGroupEnum[DepreciationGroupEnum["BUILDING_IMPROVEMENTS"] = 0] = "BUILDING_IMPROVEMENTS";
@@ -10719,12 +10734,17 @@
10719
10734
  var pdf = new jsPDF__default["default"]();
10720
10735
  this.setDocumentTitle(pdf, title);
10721
10736
  tables.forEach(function (table) {
10722
- var _a, _b;
10737
+ var _a;
10738
+ // Add table caption if not provided
10739
+ if (!table.caption) {
10740
+ table.createCaption();
10741
+ table.caption.innerText = '';
10742
+ }
10723
10743
  // coords of last table
10724
10744
  var lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
10725
- pdf.text((_a = table.caption) === null || _a === void 0 ? void 0 : _a.innerText, PDF_CONFIG.contentCoords.marginLeft, lastTableCoords + PDF_CONFIG.contentCoords.marginTop);
10745
+ pdf.text(table.caption.innerText, PDF_CONFIG.contentCoords.marginLeft, lastTableCoords + PDF_CONFIG.contentCoords.marginTop);
10726
10746
  // get caption height based on caption content height
10727
- var captionHeight = pdf.getTextDimensions(pdf.splitTextToSize((_b = table.caption) === null || _b === void 0 ? void 0 : _b.innerText, pdf.internal.pageSize.width)).h;
10747
+ var captionHeight = pdf.getTextDimensions(pdf.splitTextToSize((_a = table.caption) === null || _a === void 0 ? void 0 : _a.innerText, pdf.internal.pageSize.width)).h;
10728
10748
  // table options
10729
10749
  var options = {
10730
10750
  html: table,
@@ -10732,6 +10752,12 @@
10732
10752
  footStyles: {
10733
10753
  fillColor: PDF_CONFIG.text.fillColor,
10734
10754
  textColor: PDF_CONFIG.text.textColor
10755
+ },
10756
+ didParseCell: function (data) {
10757
+ // Align last column content to right
10758
+ if (data.table.columns.length > 1 && (data.column.index === data.table.columns.length - 1)) {
10759
+ data.cell.styles.halign = 'right';
10760
+ }
10735
10761
  }
10736
10762
  };
10737
10763
  autoTable__default["default"](pdf, options);