@mcurros2/microm 1.1.122-0 → 1.1.123-0

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/index.js CHANGED
@@ -3025,8 +3025,33 @@ function $5be4b35862a9dc4d$export$a04f965200623e61(data, notExportableColumns, s
3025
3025
  }
3026
3026
  });
3027
3027
  result.records.forEach((row)=>{
3028
- const filteredRow = row.filter((_, index)=>!(notExportableColumns === null || notExportableColumns === void 0 ? void 0 : notExportableColumns.includes(index)));
3029
- worksheet.addRow(filteredRow);
3028
+ const rowForExcel = {};
3029
+ exportableColumnsConfig.forEach((colInfo)=>{
3030
+ const originalValue = row[colInfo.originalIndex];
3031
+ let processedValue = originalValue;
3032
+ const columnType = result.typeInfo[colInfo.originalIndex];
3033
+ if (processedValue !== null) switch(columnType){
3034
+ case "date":
3035
+ case "datetime":
3036
+ case "datetime2":
3037
+ case "smalldatetime":
3038
+ case "time":
3039
+ if (typeof processedValue === "string") try {
3040
+ const dateObj = new Date(processedValue);
3041
+ if (!isNaN(dateObj.getTime())) processedValue = dateObj;
3042
+ else console.warn(`Invalid date string "${processedValue}" for column "${colInfo.header}". Keeping as string.`);
3043
+ } catch (e) {
3044
+ console.error(`Error parsing date string "${processedValue}" for column "${colInfo.header}":`, e);
3045
+ }
3046
+ break;
3047
+ case "bit":
3048
+ if (processedValue === 0) processedValue = false;
3049
+ else if (processedValue === 1) processedValue = true;
3050
+ break;
3051
+ }
3052
+ rowForExcel[colInfo.key] = processedValue;
3053
+ });
3054
+ worksheet.addRow(rowForExcel);
3030
3055
  });
3031
3056
  });
3032
3057
  const buffer = yield workbook.xlsx.writeBuffer();