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
|
@@ -7308,7 +7308,6 @@ var UniversalExportClient = class {
|
|
|
7308
7308
|
try {
|
|
7309
7309
|
const isDataArray = Array.isArray(request.dataSource);
|
|
7310
7310
|
const requestBody = {
|
|
7311
|
-
configId: request.configId,
|
|
7312
7311
|
queryParams: request.queryParams,
|
|
7313
7312
|
fieldMapping: request.fieldMapping,
|
|
7314
7313
|
filters: request.filters,
|
|
@@ -7316,6 +7315,14 @@ var UniversalExportClient = class {
|
|
|
7316
7315
|
pagination: request.pagination,
|
|
7317
7316
|
customFileName: request.customFileName
|
|
7318
7317
|
};
|
|
7318
|
+
if (typeof request.configId === "string") {
|
|
7319
|
+
requestBody.configId = request.configId;
|
|
7320
|
+
} else {
|
|
7321
|
+
requestBody.config = request.configId;
|
|
7322
|
+
if (request.configId?.id) {
|
|
7323
|
+
requestBody.configId = request.configId.id;
|
|
7324
|
+
}
|
|
7325
|
+
}
|
|
7319
7326
|
if (isDataArray) {
|
|
7320
7327
|
requestBody.data = request.dataSource;
|
|
7321
7328
|
} else {
|
|
@@ -7461,11 +7468,13 @@ var UniversalExportClient = class {
|
|
|
7461
7468
|
* 转换API返回的导出结果
|
|
7462
7469
|
*/
|
|
7463
7470
|
transformExportResultFromAPI(apiResult) {
|
|
7471
|
+
const fileBlob = this.createFileBlobFromBase64(apiResult.fileData, apiResult.fileName);
|
|
7464
7472
|
return {
|
|
7465
7473
|
exportId: apiResult.exportId,
|
|
7466
7474
|
fileName: apiResult.fileName,
|
|
7467
7475
|
fileSize: apiResult.fileSize,
|
|
7468
7476
|
fileUrl: apiResult.fileUrl,
|
|
7477
|
+
fileBlob,
|
|
7469
7478
|
exportedRows: apiResult.exportedRows,
|
|
7470
7479
|
startTime: new Date(apiResult.startTime),
|
|
7471
7480
|
endTime: new Date(apiResult.endTime),
|
|
@@ -7473,6 +7482,57 @@ var UniversalExportClient = class {
|
|
|
7473
7482
|
statistics: apiResult.statistics
|
|
7474
7483
|
};
|
|
7475
7484
|
}
|
|
7485
|
+
/**
|
|
7486
|
+
* 将后端返回的base64文件数据转换为Blob
|
|
7487
|
+
*/
|
|
7488
|
+
createFileBlobFromBase64(fileData, fileName) {
|
|
7489
|
+
if (!fileData || typeof fileData !== "string") {
|
|
7490
|
+
return void 0;
|
|
7491
|
+
}
|
|
7492
|
+
try {
|
|
7493
|
+
if (typeof atob === "function") {
|
|
7494
|
+
const binaryString = atob(fileData);
|
|
7495
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
7496
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
7497
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
7498
|
+
}
|
|
7499
|
+
const arrayBuffer = bytes.buffer.slice(
|
|
7500
|
+
bytes.byteOffset,
|
|
7501
|
+
bytes.byteOffset + bytes.byteLength
|
|
7502
|
+
);
|
|
7503
|
+
return new Blob([arrayBuffer], { type: this.getMimeTypeByFileName(fileName) });
|
|
7504
|
+
} else if (typeof Buffer !== "undefined") {
|
|
7505
|
+
const bufferBytes = Buffer.from(fileData, "base64");
|
|
7506
|
+
const bytes = Uint8Array.from(bufferBytes);
|
|
7507
|
+
const arrayBuffer = bytes.buffer.slice(
|
|
7508
|
+
bytes.byteOffset,
|
|
7509
|
+
bytes.byteOffset + bytes.byteLength
|
|
7510
|
+
);
|
|
7511
|
+
return new Blob([arrayBuffer], { type: this.getMimeTypeByFileName(fileName) });
|
|
7512
|
+
} else {
|
|
7513
|
+
return void 0;
|
|
7514
|
+
}
|
|
7515
|
+
} catch {
|
|
7516
|
+
return void 0;
|
|
7517
|
+
}
|
|
7518
|
+
}
|
|
7519
|
+
/**
|
|
7520
|
+
* 根据文件名推断MIME类型
|
|
7521
|
+
*/
|
|
7522
|
+
getMimeTypeByFileName(fileName) {
|
|
7523
|
+
const extension = fileName?.split(".").pop()?.toLowerCase();
|
|
7524
|
+
switch (extension) {
|
|
7525
|
+
case "csv":
|
|
7526
|
+
return "text/csv; charset=utf-8";
|
|
7527
|
+
case "xlsx":
|
|
7528
|
+
case "xls":
|
|
7529
|
+
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
7530
|
+
case "json":
|
|
7531
|
+
return "application/json; charset=utf-8";
|
|
7532
|
+
default:
|
|
7533
|
+
return "application/octet-stream";
|
|
7534
|
+
}
|
|
7535
|
+
}
|
|
7476
7536
|
/**
|
|
7477
7537
|
* 转换API返回的进度数据
|
|
7478
7538
|
*/
|