sa2kit 1.6.98 → 1.6.101
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 +61 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -1
- package/dist/index.mjs.map +1 -1
- package/dist/showmasterpiece/index.js +61 -1
- package/dist/showmasterpiece/index.js.map +1 -1
- package/dist/showmasterpiece/index.mjs +61 -1
- package/dist/showmasterpiece/index.mjs.map +1 -1
- package/dist/showmasterpiece/ui/web/index.js +61 -1
- package/dist/showmasterpiece/ui/web/index.js.map +1 -1
- package/dist/showmasterpiece/ui/web/index.mjs +61 -1
- package/dist/showmasterpiece/ui/web/index.mjs.map +1 -1
- package/dist/showmasterpiece/web/index.js +61 -1
- package/dist/showmasterpiece/web/index.js.map +1 -1
- package/dist/showmasterpiece/web/index.mjs +61 -1
- package/dist/showmasterpiece/web/index.mjs.map +1 -1
- package/dist/universalExport/index.d.mts +8 -0
- package/dist/universalExport/index.d.ts +8 -0
- package/dist/universalExport/index.js +61 -1
- package/dist/universalExport/index.js.map +1 -1
- package/dist/universalExport/index.mjs +61 -1
- package/dist/universalExport/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -15844,7 +15844,6 @@ var UniversalExportClient = class {
|
|
|
15844
15844
|
try {
|
|
15845
15845
|
const isDataArray = Array.isArray(request.dataSource);
|
|
15846
15846
|
const requestBody = {
|
|
15847
|
-
configId: request.configId,
|
|
15848
15847
|
queryParams: request.queryParams,
|
|
15849
15848
|
fieldMapping: request.fieldMapping,
|
|
15850
15849
|
filters: request.filters,
|
|
@@ -15852,6 +15851,14 @@ var UniversalExportClient = class {
|
|
|
15852
15851
|
pagination: request.pagination,
|
|
15853
15852
|
customFileName: request.customFileName
|
|
15854
15853
|
};
|
|
15854
|
+
if (typeof request.configId === "string") {
|
|
15855
|
+
requestBody.configId = request.configId;
|
|
15856
|
+
} else {
|
|
15857
|
+
requestBody.config = request.configId;
|
|
15858
|
+
if (request.configId?.id) {
|
|
15859
|
+
requestBody.configId = request.configId.id;
|
|
15860
|
+
}
|
|
15861
|
+
}
|
|
15855
15862
|
if (isDataArray) {
|
|
15856
15863
|
requestBody.data = request.dataSource;
|
|
15857
15864
|
} else {
|
|
@@ -15997,11 +16004,13 @@ var UniversalExportClient = class {
|
|
|
15997
16004
|
* 转换API返回的导出结果
|
|
15998
16005
|
*/
|
|
15999
16006
|
transformExportResultFromAPI(apiResult) {
|
|
16007
|
+
const fileBlob = this.createFileBlobFromBase64(apiResult.fileData, apiResult.fileName);
|
|
16000
16008
|
return {
|
|
16001
16009
|
exportId: apiResult.exportId,
|
|
16002
16010
|
fileName: apiResult.fileName,
|
|
16003
16011
|
fileSize: apiResult.fileSize,
|
|
16004
16012
|
fileUrl: apiResult.fileUrl,
|
|
16013
|
+
fileBlob,
|
|
16005
16014
|
exportedRows: apiResult.exportedRows,
|
|
16006
16015
|
startTime: new Date(apiResult.startTime),
|
|
16007
16016
|
endTime: new Date(apiResult.endTime),
|
|
@@ -16009,6 +16018,57 @@ var UniversalExportClient = class {
|
|
|
16009
16018
|
statistics: apiResult.statistics
|
|
16010
16019
|
};
|
|
16011
16020
|
}
|
|
16021
|
+
/**
|
|
16022
|
+
* 将后端返回的base64文件数据转换为Blob
|
|
16023
|
+
*/
|
|
16024
|
+
createFileBlobFromBase64(fileData, fileName) {
|
|
16025
|
+
if (!fileData || typeof fileData !== "string") {
|
|
16026
|
+
return void 0;
|
|
16027
|
+
}
|
|
16028
|
+
try {
|
|
16029
|
+
if (typeof atob === "function") {
|
|
16030
|
+
const binaryString = atob(fileData);
|
|
16031
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
16032
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
16033
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
16034
|
+
}
|
|
16035
|
+
const arrayBuffer = bytes.buffer.slice(
|
|
16036
|
+
bytes.byteOffset,
|
|
16037
|
+
bytes.byteOffset + bytes.byteLength
|
|
16038
|
+
);
|
|
16039
|
+
return new Blob([arrayBuffer], { type: this.getMimeTypeByFileName(fileName) });
|
|
16040
|
+
} else if (typeof Buffer !== "undefined") {
|
|
16041
|
+
const bufferBytes = Buffer.from(fileData, "base64");
|
|
16042
|
+
const bytes = Uint8Array.from(bufferBytes);
|
|
16043
|
+
const arrayBuffer = bytes.buffer.slice(
|
|
16044
|
+
bytes.byteOffset,
|
|
16045
|
+
bytes.byteOffset + bytes.byteLength
|
|
16046
|
+
);
|
|
16047
|
+
return new Blob([arrayBuffer], { type: this.getMimeTypeByFileName(fileName) });
|
|
16048
|
+
} else {
|
|
16049
|
+
return void 0;
|
|
16050
|
+
}
|
|
16051
|
+
} catch {
|
|
16052
|
+
return void 0;
|
|
16053
|
+
}
|
|
16054
|
+
}
|
|
16055
|
+
/**
|
|
16056
|
+
* 根据文件名推断MIME类型
|
|
16057
|
+
*/
|
|
16058
|
+
getMimeTypeByFileName(fileName) {
|
|
16059
|
+
const extension = fileName?.split(".").pop()?.toLowerCase();
|
|
16060
|
+
switch (extension) {
|
|
16061
|
+
case "csv":
|
|
16062
|
+
return "text/csv; charset=utf-8";
|
|
16063
|
+
case "xlsx":
|
|
16064
|
+
case "xls":
|
|
16065
|
+
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
16066
|
+
case "json":
|
|
16067
|
+
return "application/json; charset=utf-8";
|
|
16068
|
+
default:
|
|
16069
|
+
return "application/octet-stream";
|
|
16070
|
+
}
|
|
16071
|
+
}
|
|
16012
16072
|
/**
|
|
16013
16073
|
* 转换API返回的进度数据
|
|
16014
16074
|
*/
|