@mcurros2/microm 1.1.122-0 → 1.1.124-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.d.ts.map +1 -1
- package/dist/index.js +28 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2979,7 +2979,7 @@ function $5be4b35862a9dc4d$export$a04f965200623e61(data, notExportableColumns, s
|
|
|
2979
2979
|
const worksheet = workbook.addWorksheet(sheetNames ? sheetNames[index] : `Data ${index + 1}`);
|
|
2980
2980
|
const exportableColumnsConfig = [];
|
|
2981
2981
|
result.Header.forEach((header, colIndex)=>{
|
|
2982
|
-
if (notExportableColumns === null || notExportableColumns === void 0 ? void 0 : notExportableColumns.includes(colIndex)) exportableColumnsConfig.push({
|
|
2982
|
+
if (!(notExportableColumns === null || notExportableColumns === void 0 ? void 0 : notExportableColumns.includes(colIndex))) exportableColumnsConfig.push({
|
|
2983
2983
|
header: header,
|
|
2984
2984
|
key: header,
|
|
2985
2985
|
originalIndex: colIndex
|
|
@@ -3025,8 +3025,33 @@ function $5be4b35862a9dc4d$export$a04f965200623e61(data, notExportableColumns, s
|
|
|
3025
3025
|
}
|
|
3026
3026
|
});
|
|
3027
3027
|
result.records.forEach((row)=>{
|
|
3028
|
-
const
|
|
3029
|
-
|
|
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();
|