aq-fe-framework 0.1.693 → 0.1.694

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.
@@ -220,6 +220,26 @@ async function utils_excel_parseToJson(file, titleIndex, dataStartIndex) {
220
220
  headers
221
221
  };
222
222
  }
223
+ function utils_excel_handleExport(data, exportConfig, fileName) {
224
+ const processedData = data.map((row) => {
225
+ const newRow = {};
226
+ exportConfig.fields.forEach(({ fieldName, formatFunction }) => {
227
+ const value = row[fieldName];
228
+ newRow[fieldName] = formatFunction ? formatFunction(value, row) : value;
229
+ });
230
+ return newRow;
231
+ });
232
+ const headers = {};
233
+ exportConfig.fields.forEach(({ fieldName, header }) => {
234
+ headers[fieldName] = header;
235
+ });
236
+ const worksheet = XLSX.utils.json_to_sheet(processedData);
237
+ const headerRow = exportConfig.fields.map(({ fieldName }) => headers[fieldName]);
238
+ XLSX.utils.sheet_add_aoa(worksheet, [headerRow], { origin: "A1" });
239
+ const workbook = XLSX.utils.book_new();
240
+ XLSX.utils.book_append_sheet(workbook, worksheet, "Exported Data");
241
+ XLSX.writeFile(workbook, `${fileName}.xlsx`);
242
+ }
223
243
 
224
244
  // src/utils/utils_field.ts
225
245
  function utils_field_extractAQBaseField(values) {
@@ -477,6 +497,7 @@ export {
477
497
  utils_excel_exportExcel,
478
498
  utils_excel_download,
479
499
  utils_excel_parseToJson,
500
+ utils_excel_handleExport,
480
501
  utils_field_extractAQBaseField,
481
502
  utils_file_fileToAQDocumentType,
482
503
  utils_file_AQDocumentTypeToFile,