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.js
CHANGED
|
@@ -15873,7 +15873,6 @@ var UniversalExportClient = class {
|
|
|
15873
15873
|
try {
|
|
15874
15874
|
const isDataArray = Array.isArray(request.dataSource);
|
|
15875
15875
|
const requestBody = {
|
|
15876
|
-
configId: request.configId,
|
|
15877
15876
|
queryParams: request.queryParams,
|
|
15878
15877
|
fieldMapping: request.fieldMapping,
|
|
15879
15878
|
filters: request.filters,
|
|
@@ -15881,6 +15880,14 @@ var UniversalExportClient = class {
|
|
|
15881
15880
|
pagination: request.pagination,
|
|
15882
15881
|
customFileName: request.customFileName
|
|
15883
15882
|
};
|
|
15883
|
+
if (typeof request.configId === "string") {
|
|
15884
|
+
requestBody.configId = request.configId;
|
|
15885
|
+
} else {
|
|
15886
|
+
requestBody.config = request.configId;
|
|
15887
|
+
if (request.configId?.id) {
|
|
15888
|
+
requestBody.configId = request.configId.id;
|
|
15889
|
+
}
|
|
15890
|
+
}
|
|
15884
15891
|
if (isDataArray) {
|
|
15885
15892
|
requestBody.data = request.dataSource;
|
|
15886
15893
|
} else {
|
|
@@ -16026,11 +16033,13 @@ var UniversalExportClient = class {
|
|
|
16026
16033
|
* 转换API返回的导出结果
|
|
16027
16034
|
*/
|
|
16028
16035
|
transformExportResultFromAPI(apiResult) {
|
|
16036
|
+
const fileBlob = this.createFileBlobFromBase64(apiResult.fileData, apiResult.fileName);
|
|
16029
16037
|
return {
|
|
16030
16038
|
exportId: apiResult.exportId,
|
|
16031
16039
|
fileName: apiResult.fileName,
|
|
16032
16040
|
fileSize: apiResult.fileSize,
|
|
16033
16041
|
fileUrl: apiResult.fileUrl,
|
|
16042
|
+
fileBlob,
|
|
16034
16043
|
exportedRows: apiResult.exportedRows,
|
|
16035
16044
|
startTime: new Date(apiResult.startTime),
|
|
16036
16045
|
endTime: new Date(apiResult.endTime),
|
|
@@ -16038,6 +16047,57 @@ var UniversalExportClient = class {
|
|
|
16038
16047
|
statistics: apiResult.statistics
|
|
16039
16048
|
};
|
|
16040
16049
|
}
|
|
16050
|
+
/**
|
|
16051
|
+
* 将后端返回的base64文件数据转换为Blob
|
|
16052
|
+
*/
|
|
16053
|
+
createFileBlobFromBase64(fileData, fileName) {
|
|
16054
|
+
if (!fileData || typeof fileData !== "string") {
|
|
16055
|
+
return void 0;
|
|
16056
|
+
}
|
|
16057
|
+
try {
|
|
16058
|
+
if (typeof atob === "function") {
|
|
16059
|
+
const binaryString = atob(fileData);
|
|
16060
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
16061
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
16062
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
16063
|
+
}
|
|
16064
|
+
const arrayBuffer = bytes.buffer.slice(
|
|
16065
|
+
bytes.byteOffset,
|
|
16066
|
+
bytes.byteOffset + bytes.byteLength
|
|
16067
|
+
);
|
|
16068
|
+
return new Blob([arrayBuffer], { type: this.getMimeTypeByFileName(fileName) });
|
|
16069
|
+
} else if (typeof Buffer !== "undefined") {
|
|
16070
|
+
const bufferBytes = Buffer.from(fileData, "base64");
|
|
16071
|
+
const bytes = Uint8Array.from(bufferBytes);
|
|
16072
|
+
const arrayBuffer = bytes.buffer.slice(
|
|
16073
|
+
bytes.byteOffset,
|
|
16074
|
+
bytes.byteOffset + bytes.byteLength
|
|
16075
|
+
);
|
|
16076
|
+
return new Blob([arrayBuffer], { type: this.getMimeTypeByFileName(fileName) });
|
|
16077
|
+
} else {
|
|
16078
|
+
return void 0;
|
|
16079
|
+
}
|
|
16080
|
+
} catch {
|
|
16081
|
+
return void 0;
|
|
16082
|
+
}
|
|
16083
|
+
}
|
|
16084
|
+
/**
|
|
16085
|
+
* 根据文件名推断MIME类型
|
|
16086
|
+
*/
|
|
16087
|
+
getMimeTypeByFileName(fileName) {
|
|
16088
|
+
const extension = fileName?.split(".").pop()?.toLowerCase();
|
|
16089
|
+
switch (extension) {
|
|
16090
|
+
case "csv":
|
|
16091
|
+
return "text/csv; charset=utf-8";
|
|
16092
|
+
case "xlsx":
|
|
16093
|
+
case "xls":
|
|
16094
|
+
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
16095
|
+
case "json":
|
|
16096
|
+
return "application/json; charset=utf-8";
|
|
16097
|
+
default:
|
|
16098
|
+
return "application/octet-stream";
|
|
16099
|
+
}
|
|
16100
|
+
}
|
|
16041
16101
|
/**
|
|
16042
16102
|
* 转换API返回的进度数据
|
|
16043
16103
|
*/
|