@feedmepos/mf-e-invoice 0.0.77 → 0.0.79

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.
@@ -0,0 +1,39 @@
1
+ import type { F_EXPORT_FILE_TYPE, F_PDF_ORIENTATION_TYPE } from "./export.enum";
2
+ type Prev = [never, 0, 1, 2, 3, 4];
3
+ type DeepKeyOf<T, D extends number = 4> = [D] extends [never] ? never : T extends object ? {
4
+ [K in keyof T & string]: K | (NonNullable<T[K]> extends object ? `${K}.${DeepKeyOf<NonNullable<T[K]>, Prev[D]>}` : never);
5
+ }[keyof T & string] : never;
6
+ export interface ExportColumn<T> {
7
+ accessorKey: DeepKeyOf<T>;
8
+ header: string;
9
+ dateFormat?: string;
10
+ fallbackValue?: string;
11
+ }
12
+ export interface FilterRule<T> {
13
+ field: DeepKeyOf<T>;
14
+ operator: "equal" | "notEqual" | "greaterThan" | "lessThan" | "contains" | "between";
15
+ value: string | number | [number, number];
16
+ }
17
+ export interface ExportSectionBase<T> {
18
+ title?: string;
19
+ subTitle?: string;
20
+ metaData?: string[];
21
+ columns: ExportColumn<T>[];
22
+ filters?: FilterRule<T>[];
23
+ data: T[];
24
+ }
25
+ export type PdfPage<T> = ExportSectionBase<T>;
26
+ export interface ExcelWorksheet<T> extends ExportSectionBase<T> {
27
+ sheetName: string;
28
+ }
29
+ export interface PdfExportBody<T> {
30
+ type: F_EXPORT_FILE_TYPE.pdf;
31
+ orientation: F_PDF_ORIENTATION_TYPE;
32
+ pages: PdfPage<T>[];
33
+ }
34
+ export interface ExcelExportBody<T> {
35
+ type: F_EXPORT_FILE_TYPE.excel;
36
+ worksheets: ExcelWorksheet<T>[];
37
+ }
38
+ export type InvoiceExportBody<T> = PdfExportBody<T> | ExcelExportBody<T>;
39
+ export {};
@@ -0,0 +1,8 @@
1
+ export declare enum F_EXPORT_FILE_TYPE {
2
+ excel = "excel",
3
+ pdf = "pdf"
4
+ }
5
+ export declare enum F_PDF_ORIENTATION_TYPE {
6
+ PORTRAIT = "portrait",
7
+ LANDSCAPE = "landscape"
8
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./export.enum";
2
+ export * from "./export";
@@ -1,5 +1,5 @@
1
+ import { type FdoThEInvoiceSubmission } from "@/type";
1
2
  import { type Submission, type SubmissionDocument } from "../manager";
2
- import type { FdoThEInvoiceSubmission } from "@/type";
3
3
  export declare function formatThailandSubmission(submission: FdoThEInvoiceSubmission): Submission;
4
4
  export declare function exportThailandSubmission(submissions: FdoThEInvoiceSubmission[], dateRange: {
5
5
  startDate: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-e-invoice",
3
- "version": "0.0.77",
3
+ "version": "0.0.79",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -1,22 +0,0 @@
1
- type Prev = [never, 0, 1, 2, 3, 4];
2
- type DeepKeyOf<T, D extends number = 4> = [D] extends [never] ? never : T extends object ? {
3
- [K in keyof T & string]: K | (NonNullable<T[K]> extends object ? `${K}.${DeepKeyOf<NonNullable<T[K]>, Prev[D]>}` : never);
4
- }[keyof T & string] : never;
5
- type AccessorColumn<T> = {
6
- type: "accessor";
7
- accessorKey: DeepKeyOf<T>;
8
- header: string;
9
- dateFormat?: string;
10
- fallbackValue?: string;
11
- };
12
- export type ExportColumn<T> = AccessorColumn<T>;
13
- export interface IFdtoInvoiceExportBody<T> {
14
- data: T[];
15
- type: "pdf" | "excel";
16
- columns: ExportColumn<T>[];
17
- title?: string;
18
- subTitle?: string;
19
- metaData?: string[];
20
- orientation: "portrait" | "landscape";
21
- }
22
- export {};