@sme.up/doc-alchemist 1.2.0-SNAPSHOT-20250625121844 → 1.2.0-SNAPSHOT-20250625124453
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/dist/assets/sample-data.d.ts +50 -0
- package/dist/assets/sample-data.js +681 -0
- package/dist/assets/sample-data.js.map +1 -0
- package/dist/debug.d.ts +1 -0
- package/dist/debug.js +29 -0
- package/dist/debug.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/tests/charts-generator.test.d.ts +1 -0
- package/dist/tests/charts-generator.test.js +20 -0
- package/dist/tests/charts-generator.test.js.map +1 -0
- package/dist/tests/excel-generator.test.d.ts +1 -0
- package/dist/tests/excel-generator.test.js +406 -0
- package/dist/tests/excel-generator.test.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sample-data.js","sourceRoot":"","sources":["../../assets/sample-data.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EAGN,sBAAsB,GAIvB,MAAM,wBAAwB,CAAC;AAIhC,MAAM,gBAAgB,GAAsB;IAC1C;QACE,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,SAAS;QAChB,OAAO,EAAE,IAAI;QACb,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE;KACtB;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,YAAY;QACnB,OAAO,EAAE,IAAI;QACb,GAAG,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE;KAC/B;IACD;QACE,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,QAAQ;QACf,OAAO,EAAE,IAAI;QACb,GAAG,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE;KAC3B;IACD;QACE,IAAI,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P,GAAG,EAAE;4BACH;gCACE,QAAQ,EAAE,QAAQ;gCAClB,GAAG,EAAE,KAAK;gCACV,MAAM,EAAE,OAAO;gCACf,MAAM,EAAE,eAAe;gCACvB,GAAG,EAAE,MAAM;gCACX,GAAG,EAAE,IAAI;gCACT,IAAI,EAAE,aAAa;6BACpB;yBACF;qBACF;iBACF;aACF;SACF;KACF;CACF,CAAC","sourcesContent":["import {\n Shapes,\n SmeupDataCell,\n SmeupDataColumn,\n SmeupDataStructureType,\n SmeupDataTable,\n SmeupDataTree,\n SmeupSch,\n} from \"@sme.up/kokos-sdk-node\";\nimport { GenericObject } from \"../src/types/index.js\";\nimport { TotalMode } from \"../src/excel/excel-generator.types.js\";\n\nconst columns_sample_1: SmeupDataColumn[] = [\n {\n name: \"COL1\",\n title: \"Column1\",\n visible: true,\n obj: { t: \"\", p: \"\" },\n },\n {\n name: \"VO_COD_VER_COL\",\n title: \"VO_COD_VER\",\n visible: true,\n obj: { t: \"VO\", p: \"COD_VER\" },\n },\n {\n name: \"BTN_COL\",\n title: \"Button\",\n visible: true,\n obj: { t: \"J4\", p: \"BTN\" },\n },\n {\n name: \"COL2\",\n title: \"Column2\",\n visible: true,\n obj: { t: \"\", p: \"\" },\n },\n {\n name: \"HIDDEN_COL\",\n title: \"Hidden column\",\n visible: false,\n obj: { t: \"NR\", p: \"\" },\n },\n {\n name: \"SUM_COL\",\n title: \"Sum\",\n visible: true,\n obj: { t: \"NR\", p: \"\" },\n },\n {\n name: \"AVG_COL\",\n title: \"Average\",\n visible: true,\n obj: { t: \"NR\", p: \"\" },\n },\n {\n name: \"MIN_COL\",\n title: \"Minimum\",\n visible: true,\n obj: { t: \"NR\", p: \"\" },\n },\n {\n name: \"MAX_COL\",\n title: \"Maximum\",\n visible: true,\n obj: { t: \"NR\", p: \"\" },\n },\n {\n name: \"DIFF_COL\",\n title: \"Difference\",\n visible: true,\n formula: \"([HIDDEN_COL]-[SUM_COL])\",\n obj: { t: \"NR\", p: \"\" },\n },\n];\n\nconst cells_1_sample_1: {\n [key: string]: SmeupDataCell;\n} = {\n COL1: {\n obj: { t: \"\", p: \"\", k: \"Value 1\" },\n value: \"Value 1\",\n },\n VO_COD_VER_COL: {\n obj: { t: \"VO\", p: \"COD_VER\", k: \"Op\" },\n value: \"Op\",\n },\n BTN_COL: {\n obj: { t: \"J4\", p: \"BTN\", k: \"Button\" },\n value: \"Button\",\n },\n COL2: {\n obj: { t: \"\", p: \"\", k: \"Value 2\" },\n value: \"Value 2\",\n },\n HIDDEN_COL: {\n obj: { t: \"NR\", p: \"\", k: \"33\" },\n value: \"33\",\n },\n SUM_COL: {\n obj: { t: \"NR\", p: \"\", k: \"15\" },\n value: \"15\",\n },\n AVG_COL: {\n obj: { t: \"NR\", p: \"\", k: \"-5\" },\n value: \"-5\",\n },\n MIN_COL: {\n obj: { t: \"NR\", p: \"\", k: \"1000\" },\n value: \"1000\",\n },\n MAX_COL: {\n obj: { t: \"NR\", p: \"\", k: \"12\" },\n value: \"12\",\n },\n DIFF_COL: {\n obj: { t: \"NR\", p: \"\", k: \"-18\" },\n value: \"-18\",\n },\n};\n\nconst cells_2_sample_1: {\n [key: string]: SmeupDataCell;\n} = {\n COL1: {\n obj: { t: \"\", p: \"\", k: \"Value 3\" },\n value: \"Value 3\",\n },\n VO_COD_VER_COL: {\n obj: { t: \"VO\", p: \"COD_VER\", k: \"Op\" },\n value: \"Op\",\n },\n BTN_COL: {\n obj: { t: \"J4\", p: \"BTN\", k: \"Button\" },\n value: \"Button\",\n },\n COL2: {\n obj: { t: \"\", p: \"\", k: \"Value 4\" },\n value: \"Value 4\",\n },\n HIDDEN_COL: {\n obj: { t: \"NR\", p: \"\", k: \"33\" },\n value: \"33\",\n },\n SUM_COL: {\n obj: { t: \"NR\", p: \"\", k: \"6\" },\n value: \"6\",\n },\n AVG_COL: {\n obj: { t: \"NR\", p: \"\", k: \"-80\" },\n value: \"-80\",\n },\n MIN_COL: {\n obj: { t: \"NR\", p: \"\", k: \"5.5\" },\n value: \"5.5\",\n },\n MAX_COL: {\n obj: { t: \"NR\", p: \"\", k: \"1200\" },\n value: \"1200\",\n },\n DIFF_COL: {\n obj: { t: \"NR\", p: \"\", k: \"-27\" },\n value: \"-27\",\n },\n};\n\n/**\n * Sample data for testing Excel generation functionality.\n * Contains a table with multiple columns including visible/hidden columns,\n * numeric data, and formula columns.\n */\nexport const table_sample_1: {\n smeupDataTable: SmeupDataTable;\n props: GenericObject;\n} = {\n smeupDataTable: {\n type: SmeupDataStructureType.SmeupDataTable,\n columns: columns_sample_1,\n rows: [\n {\n cells: cells_1_sample_1,\n },\n {\n cells: cells_2_sample_1,\n },\n ],\n } as SmeupDataTable,\n props: {},\n};\n\nexport const table_sample_2 = {\n smeupDataTable: {\n type: SmeupDataStructureType.SmeupDataTable,\n columns: [\n {\n name: \"1\",\n title: \"1title\",\n visible: true,\n obj: { t: \"\", p: \"\" },\n },\n {\n name: \"2\",\n title: \"2title\",\n visible: true,\n obj: { t: \"\", p: \"\" },\n },\n {\n name: \"DSC\",\n title: \"DSCtitle\",\n visible: true,\n obj: { t: \"\", p: \"\" },\n },\n ],\n rows: [\n {\n cells: {\n 1: {\n obj: { t: \"\", p: \"\", k: \"\" },\n value: \"1-1\",\n },\n 2: {\n obj: { t: \"\", p: \"\", k: \"\" },\n value: \"2-1\",\n },\n DSC: {\n obj: { t: \"\", p: \"\", k: \"\" },\n value: \"DSC-1\",\n },\n },\n },\n {\n cells: {\n 1: {\n obj: { t: \"\", p: \"\" },\n value: \"1-2\",\n },\n 2: {\n obj: { t: \"\", p: \"\" },\n value: \"2-2\",\n },\n DSC: {\n obj: { t: \"\", p: \"\" },\n value: \"DSC-2\",\n },\n },\n },\n ],\n } as SmeupDataTable,\n props: {\n groups: [\n { column: \"1\", visible: true },\n { column: \"2\", visible: true },\n ],\n totals: [],\n },\n};\n\nexport const tree_grid_sample_1: {\n smeupDataTree: SmeupDataTree;\n props: GenericObject;\n} = {\n smeupDataTree: {\n type: SmeupDataStructureType.SmeupDataTree,\n columns: columns_sample_1,\n children: [\n {\n obj: {\n t: \"\",\n p: \"\",\n k: \"1LVL.\",\n },\n value: \"Node1\",\n cells: cells_1_sample_1,\n children: [\n {\n obj: {\n t: \"\",\n p: \"\",\n k: \"2LVL.\",\n },\n value: \"Node1\",\n cells: cells_2_sample_1,\n children: [\n {\n obj: {\n t: \"\",\n p: \"\",\n k: \"3LVL.\",\n },\n value: \"Node1\",\n cells: cells_1_sample_1,\n children: [],\n },\n ],\n },\n {\n obj: {\n t: \"\",\n p: \"\",\n k: \"2LVL.\",\n },\n value: \"Node2\",\n cells: cells_2_sample_1,\n children: [],\n },\n ],\n },\n {\n obj: {\n t: \"\",\n p: \"\",\n k: \"1LVL.\",\n },\n value: \"Node2\",\n cells: cells_1_sample_1,\n children: [],\n },\n ],\n },\n props: {},\n};\n\n// Define table_sample_1 for use in tests\nexport const totals_sample_1: { [columnName: string]: TotalMode | string } = {\n COL1: \"Count\" as TotalMode,\n COL2: \"Distinct\" as TotalMode,\n HIDDEN_COL: \"Sum\" as TotalMode,\n SUM_COL: \"Sum\" as TotalMode,\n AVG_COL: \"Average\" as TotalMode,\n MIN_COL: \"Min\" as TotalMode,\n MAX_COL: \"Max\" as TotalMode,\n DIFF_COL: `${\"MATH\" as TotalMode}([HIDDEN_COL]-[SUM_COL])`,\n};\n\nexport const data_table_totals_result_sample_1: { [key: string]: string } = {\n COL1: \"SUBTOTAL(3,A2:A3)\",\n HIDDEN_COL: \"SUBTOTAL(9,C2:C3)\",\n SUM_COL: \"SUBTOTAL(9,D2:D3)\",\n AVG_COL: \"SUBTOTAL(1,E2:E3)\",\n MIN_COL: \"SUBTOTAL(5,F2:F3)\",\n MAX_COL: \"SUBTOTAL(4,G2:G3)\",\n DIFF_COL: `(C4-D4)`,\n};\n\nexport const table_footer_actions = (\n action: string,\n groups: { column: string; visible: boolean }[],\n rowsNumber: number = 1,\n rowRepetitions: number = 1,\n) => {\n const rows: Array<{\n cells: {\n [key: string]: {\n obj: { t: string; p: string; k: string };\n value: string;\n };\n };\n id: string;\n }> = [];\n for (let i = 0; i < rowsNumber; i++) {\n const rowObj = {\n cells: {\n 1: {\n obj: { t: \"\", p: \"\", k: \"\" },\n value: `1-${i}`,\n },\n 2: {\n obj: { t: \"\", p: \"\", k: \"\" },\n value: `2-${i}`,\n },\n [`${action}`]: {\n obj: { t: \"NR\", p: \"\", k: \"10\" },\n value: `${i + 1}`,\n },\n },\n id: `${i}`,\n };\n for (let i = 0; i < rowRepetitions; i++) {\n rows.push(rowObj);\n }\n }\n return {\n smeupDataTable: {\n type: SmeupDataStructureType.SmeupDataTable,\n columns: [\n {\n name: \"1\",\n title: \"1title\",\n visible: true,\n obj: { t: \"\", p: \"\" },\n },\n {\n name: \"2\",\n title: \"2title\",\n visible: true,\n obj: { t: \"\", p: \"\" },\n },\n {\n name: `${action}`,\n title: `${action}title`,\n visible: true,\n obj: { t: \"NR\", p: \"\" },\n },\n ],\n rows,\n } as SmeupDataTable,\n props: {\n groups,\n totals: action ? { [`${action}`]: `${action}` } : [],\n filter: [],\n },\n };\n};\n\nexport const mat_cha_data: SmeupDataTable = {\n type: SmeupDataStructureType.SmeupDataTable,\n columns: [\n {\n name: \"G56H01\",\n title: \"Asse\",\n visible: true,\n isEditable: false,\n maxLength: 50,\n length: 50,\n },\n {\n name: \"VALORI\",\n title: \"Origine\",\n visible: true,\n isEditable: false,\n obj: {\n t: \"NR\",\n p: \"\",\n },\n integers: 30,\n },\n {\n name: \"VALCAL\",\n title: \"Previsione\",\n visible: true,\n isEditable: false,\n obj: {\n t: \"NR\",\n p: \"\",\n },\n integers: 30,\n },\n ],\n rows: [\n {\n cells: {\n G56H01: {\n value: \"001\",\n obj: {\n t: \"\",\n p: \"\",\n k: \"001\",\n },\n isEditable: false,\n data: {\n size: 50,\n maxLength: 50,\n },\n },\n VALORI: {\n value: \"12242.000000\",\n obj: {\n t: \"NR\",\n p: \"\",\n k: \"12.242,000000\",\n },\n isEditable: false,\n data: {\n size: 30,\n integers: 30,\n },\n },\n VALCAL: {\n value: \"7028.00000000000000000000\",\n obj: {\n t: \"NR\",\n p: \"\",\n k: \"7.028,00000000000000000000\",\n },\n isEditable: false,\n data: {\n size: 30,\n integers: 30,\n },\n },\n },\n },\n {\n cells: {\n G56H01: {\n value: \"002\",\n obj: {\n t: \"\",\n p: \"\",\n k: \"002\",\n },\n isEditable: false,\n data: {\n size: 50,\n maxLength: 50,\n },\n },\n VALORI: {\n value: \"10690.000000\",\n obj: {\n t: \"NR\",\n p: \"\",\n k: \"10.690,000000\",\n },\n isEditable: false,\n data: {\n size: 30,\n integers: 30,\n },\n },\n VALCAL: {\n value: \"7555.00000000000000000000\",\n obj: {\n t: \"NR\",\n p: \"\",\n k: \"7.555,00000000000000000000\",\n },\n isEditable: false,\n data: {\n size: 30,\n integers: 30,\n },\n },\n },\n },\n {\n cells: {\n G56H01: {\n value: \"003\",\n obj: {\n t: \"\",\n p: \"\",\n k: \"003\",\n },\n isEditable: false,\n data: {\n size: 50,\n maxLength: 50,\n },\n },\n VALORI: {\n value: \"12422.000000\",\n obj: {\n t: \"NR\",\n p: \"\",\n k: \"12.422,000000\",\n },\n isEditable: false,\n data: {\n size: 30,\n integers: 30,\n },\n },\n VALCAL: {\n value: \"13200.00000000000000000000\",\n obj: {\n t: \"NR\",\n p: \"\",\n k: \"13.200,00000000000000000000\",\n },\n isEditable: false,\n data: {\n size: 30,\n integers: 30,\n },\n },\n },\n },\n {\n cells: {\n G56H01: {\n value: \"004\",\n obj: {\n t: \"\",\n p: \"\",\n k: \"004\",\n },\n isEditable: false,\n data: {\n size: 50,\n maxLength: 50,\n },\n },\n VALORI: {\n value: \"14846.000000\",\n obj: {\n t: \"NR\",\n p: \"\",\n k: \"14.846,000000\",\n },\n isEditable: false,\n data: {\n size: 30,\n integers: 30,\n },\n },\n VALCAL: {\n value: \"12560.00000000000000000000\",\n obj: {\n t: \"NR\",\n p: \"\",\n k: \"12.560,00000000000000000000\",\n },\n isEditable: false,\n data: {\n size: 30,\n integers: 30,\n },\n },\n },\n },\n {\n cells: {\n G56H01: {\n value: \"005\",\n obj: {\n t: \"\",\n p: \"\",\n k: \"005\",\n },\n isEditable: false,\n data: {\n size: 50,\n maxLength: 50,\n },\n },\n VALORI: {\n value: \"13474.000000\",\n obj: {\n t: \"NR\",\n p: \"\",\n k: \"13.474,000000\",\n },\n isEditable: false,\n data: {\n size: 30,\n integers: 30,\n },\n },\n VALCAL: {\n value: \"20802.00000000000000000000\",\n obj: {\n t: \"NR\",\n p: \"\",\n k: \"20.802,00000000000000000000\",\n },\n isEditable: false,\n data: {\n size: 30,\n integers: 30,\n },\n },\n },\n },\n ],\n};\n\nexport const sch_with_charts: SmeupSch = {\n type: SmeupDataStructureType.SmeupScheda,\n layout: \"column\",\n title: \"Scheda with charts\",\n sections: [\n {\n id: \"A\",\n sections: [],\n layout: \"column\",\n components: [\n {\n type: Shapes.EXA,\n title: \"Chart 1\",\n data: mat_cha_data,\n options: {\n EXA: [\n {\n TitlePos: \"bottom\",\n Leg: \"Yes\",\n LegPos: \"right\",\n Series: \"VALORI|VALCAL\",\n Typ: \"LINE\",\n Asp: \"2D\",\n Name: \"Chart lines\",\n },\n ],\n },\n },\n ],\n },\n {\n id: \"B\",\n sections: [],\n layout: \"column\",\n components: [\n {\n type: Shapes.EXA,\n title: \"Chart 2\",\n data: mat_cha_data,\n options: {\n EXA: [\n {\n TitlePos: \"bottom\",\n Leg: \"Yes\",\n LegPos: \"right\",\n Series: \"VALCAL|VALORI\",\n Typ: \"LINE\",\n Asp: \"2D\",\n Name: \"Chart lines\",\n },\n ],\n },\n },\n ],\n },\n ],\n};\n"]}
|
package/dist/debug.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/debug.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SupportedExportFormats } from "./src/types/index.js";
|
|
2
|
+
//import { table_sample_1 } from "./assets/sample-data.js";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import fs from "fs/promises";
|
|
5
|
+
import { dataTableToExcelData } from "./src/excel/excel-generator.js";
|
|
6
|
+
async function main() {
|
|
7
|
+
const managerData = {
|
|
8
|
+
mathLocale: "it-IT",
|
|
9
|
+
datesLocale: "it-IT",
|
|
10
|
+
themeBackground: "",
|
|
11
|
+
};
|
|
12
|
+
const dataTableJSON = JSON.parse(await fs.readFile("F:/temp/data-table.json", "utf-8"));
|
|
13
|
+
const dataTableProps = {
|
|
14
|
+
...dataTableJSON,
|
|
15
|
+
};
|
|
16
|
+
delete dataTableProps.data;
|
|
17
|
+
const dataTable = {
|
|
18
|
+
smeupDataTable: dataTableJSON.data,
|
|
19
|
+
props: dataTableProps,
|
|
20
|
+
};
|
|
21
|
+
console.log("Generating Excel data...");
|
|
22
|
+
const excelData = await dataTableToExcelData(dataTable, SupportedExportFormats.XLSX, managerData);
|
|
23
|
+
const outputPath = path.resolve("./output/sample-export-debug.xlsx");
|
|
24
|
+
console.log("Saving Excel to:", outputPath);
|
|
25
|
+
await fs.writeFile(outputPath, excelData);
|
|
26
|
+
console.log("Excel file saved successfully at:", outputPath);
|
|
27
|
+
}
|
|
28
|
+
main().catch(console.error);
|
|
29
|
+
//# sourceMappingURL=debug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../debug.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAoB,MAAM,sBAAsB,CAAC;AAChF,2DAA2D;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEtE,KAAK,UAAU,IAAI;IACjB,MAAM,WAAW,GAAqB;QACpC,UAAU,EAAE,OAAO;QACnB,WAAW,EAAE,OAAO;QACpB,eAAe,EAAE,EAAE;KACpB,CAAC;IAEF,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAC9B,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,EAAE,OAAO,CAAC,CACtD,CAAC;IAEF,MAAM,cAAc,GAAG;QACrB,GAAG,aAAa;KACjB,CAAC;IAEF,OAAO,cAAc,CAAC,IAAI,CAAC;IAE3B,MAAM,SAAS,GAAG;QAChB,cAAc,EAAE,aAAa,CAAC,IAAI;QAClC,KAAK,EAAE,cAAc;KACtB,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;IAExC,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAC1C,SAAS,EACT,sBAAsB,CAAC,IAAI,EAC3B,WAAW,CACZ,CAAC;IAEF,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC;IACrE,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;IAE5C,MAAM,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE,UAAU,CAAC,CAAC;AAC/D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC","sourcesContent":["import { SupportedExportFormats, WebupManagerData } from \"./src/types/index.js\";\n//import { table_sample_1 } from \"./assets/sample-data.js\";\nimport path from \"path\";\nimport fs from \"fs/promises\";\nimport { dataTableToExcelData } from \"./src/excel/excel-generator.js\";\n\nasync function main() {\n const managerData: WebupManagerData = {\n mathLocale: \"it-IT\",\n datesLocale: \"it-IT\",\n themeBackground: \"\",\n };\n\n const dataTableJSON = JSON.parse(\n await fs.readFile(\"F:/temp/data-table.json\", \"utf-8\"),\n );\n\n const dataTableProps = {\n ...dataTableJSON,\n };\n\n delete dataTableProps.data;\n\n const dataTable = {\n smeupDataTable: dataTableJSON.data,\n props: dataTableProps,\n };\n\n console.log(\"Generating Excel data...\");\n\n const excelData = await dataTableToExcelData(\n dataTable,\n SupportedExportFormats.XLSX,\n managerData,\n );\n\n const outputPath = path.resolve(\"./output/sample-export-debug.xlsx\");\n console.log(\"Saving Excel to:\", outputPath);\n\n await fs.writeFile(outputPath, excelData);\n console.log(\"Excel file saved successfully at:\", outputPath);\n}\n\nmain().catch(console.error);\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { dataTableToExcelData, dataTreeToExcelData, } from "./src/excel/excel-generator.js";
|
|
2
|
+
export { schedaToPdfData } from "./src/pdf/pdf-generator.js";
|
|
3
|
+
export { dataTableToChart } from "./src/images/charts-generator.js";
|
|
4
|
+
export type { WebupManagerData, GenericObject } from "./src/types/index.js";
|
|
5
|
+
export { SupportedExportFormats } from "./src/types/index.js";
|
|
6
|
+
export type { SmeupDataTable, SmeupDataTree } from "@sme.up/kokos-sdk-node";
|
|
7
|
+
export type ColumnGroup = {
|
|
8
|
+
column: string;
|
|
9
|
+
visible: boolean;
|
|
10
|
+
};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Public API exports
|
|
2
|
+
export { dataTableToExcelData, dataTreeToExcelData, } from "./src/excel/excel-generator.js";
|
|
3
|
+
export { schedaToPdfData } from "./src/pdf/pdf-generator.js";
|
|
4
|
+
export { dataTableToChart } from "./src/images/charts-generator.js";
|
|
5
|
+
export { SupportedExportFormats } from "./src/types/index.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAKpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["// Public API exports\nexport {\n dataTableToExcelData,\n dataTreeToExcelData,\n} from \"./src/excel/excel-generator.js\";\n\nexport { schedaToPdfData } from \"./src/pdf/pdf-generator.js\";\n\nexport { dataTableToChart } from \"./src/images/charts-generator.js\";\n\n// Export types that users might need\nexport type { WebupManagerData, GenericObject } from \"./src/types/index.js\";\n\nexport { SupportedExportFormats } from \"./src/types/index.js\";\n\n// Re-export useful types from kokos-sdk-node if needed\nexport type { SmeupDataTable, SmeupDataTree } from \"@sme.up/kokos-sdk-node\";\n\nexport type ColumnGroup = {\n column: string;\n visible: boolean;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { mat_cha_data } from "../assets/sample-data.js";
|
|
2
|
+
import { dataTableToChart } from "../src/images/charts-generator.js";
|
|
3
|
+
describe("Charts Generator", () => {
|
|
4
|
+
describe("dataTableToChart", () => {
|
|
5
|
+
it.only("should generate a line chart from data table", async () => {
|
|
6
|
+
const chartBuffer = await dataTableToChart(mat_cha_data, "line", {
|
|
7
|
+
Width: "800",
|
|
8
|
+
Height: "600",
|
|
9
|
+
Name: "Default",
|
|
10
|
+
Series: "VALCAL|VALORI",
|
|
11
|
+
});
|
|
12
|
+
expect(chartBuffer).toBeInstanceOf(Buffer);
|
|
13
|
+
expect(chartBuffer.length).toBeGreaterThan(0);
|
|
14
|
+
// Check JPEG signature
|
|
15
|
+
const jpegSignature = Buffer.from([0xff, 0xd8, 0xff]);
|
|
16
|
+
expect(chartBuffer.subarray(0, 3)).toEqual(jpegSignature);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=charts-generator.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"charts-generator.test.js","sourceRoot":"","sources":["../../tests/charts-generator.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,EAAE,CAAC,IAAI,CAAC,8CAA8C,EAAE,KAAK,IAAI,EAAE;YACjE,MAAM,WAAW,GAAG,MAAM,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE;gBAC/D,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,SAAS;gBACf,MAAM,EAAE,eAAe;aACxB,CAAC,CAAC;YAEH,MAAM,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAC3C,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;YAE9C,uBAAuB;YACvB,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YACtD,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { mat_cha_data } from \"../assets/sample-data.js\";\nimport { dataTableToChart } from \"../src/images/charts-generator.js\";\n\ndescribe(\"Charts Generator\", () => {\n describe(\"dataTableToChart\", () => {\n it.only(\"should generate a line chart from data table\", async () => {\n const chartBuffer = await dataTableToChart(mat_cha_data, \"line\", {\n Width: \"800\",\n Height: \"600\",\n Name: \"Default\",\n Series: \"VALCAL|VALORI\",\n });\n\n expect(chartBuffer).toBeInstanceOf(Buffer);\n expect(chartBuffer.length).toBeGreaterThan(0);\n\n // Check JPEG signature\n const jpegSignature = Buffer.from([0xff, 0xd8, 0xff]);\n expect(chartBuffer.subarray(0, 3)).toEqual(jpegSignature);\n });\n });\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
import { addStyleToExceljsRow, dataTableToExcelWorkbook, getExcelNumFormat, } from "../src/index.js";
|
|
2
|
+
import { SupportedExportFormats, } from "../src/types/index.js";
|
|
3
|
+
import ExcelJS from "exceljs";
|
|
4
|
+
import { data_table_totals_result_sample_1, table_footer_actions, table_sample_1, table_sample_2, totals_sample_1, tree_grid_sample_1, } from "../assets/sample-data.js";
|
|
5
|
+
import { smeupFormulaToExcelFormula } from "../src/excel/commons.js";
|
|
6
|
+
import { dataTreeToExcelWorkbook } from "../src/excel/tree-generator.js";
|
|
7
|
+
const Workbook = ExcelJS.Workbook;
|
|
8
|
+
// #region Tests
|
|
9
|
+
describe("Export Manager Test", () => {
|
|
10
|
+
it("Formula conversion", () => {
|
|
11
|
+
const formulaExamples = {
|
|
12
|
+
["[N1]+[N2]"]: "A1+B1", // Row 1
|
|
13
|
+
["1+1"]: "1+1", // Row 2
|
|
14
|
+
["[N1]+[N2]+[N3]+[N4]"]: "A3+B3+C3+D3", // Row 3
|
|
15
|
+
["1,234+1,0001"]: "1.234+1.0001", // Row 4
|
|
16
|
+
["[N1]+[N2]-[N1]-[N2]"]: "A5+B5-A5-B5", // Row 5
|
|
17
|
+
["([N1]+[N2]/[N3]+[N4])/10"]: "(A6+B6/C6+D6)/10", // Row 6
|
|
18
|
+
["[N1]*[N2]"]: "A7*B7", // Row 7
|
|
19
|
+
["[N1]/0"]: "A8/0", // Row 8
|
|
20
|
+
["([N1]+[N2])-[N1]"]: "(A9+B9)-A9", // Row 9
|
|
21
|
+
["([N1]+[N120])"]: "(A10+DP10)", // Row 10
|
|
22
|
+
};
|
|
23
|
+
Object.keys(formulaExamples).forEach((smeupFormula, i) => {
|
|
24
|
+
expect(smeupFormulaToExcelFormula(smeupFormula, i, getColumns(120))).toBe(formulaExamples[smeupFormula]);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
it("Number format creation", () => {
|
|
28
|
+
const cellsFormatNumbers = [
|
|
29
|
+
{
|
|
30
|
+
data: {
|
|
31
|
+
decimals: 0,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
data: {
|
|
36
|
+
decimals: 1,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
data: {
|
|
41
|
+
decimals: 2,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
data: {
|
|
46
|
+
decimals: 3,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
data: {
|
|
51
|
+
decimals: 4,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
cellsFormatNumbers.forEach((cell, index) => {
|
|
56
|
+
const format = "0." + `${index > 0 ? "0".repeat(index) : "00"}`;
|
|
57
|
+
expect(getExcelNumFormat(cell.data?.decimals ?? 0, cell.data ?? 0)).toBe(format + ";[Red]-" + format);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
describe("SmeupDataTable export", () => {
|
|
61
|
+
it("xlsx format", async () => {
|
|
62
|
+
const workbook = dataTableToExcelWorkbook(table_sample_1, SupportedExportFormats.XLSX, {});
|
|
63
|
+
const worksheet = workbook.getWorksheet(1);
|
|
64
|
+
// Test number of columns
|
|
65
|
+
expect(worksheet?.columnCount).toBe(8);
|
|
66
|
+
// Test number of rows
|
|
67
|
+
expect(worksheet?.actualRowCount).toBe(3);
|
|
68
|
+
});
|
|
69
|
+
it("xlsx with frozen data to ensure immutability does not affect the export", async () => {
|
|
70
|
+
const workbook = dataTableToExcelWorkbook(Object.freeze(table_sample_1), SupportedExportFormats.XLSX, {});
|
|
71
|
+
const worksheet = workbook.getWorksheet(1);
|
|
72
|
+
// Test number of columns
|
|
73
|
+
expect(worksheet?.columnCount).toBe(8);
|
|
74
|
+
// Test number of rows
|
|
75
|
+
expect(worksheet?.actualRowCount).toBe(3);
|
|
76
|
+
});
|
|
77
|
+
it("csv format", async () => {
|
|
78
|
+
const workbook = dataTableToExcelWorkbook(table_sample_1, SupportedExportFormats.CSV, {});
|
|
79
|
+
const worksheet = workbook.getWorksheet(1);
|
|
80
|
+
// Test number of columns
|
|
81
|
+
expect(worksheet?.columnCount).toBe(8);
|
|
82
|
+
// Test number of rows
|
|
83
|
+
expect(worksheet?.actualRowCount).toBe(3);
|
|
84
|
+
});
|
|
85
|
+
it("txt format", async () => {
|
|
86
|
+
const workbook = dataTableToExcelWorkbook(table_sample_1, SupportedExportFormats.TXT, {});
|
|
87
|
+
const worksheet = workbook.getWorksheet(1);
|
|
88
|
+
// Test number of columns
|
|
89
|
+
expect(worksheet?.columnCount).toBe(8);
|
|
90
|
+
// Test number of rows
|
|
91
|
+
expect(worksheet?.actualRowCount).toBe(3);
|
|
92
|
+
});
|
|
93
|
+
it("With groups and outline 2 levels", async () => {
|
|
94
|
+
const workbook = dataTableToExcelWorkbook(table_sample_2, SupportedExportFormats.XLSX, {});
|
|
95
|
+
const worksheet = workbook.getWorksheet(1);
|
|
96
|
+
expect(worksheet?.getRow(2).outlineLevel).toBe(0);
|
|
97
|
+
expect(worksheet?.getRow(3).outlineLevel).toBe(1);
|
|
98
|
+
expect(worksheet?.getRow(4).outlineLevel).toBe(2);
|
|
99
|
+
expect(worksheet?.getRow(5).outlineLevel).toBe(0);
|
|
100
|
+
expect(worksheet?.getRow(6).outlineLevel).toBe(1);
|
|
101
|
+
expect(worksheet?.getRow(7).outlineLevel).toBe(2);
|
|
102
|
+
});
|
|
103
|
+
it("With the first group visibility set to false", async () => {
|
|
104
|
+
const first_grp_vis_false = JSON.parse(JSON.stringify(table_sample_2));
|
|
105
|
+
first_grp_vis_false.props.groups[0].visible = false;
|
|
106
|
+
const workbook = dataTableToExcelWorkbook(first_grp_vis_false, SupportedExportFormats.XLSX, {});
|
|
107
|
+
const worksheet = workbook.getWorksheet(1);
|
|
108
|
+
// The visibility of the first group does not affect the number of columns
|
|
109
|
+
expect(worksheet?.columnCount).toBe(3);
|
|
110
|
+
});
|
|
111
|
+
it("With the visibleColumns set", async () => {
|
|
112
|
+
const withVisibleColumns = JSON.parse(JSON.stringify(table_sample_2));
|
|
113
|
+
withVisibleColumns.props.visibleColumns = ["DSC", "1"];
|
|
114
|
+
const workbook = dataTableToExcelWorkbook(withVisibleColumns, SupportedExportFormats.XLSX, {});
|
|
115
|
+
const worksheet = workbook.getWorksheet(1);
|
|
116
|
+
expect(worksheet).toBeDefined();
|
|
117
|
+
expect(worksheet?.columnCount).toBe(2);
|
|
118
|
+
expect(worksheet?.getColumn(1).key).toBe("DSC");
|
|
119
|
+
expect(worksheet?.getColumn(2).key).toBe("1");
|
|
120
|
+
});
|
|
121
|
+
it("With totals", async () => {
|
|
122
|
+
const table_totals = JSON.parse(JSON.stringify(table_sample_1));
|
|
123
|
+
table_totals.props = {
|
|
124
|
+
...table_totals.props,
|
|
125
|
+
totals: totals_sample_1,
|
|
126
|
+
};
|
|
127
|
+
const workbook = dataTableToExcelWorkbook(table_totals, SupportedExportFormats.XLSX, {});
|
|
128
|
+
const worksheet = workbook.getWorksheet(1);
|
|
129
|
+
// Test number of columns
|
|
130
|
+
expect(worksheet?.columnCount).toBe(8);
|
|
131
|
+
// Test number of rows
|
|
132
|
+
expect(worksheet?.rowCount).toBe(4);
|
|
133
|
+
// Check totals row
|
|
134
|
+
worksheet?.getRow(4).eachCell((cell) => {
|
|
135
|
+
const columnName = worksheet?.getColumn(cell.col).key;
|
|
136
|
+
if (columnName !== undefined) {
|
|
137
|
+
expect(cell.formula).toBe(data_table_totals_result_sample_1[columnName]);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
it("With groups subtotals correct range and action", () => {
|
|
142
|
+
const totalsExpectedFormula = {
|
|
143
|
+
Count: "SUBTOTAL(3,C2:C2)",
|
|
144
|
+
Sum: "SUBTOTAL(9,C2:C2)",
|
|
145
|
+
Max: "SUBTOTAL(4,C2:C2)",
|
|
146
|
+
Min: "SUBTOTAL(5,C2:C2)",
|
|
147
|
+
Average: "SUBTOTAL(1,C2:C2)",
|
|
148
|
+
};
|
|
149
|
+
const totalsExpectedSubAction = {
|
|
150
|
+
Count: "3",
|
|
151
|
+
Sum: "9",
|
|
152
|
+
Max: "4",
|
|
153
|
+
Min: "5",
|
|
154
|
+
Average: "1",
|
|
155
|
+
};
|
|
156
|
+
Object.keys(totalsExpectedFormula).forEach(async (total) => {
|
|
157
|
+
const workbook = dataTableToExcelWorkbook(table_footer_actions(total, [
|
|
158
|
+
{ column: "1", visible: true },
|
|
159
|
+
{ column: "2", visible: true },
|
|
160
|
+
], 2, 2), SupportedExportFormats.XLSX, {});
|
|
161
|
+
const worksheet = workbook.getWorksheet(1);
|
|
162
|
+
const totalKey = total;
|
|
163
|
+
expect(worksheet?.getRow(2).getCell(3).formula).toBe(`SUBTOTAL(${totalsExpectedSubAction[totalKey]},C3:C5)`);
|
|
164
|
+
expect(worksheet?.getRow(3).getCell(3).formula).toBe(`SUBTOTAL(${totalsExpectedSubAction[totalKey]},C4:C5)`);
|
|
165
|
+
expect(worksheet?.getRow(6).getCell(3).formula).toBe(`SUBTOTAL(${totalsExpectedSubAction[totalKey]},C7:C9)`);
|
|
166
|
+
expect(worksheet?.getRow(7).getCell(3).formula).toBe(`SUBTOTAL(${totalsExpectedSubAction[totalKey]},C8:C9)`);
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
describe("SmeupDataTree export - with levels split", () => {
|
|
171
|
+
it("xlsx format - with levels split", async () => {
|
|
172
|
+
const workbook = await dataTreeToExcelWorkbook(tree_grid_sample_1, SupportedExportFormats.XLSX, {}, true);
|
|
173
|
+
const worksheet = workbook.getWorksheet(1);
|
|
174
|
+
expect(worksheet).toBeTruthy();
|
|
175
|
+
// Test number of columns -> all tree nodes are under the same column with indentation
|
|
176
|
+
expect(worksheet?.columnCount).toBe(11);
|
|
177
|
+
// Test number of rows
|
|
178
|
+
expect(worksheet?.actualRowCount).toBe(6);
|
|
179
|
+
});
|
|
180
|
+
it("xlsx format with split nodes to columns - with levels split", async () => {
|
|
181
|
+
const workbook = await dataTreeToExcelWorkbook(tree_grid_sample_1, SupportedExportFormats.XLSX, {}, true);
|
|
182
|
+
const worksheet = workbook.getWorksheet(1);
|
|
183
|
+
expect(worksheet).toBeTruthy();
|
|
184
|
+
// Test number of columns -> new column for each tree node
|
|
185
|
+
expect(worksheet?.columnCount).toBe(11);
|
|
186
|
+
// Test number of rows
|
|
187
|
+
expect(worksheet?.actualRowCount).toBe(6);
|
|
188
|
+
});
|
|
189
|
+
it("csv format - with levels split", async () => {
|
|
190
|
+
const workbook = await dataTreeToExcelWorkbook(tree_grid_sample_1, SupportedExportFormats.CSV, {}, true);
|
|
191
|
+
const worksheet = workbook.getWorksheet(1);
|
|
192
|
+
expect(worksheet).toBeDefined();
|
|
193
|
+
expect(worksheet).not.toBeNull();
|
|
194
|
+
// Test number of columns -> all tree nodes are under the same column with indentation
|
|
195
|
+
expect(worksheet?.columnCount).toBe(11);
|
|
196
|
+
// Test number of rows
|
|
197
|
+
expect(worksheet?.actualRowCount).toBe(6);
|
|
198
|
+
});
|
|
199
|
+
it("txt format - with levels split", async () => {
|
|
200
|
+
const workbook = await dataTreeToExcelWorkbook(tree_grid_sample_1, SupportedExportFormats.TXT, {}, true);
|
|
201
|
+
const worksheet = workbook.getWorksheet(1);
|
|
202
|
+
expect(worksheet).toBeTruthy();
|
|
203
|
+
// Test number of columns -> all tree nodes are under the same column with indentation
|
|
204
|
+
expect(worksheet?.columnCount).toBe(11);
|
|
205
|
+
// Test number of rows
|
|
206
|
+
expect(worksheet?.actualRowCount).toBe(6);
|
|
207
|
+
});
|
|
208
|
+
it("With totals - with levels split", async () => {
|
|
209
|
+
const tree_grid_totals = JSON.parse(JSON.stringify(tree_grid_sample_1));
|
|
210
|
+
tree_grid_totals.props = {
|
|
211
|
+
...tree_grid_totals.props,
|
|
212
|
+
totals: totals_sample_1,
|
|
213
|
+
};
|
|
214
|
+
const tree_grid_totals_result_sample_1 = {
|
|
215
|
+
COL1: "SUBTOTAL(3,D2:D6)",
|
|
216
|
+
HIDDEN_COL: "SUBTOTAL(9,F2:F6)",
|
|
217
|
+
SUM_COL: "SUBTOTAL(9,G2:G6)",
|
|
218
|
+
AVG_COL: "SUBTOTAL(1,H2:H6)",
|
|
219
|
+
MIN_COL: "SUBTOTAL(5,I2:I6)",
|
|
220
|
+
MAX_COL: "SUBTOTAL(4,J2:J6)",
|
|
221
|
+
DIFF_COL: `(F7-G7)`,
|
|
222
|
+
};
|
|
223
|
+
const workbook = await dataTreeToExcelWorkbook(tree_grid_totals, SupportedExportFormats.XLSX, {}, true);
|
|
224
|
+
const worksheet = workbook.getWorksheet(1);
|
|
225
|
+
expect(worksheet).toBeTruthy();
|
|
226
|
+
// Test number of columns
|
|
227
|
+
expect(worksheet?.columnCount).toBe(11);
|
|
228
|
+
// Test number of rows
|
|
229
|
+
expect(worksheet?.rowCount).toBe(7);
|
|
230
|
+
// Check totals row
|
|
231
|
+
worksheet?.getRow(7).eachCell((cell) => {
|
|
232
|
+
const columnName = worksheet?.getColumn(cell.col).key;
|
|
233
|
+
if (columnName) {
|
|
234
|
+
expect(cell.formula).toBe(tree_grid_totals_result_sample_1[columnName]);
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
it("With split nodes to columns and totals", async () => {
|
|
239
|
+
const tree_grid_totals = JSON.parse(JSON.stringify(tree_grid_sample_1));
|
|
240
|
+
tree_grid_totals.props = {
|
|
241
|
+
...tree_grid_totals.props,
|
|
242
|
+
totals: totals_sample_1,
|
|
243
|
+
};
|
|
244
|
+
const tree_grid_totals_result_sample_1 = {
|
|
245
|
+
COL1: "SUBTOTAL(3,D2:D6)",
|
|
246
|
+
HIDDEN_COL: "SUBTOTAL(9,F2:F6)",
|
|
247
|
+
SUM_COL: "SUBTOTAL(9,G2:G6)",
|
|
248
|
+
AVG_COL: "SUBTOTAL(1,H2:H6)",
|
|
249
|
+
MIN_COL: "SUBTOTAL(5,I2:I6)",
|
|
250
|
+
MAX_COL: "SUBTOTAL(4,J2:J6)",
|
|
251
|
+
DIFF_COL: `(F7-G7)`,
|
|
252
|
+
};
|
|
253
|
+
const workbook = await dataTreeToExcelWorkbook(tree_grid_totals, SupportedExportFormats.XLSX, {}, true);
|
|
254
|
+
const worksheet = workbook.getWorksheet(1);
|
|
255
|
+
expect(worksheet).toBeTruthy();
|
|
256
|
+
// Test number of columns
|
|
257
|
+
expect(worksheet?.columnCount).toBe(11);
|
|
258
|
+
// Test number of rows
|
|
259
|
+
expect(worksheet?.rowCount).toBe(7);
|
|
260
|
+
// Check totals row
|
|
261
|
+
worksheet?.getRow(7).eachCell((cell) => {
|
|
262
|
+
const columnName = worksheet.getColumn(cell.col).key;
|
|
263
|
+
expect(columnName).toBeTruthy();
|
|
264
|
+
if (columnName) {
|
|
265
|
+
expect(cell.formula).toBe(tree_grid_totals_result_sample_1[columnName]);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
describe("SmeupDataTree export - no levels split", () => {
|
|
271
|
+
it("xlsx format - no levels split", async () => {
|
|
272
|
+
const workbook = await dataTreeToExcelWorkbook(tree_grid_sample_1, SupportedExportFormats.XLSX, {}, false);
|
|
273
|
+
const worksheet = workbook.getWorksheet(1);
|
|
274
|
+
expect(worksheet).toBeTruthy();
|
|
275
|
+
// Test number of columns -> all tree nodes are under the same column with indentation
|
|
276
|
+
expect(worksheet?.columnCount).toBe(9);
|
|
277
|
+
// Test number of rows
|
|
278
|
+
expect(worksheet?.actualRowCount).toBe(6);
|
|
279
|
+
});
|
|
280
|
+
it("xlsx format with split nodes to columns - no levels split", async () => {
|
|
281
|
+
const workbook = await dataTreeToExcelWorkbook(tree_grid_sample_1, SupportedExportFormats.XLSX, {}, false);
|
|
282
|
+
const worksheet = workbook.getWorksheet(1);
|
|
283
|
+
expect(worksheet).toBeTruthy();
|
|
284
|
+
// Test number of columns -> new column for each tree node
|
|
285
|
+
expect(worksheet?.columnCount).toBe(9);
|
|
286
|
+
// Test number of rows
|
|
287
|
+
expect(worksheet?.actualRowCount).toBe(6);
|
|
288
|
+
});
|
|
289
|
+
it("csv format - no levels split", async () => {
|
|
290
|
+
const workbook = await dataTreeToExcelWorkbook(tree_grid_sample_1, SupportedExportFormats.CSV, {}, false);
|
|
291
|
+
const worksheet = workbook.getWorksheet(1);
|
|
292
|
+
expect(worksheet).toBeTruthy();
|
|
293
|
+
// Test number of columns -> all tree nodes are under the same column with indentation
|
|
294
|
+
expect(worksheet?.columnCount).toBe(9);
|
|
295
|
+
// Test number of rows
|
|
296
|
+
expect(worksheet?.actualRowCount).toBe(6);
|
|
297
|
+
});
|
|
298
|
+
it("txt format - no levels split", async () => {
|
|
299
|
+
const workbook = await dataTreeToExcelWorkbook(tree_grid_sample_1, SupportedExportFormats.TXT, {}, false);
|
|
300
|
+
const worksheet = workbook.getWorksheet(1);
|
|
301
|
+
expect(worksheet).toBeTruthy();
|
|
302
|
+
// Test number of columns -> all tree nodes are under the same column with indentation
|
|
303
|
+
expect(worksheet?.columnCount).toBe(9);
|
|
304
|
+
// Test number of rows
|
|
305
|
+
expect(worksheet?.actualRowCount).toBe(6);
|
|
306
|
+
});
|
|
307
|
+
it("With totals - no levels split", async () => {
|
|
308
|
+
const tree_grid_totals = JSON.parse(JSON.stringify(tree_grid_sample_1));
|
|
309
|
+
tree_grid_totals.props = {
|
|
310
|
+
...tree_grid_totals.props,
|
|
311
|
+
totals: totals_sample_1,
|
|
312
|
+
};
|
|
313
|
+
const tree_grid_totals_result_sample_1 = {
|
|
314
|
+
COL1: "SUBTOTAL(3,B2:B6)",
|
|
315
|
+
HIDDEN_COL: "SUBTOTAL(9,D2:D6)",
|
|
316
|
+
SUM_COL: "SUBTOTAL(9,E2:E6)",
|
|
317
|
+
AVG_COL: "SUBTOTAL(1,F2:F6)",
|
|
318
|
+
MIN_COL: "SUBTOTAL(5,G2:G6)",
|
|
319
|
+
MAX_COL: "SUBTOTAL(4,H2:H6)",
|
|
320
|
+
DIFF_COL: `(D7-E7)`,
|
|
321
|
+
};
|
|
322
|
+
const workbook = await dataTreeToExcelWorkbook(tree_grid_totals, SupportedExportFormats.XLSX, {}, false);
|
|
323
|
+
const worksheet = workbook.getWorksheet(1);
|
|
324
|
+
expect(worksheet).toBeTruthy();
|
|
325
|
+
// Test number of columns
|
|
326
|
+
expect(worksheet?.columnCount).toBe(9);
|
|
327
|
+
// Test number of rows
|
|
328
|
+
expect(worksheet?.rowCount).toBe(7);
|
|
329
|
+
// Check totals row
|
|
330
|
+
worksheet?.getRow(7).eachCell((cell) => {
|
|
331
|
+
const columnName = worksheet.getColumn(cell.col).key;
|
|
332
|
+
expect(columnName).toBeTruthy();
|
|
333
|
+
if (columnName) {
|
|
334
|
+
expect(cell.formula).toBe(tree_grid_totals_result_sample_1[columnName]);
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
|
+
describe("Cell to XLSX Style converter", () => {
|
|
341
|
+
const cellStyle = {
|
|
342
|
+
fontWeight: "bold",
|
|
343
|
+
backgroundColor: "#74c0f2",
|
|
344
|
+
color: "#000000",
|
|
345
|
+
};
|
|
346
|
+
const cellResult = {
|
|
347
|
+
fill: {
|
|
348
|
+
type: "pattern",
|
|
349
|
+
pattern: "solid",
|
|
350
|
+
fgColor: { argb: "FF74c0f2" },
|
|
351
|
+
},
|
|
352
|
+
font: { bold: true, color: { argb: "FF000000" } },
|
|
353
|
+
};
|
|
354
|
+
it("SmeupDataCell - Style calculations", async () => {
|
|
355
|
+
const workbook = new Workbook();
|
|
356
|
+
const worksheet = workbook.addWorksheet("Sheet 1");
|
|
357
|
+
const row = worksheet.addRow(["Mario Rossi"]);
|
|
358
|
+
addStyleToExceljsRow(row, [{ name: "A", title: "A" }], {
|
|
359
|
+
cells: {
|
|
360
|
+
A: {
|
|
361
|
+
value: "",
|
|
362
|
+
obj: {
|
|
363
|
+
t: "",
|
|
364
|
+
p: "",
|
|
365
|
+
k: "",
|
|
366
|
+
},
|
|
367
|
+
style: cellStyle,
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
});
|
|
371
|
+
expect(row.getCell(1).style).toStrictEqual(cellResult);
|
|
372
|
+
});
|
|
373
|
+
it("SmeupDataNode - Style calculations", async () => {
|
|
374
|
+
const workbook = new Workbook();
|
|
375
|
+
const worksheet = workbook.addWorksheet("Sheet 1");
|
|
376
|
+
const row = worksheet.addRow(["Mario Rossi"]);
|
|
377
|
+
addStyleToExceljsRow(row, [{ name: "A", title: "A" }], {
|
|
378
|
+
cells: {
|
|
379
|
+
A: {
|
|
380
|
+
value: "",
|
|
381
|
+
obj: {
|
|
382
|
+
t: "",
|
|
383
|
+
p: "",
|
|
384
|
+
k: "",
|
|
385
|
+
},
|
|
386
|
+
style: {},
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
style: cellStyle,
|
|
390
|
+
});
|
|
391
|
+
expect(row.getCell(1).style).toStrictEqual(cellResult);
|
|
392
|
+
});
|
|
393
|
+
});
|
|
394
|
+
// #endregion
|
|
395
|
+
// #region Assets
|
|
396
|
+
const getColumns = (numberColumns) => {
|
|
397
|
+
const columns = [];
|
|
398
|
+
for (let num = 1; num <= numberColumns; num++) {
|
|
399
|
+
columns.push({
|
|
400
|
+
name: `N${num}`,
|
|
401
|
+
title: "",
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
return columns;
|
|
405
|
+
};
|
|
406
|
+
//# sourceMappingURL=excel-generator.test.js.map
|