taxtank-core 0.30.2 → 0.30.5

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.
Files changed (37) hide show
  1. package/esm2020/lib/collections/collection.mjs +1 -1
  2. package/esm2020/lib/db/static/chart-accounts/chart-accounts-value.json +376 -0
  3. package/esm2020/lib/db-static/chart-accounts/chart-accounts-values.mjs +9 -0
  4. package/esm2020/lib/forms/abstract.form.mjs +6 -1
  5. package/esm2020/lib/forms/sole/sole-invoice.form.mjs +3 -3
  6. package/esm2020/lib/forms/transaction/work/work-expense.form.mjs +9 -2
  7. package/esm2020/lib/forms/transaction/work/work-transaction.form.mjs +1 -1
  8. package/esm2020/lib/models/chart-accounts/chart-accounts.mjs +10 -2
  9. package/esm2020/lib/models/transaction/transaction.mjs +4 -4
  10. package/esm2020/lib/services/http/income-source/income-source.service.mjs +2 -2
  11. package/esm2020/lib/services/http/rest/rest-old.service.mjs +14 -14
  12. package/esm2020/lib/services/http/rest/rest.service.mjs +16 -16
  13. package/esm2020/lib/services/http/transaction/transaction.service.mjs +12 -13
  14. package/esm2020/lib/services/pdf/index.mjs +2 -1
  15. package/esm2020/lib/services/pdf/js-pdf.mjs +10 -0
  16. package/esm2020/lib/services/pdf/pdf-from-dom-element/pdf-from-dom-element.service.mjs +2 -2
  17. package/esm2020/lib/services/pdf/pdf-from-table/pdf-from-data-table/pdf-from-data-table.service.mjs +5 -6
  18. package/esm2020/lib/services/pdf/pdf-from-table/pdf-from-html-table/pdf-from-html-table.service.mjs +4 -5
  19. package/esm2020/lib/services/pdf/pdf-from-table/pdf-from-table.service.mjs +1 -1
  20. package/fesm2015/taxtank-core.mjs +4376 -3899
  21. package/fesm2015/taxtank-core.mjs.map +1 -1
  22. package/fesm2020/taxtank-core.mjs +4348 -3871
  23. package/fesm2020/taxtank-core.mjs.map +1 -1
  24. package/lib/collections/collection.d.ts +1 -1
  25. package/lib/db-static/chart-accounts/chart-accounts-values.d.ts +6 -0
  26. package/lib/forms/abstract.form.d.ts +5 -1
  27. package/lib/forms/transaction/work/work-expense.form.d.ts +5 -0
  28. package/lib/models/chart-accounts/chart-accounts.d.ts +1 -0
  29. package/lib/models/transaction/transaction.d.ts +5 -5
  30. package/lib/services/http/rest/rest-old.service.d.ts +6 -6
  31. package/lib/services/http/rest/rest.service.d.ts +3 -3
  32. package/lib/services/http/transaction/transaction.service.d.ts +2 -1
  33. package/lib/services/pdf/index.d.ts +1 -0
  34. package/lib/services/pdf/js-pdf.d.ts +9 -0
  35. package/lib/services/pdf/pdf-from-table/pdf-from-data-table/pdf-from-data-table.service.d.ts +1 -1
  36. package/lib/services/pdf/pdf-from-table/pdf-from-table.service.d.ts +4 -4
  37. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  import { CollectionDictionary } from './collection-dictionary';
2
- import { AbstractModel } from '../db/Models/abstract-model';
2
+ import { AbstractModel } from '../db/Models';
3
3
  /**
4
4
  * Base collection class. Contains common properties and methods for all collections
5
5
  */
@@ -0,0 +1,6 @@
1
+ import { ChartAccountsValue } from '../../db/Models';
2
+ import { Collection, CollectionDictionary } from '../../collections';
3
+ /**
4
+ * @TODO vik performance problems, try https://angular.io/guide/dependency-injection-providers?
5
+ */
6
+ export declare const CHART_ACCOUNTS_VALUES: CollectionDictionary<Collection<ChartAccountsValue>>;
@@ -36,6 +36,10 @@ export declare abstract class AbstractForm<Model> extends UntypedFormGroup {
36
36
  }): this;
37
37
  markAsUnsaved(): void;
38
38
  markAsSaved(): void;
39
- private createModelInstance;
39
+ /**
40
+ * @TODO use excludeExtraneousValues when all models refactored (exposed all needed properties)
41
+ * @param data
42
+ */
43
+ createModelInstance(data?: object): Model;
40
44
  private listenValueChanges;
41
45
  }
@@ -1,6 +1,11 @@
1
1
  import { IEventListener } from '../../../interfaces';
2
+ import { Transaction, TransactionAllocation } from '../../../models';
2
3
  import { WorkTransactionForm } from './work-transaction.form';
4
+ import { AbstractControl } from '@angular/forms';
3
5
  export declare class WorkExpenseForm extends WorkTransactionForm implements IEventListener {
6
+ constructor(transaction: Transaction, registeredForGst: boolean, allocations: TransactionAllocation[], controls?: {
7
+ [key: string]: AbstractControl;
8
+ });
4
9
  listenEvents(): void;
5
10
  watchChartAccountsMetadata(): void;
6
11
  }
@@ -13,6 +13,7 @@ export declare class ChartAccounts extends ChartAccountsBase {
13
13
  static GSTPercent: number;
14
14
  heading: ChartAccountsHeading;
15
15
  metadata: ChartAccountsMetadata[];
16
+ values: ChartAccountsValue[];
16
17
  /**
17
18
  * Return name as string
18
19
  */
@@ -1,17 +1,17 @@
1
1
  import { Transaction as TransactionBase } from '../../db/Models/transaction/transaction';
2
2
  import { ChartAccountsCategoryEnum, ChartAccountsMetadataListEnum } from '../../db/Enums';
3
3
  import { TransactionOperationEnum } from '../../db/Enums/transaction-operation.enum';
4
- import { Property } from '../property/property';
4
+ import { Property } from '../property';
5
5
  import { TransactionReceipt } from './transaction-receipt';
6
6
  import { ChartAccounts } from '../chart-accounts';
7
7
  import { IncomeSource } from '../income-source/income-source';
8
8
  import { TransactionMetadata } from './transaction-metadata';
9
- import { Loan } from '../loan/loan';
9
+ import { Loan } from '../loan';
10
10
  import { TransactionAllocation } from './transaction-allocation';
11
- import { IReceipt } from '../../interfaces/receipt.interface';
11
+ import { IReceipt } from '../../interfaces';
12
12
  import { TransactionAllocationCollection } from '../../collections';
13
- import { Depreciation } from '../depreciation/depreciation';
14
- import { Expense } from '../../interfaces/expense.interface';
13
+ import { Depreciation } from '../depreciation';
14
+ import { Expense } from '../../interfaces';
15
15
  import { SoleInvoiceItem } from '../sole';
16
16
  export declare class Transaction extends TransactionBase implements Expense, IReceipt {
17
17
  transactions: Transaction[];
@@ -1,8 +1,8 @@
1
1
  import { Observable, ReplaySubject } from 'rxjs';
2
2
  import { HttpClient } from '@angular/common/http';
3
- import { EventDispatcherService } from '../../event/event-dispatcher.service';
4
- import { ToastService } from '../../toast/toast.service';
5
- import { IEventListener } from '../../../interfaces/event-listener.interface';
3
+ import { EventDispatcherService } from '../../event';
4
+ import { ToastService } from '../../toast';
5
+ import { IEventListener } from '../../../interfaces';
6
6
  import * as i0 from "@angular/core";
7
7
  /**
8
8
  * Abstract base service that implements common services functionality
@@ -96,11 +96,11 @@ export declare abstract class RestService<BaseModel, Model extends BaseModel> im
96
96
  */
97
97
  protected updateCache(): void;
98
98
  /**
99
+ * @TODO use excludeExtraneousValues when all models refactored (exposed all needed properties)
99
100
  * Create new instance of class
100
- * @param model The class for which you want to create an instance
101
- * @param baseModel base model instance that we will use as constructor options
101
+ * @param model instance that we will use as constructor options
102
102
  */
103
- protected createModelInstance(model: new (bm: BaseModel) => Model, baseModel: BaseModel): Model;
103
+ protected createModelInstance(model: BaseModel | object): Model;
104
104
  /**
105
105
  * Method that call all listeners. Empty by default. Should be redefined by child services if required
106
106
  */
@@ -101,11 +101,11 @@ export declare abstract class RestService<BaseModel extends AbstractModel, Model
101
101
  */
102
102
  protected dispatchEvent(method: HttpMethod, items: Model[]): void;
103
103
  /**
104
+ * @TODO use excludeExtraneousValues when all models refactored (exposed all needed properties)
104
105
  * Create new instance of class
105
- * @param model The class whose instance to be created
106
- * @param plain Single object or array from which will be created model instance(s)
106
+ * @param model Single object or array from which will be created model instance(s)
107
107
  */
108
- protected createModelInstance(model: new (bm: BaseModel) => Model, plain: BaseModel): Model;
108
+ protected createModelInstance(model: BaseModel): Model;
109
109
  protected createCollectionInstance(collectionClass: new (items: Model[]) => CollectionModel, items: Model[]): CollectionModel;
110
110
  /**
111
111
  * Check if method is not disabled. Throw exception otherwise.
@@ -7,7 +7,7 @@ import { TransactionReceiptService } from './transaction-receipt/transaction-rec
7
7
  import { HttpClient } from '@angular/common/http';
8
8
  import { EventDispatcherService } from '../../event';
9
9
  import { ToastService } from '../../toast';
10
- import { IEventListener } from '../../../interfaces/event-listener.interface';
10
+ import { IEventListener } from '../../../interfaces';
11
11
  import * as i0 from "@angular/core";
12
12
  /**
13
13
  * Service for transactions business logic
@@ -72,6 +72,7 @@ export declare class TransactionService extends RestService<TransactionBase, Tra
72
72
  */
73
73
  delete(model: Transaction): Observable<void>;
74
74
  /**
75
+ * @TODO Alex wrong place for this logic, move to model
75
76
  * calculate gross income amount based on transaction amount and taxes (fees)
76
77
  * @param transaction Transaction instance for calculation
77
78
  */
@@ -1,3 +1,4 @@
1
+ export * from './js-pdf';
1
2
  export * from './pdf-from-dom-element/pdf-from-dom-element.service';
2
3
  export * from './pdf-from-table/pdf-from-data-table/pdf-from-data-table.service';
3
4
  export * from './pdf-from-table/pdf-from-html-table/pdf-from-html-table.service';
@@ -0,0 +1,9 @@
1
+ import { jsPDF } from 'jspdf';
2
+ import { UserOptions } from 'jspdf-autotable';
3
+ /**
4
+ * jspdf-autotable is a plugin, adding table functionality to jspdf object without new class,
5
+ * we need to let ts knows about that by defining an interface and extending jsPdf class (to avoid ts error)
6
+ */
7
+ export declare class JsPdf extends jsPDF {
8
+ autoTable: (options: UserOptions) => jsPDF;
9
+ }
@@ -1,6 +1,6 @@
1
1
  import { ExportDataTable } from '../../../../models/export/export-data-table';
2
2
  import { PdfSettings } from '../../../../models/pdf/pdf-settings';
3
- import { ExportFormatterService } from '../../../export/export-formatter.service';
3
+ import { ExportFormatterService } from '../../../export';
4
4
  import { PdfFromTableService } from '../pdf-from-table.service';
5
5
  import * as i0 from "@angular/core";
6
6
  /**
@@ -1,4 +1,4 @@
1
- import jsPDF from 'jspdf';
1
+ import { JsPdf } from '../js-pdf';
2
2
  import * as i0 from "@angular/core";
3
3
  /**
4
4
  * Service with base functionality to export tables (HTML table, data-table, e.t.c.) as PDF file
@@ -8,9 +8,9 @@ export declare class PdfFromTableService {
8
8
  /**
9
9
  * Set basic options for PDF table
10
10
  */
11
- protected setTableOptions(pdf: jsPDF, tableCaption?: string): object;
12
- protected setDocumentTitle(doc: jsPDF, title?: string): void;
13
- protected setDocumentLogo(doc: jsPDF): void;
11
+ protected setTableOptions(pdf: JsPdf, tableCaption?: string): object;
12
+ protected setDocumentTitle(doc: JsPdf, title?: string): void;
13
+ protected setDocumentLogo(doc: JsPdf): void;
14
14
  static ɵfac: i0.ɵɵFactoryDeclaration<PdfFromTableService, never>;
15
15
  static ɵprov: i0.ɵɵInjectableDeclaration<PdfFromTableService>;
16
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taxtank-core",
3
- "version": "0.30.2",
3
+ "version": "0.30.5",
4
4
  "private": false,
5
5
  "peerDependencies": {
6
6
  "@angular/compiler": "^15.1.5",
@@ -18,9 +18,9 @@
18
18
  "moment": "^2.29.4",
19
19
  "moment-range": "^4.0.2",
20
20
  "lodash": "^4.17.21",
21
- "jspdf": "^2.4.0",
21
+ "jspdf": "^2.5.1",
22
22
  "html2pdf.js": "^0.10.1",
23
- "jspdf-autotable": "^3.5.23",
23
+ "jspdf-autotable": "^3.5.28",
24
24
  "rxjs": "~6.6.0",
25
25
  "xlsx": "^0.17.4",
26
26
  "file-saver": "^2.0.5"