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
|
@@ -7332,7 +7332,6 @@ var UniversalExportClient = class {
|
|
|
7332
7332
|
try {
|
|
7333
7333
|
const isDataArray = Array.isArray(request.dataSource);
|
|
7334
7334
|
const requestBody = {
|
|
7335
|
-
configId: request.configId,
|
|
7336
7335
|
queryParams: request.queryParams,
|
|
7337
7336
|
fieldMapping: request.fieldMapping,
|
|
7338
7337
|
filters: request.filters,
|
|
@@ -7340,6 +7339,14 @@ var UniversalExportClient = class {
|
|
|
7340
7339
|
pagination: request.pagination,
|
|
7341
7340
|
customFileName: request.customFileName
|
|
7342
7341
|
};
|
|
7342
|
+
if (typeof request.configId === "string") {
|
|
7343
|
+
requestBody.configId = request.configId;
|
|
7344
|
+
} else {
|
|
7345
|
+
requestBody.config = request.configId;
|
|
7346
|
+
if (request.configId?.id) {
|
|
7347
|
+
requestBody.configId = request.configId.id;
|
|
7348
|
+
}
|
|
7349
|
+
}
|
|
7343
7350
|
if (isDataArray) {
|
|
7344
7351
|
requestBody.data = request.dataSource;
|
|
7345
7352
|
} else {
|
|
@@ -7485,11 +7492,13 @@ var UniversalExportClient = class {
|
|
|
7485
7492
|
* 转换API返回的导出结果
|
|
7486
7493
|
*/
|
|
7487
7494
|
transformExportResultFromAPI(apiResult) {
|
|
7495
|
+
const fileBlob = this.createFileBlobFromBase64(apiResult.fileData, apiResult.fileName);
|
|
7488
7496
|
return {
|
|
7489
7497
|
exportId: apiResult.exportId,
|
|
7490
7498
|
fileName: apiResult.fileName,
|
|
7491
7499
|
fileSize: apiResult.fileSize,
|
|
7492
7500
|
fileUrl: apiResult.fileUrl,
|
|
7501
|
+
fileBlob,
|
|
7493
7502
|
exportedRows: apiResult.exportedRows,
|
|
7494
7503
|
startTime: new Date(apiResult.startTime),
|
|
7495
7504
|
endTime: new Date(apiResult.endTime),
|
|
@@ -7497,6 +7506,57 @@ var UniversalExportClient = class {
|
|
|
7497
7506
|
statistics: apiResult.statistics
|
|
7498
7507
|
};
|
|
7499
7508
|
}
|
|
7509
|
+
/**
|
|
7510
|
+
* 将后端返回的base64文件数据转换为Blob
|
|
7511
|
+
*/
|
|
7512
|
+
createFileBlobFromBase64(fileData, fileName) {
|
|
7513
|
+
if (!fileData || typeof fileData !== "string") {
|
|
7514
|
+
return void 0;
|
|
7515
|
+
}
|
|
7516
|
+
try {
|
|
7517
|
+
if (typeof atob === "function") {
|
|
7518
|
+
const binaryString = atob(fileData);
|
|
7519
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
7520
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
7521
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
7522
|
+
}
|
|
7523
|
+
const arrayBuffer = bytes.buffer.slice(
|
|
7524
|
+
bytes.byteOffset,
|
|
7525
|
+
bytes.byteOffset + bytes.byteLength
|
|
7526
|
+
);
|
|
7527
|
+
return new Blob([arrayBuffer], { type: this.getMimeTypeByFileName(fileName) });
|
|
7528
|
+
} else if (typeof Buffer !== "undefined") {
|
|
7529
|
+
const bufferBytes = Buffer.from(fileData, "base64");
|
|
7530
|
+
const bytes = Uint8Array.from(bufferBytes);
|
|
7531
|
+
const arrayBuffer = bytes.buffer.slice(
|
|
7532
|
+
bytes.byteOffset,
|
|
7533
|
+
bytes.byteOffset + bytes.byteLength
|
|
7534
|
+
);
|
|
7535
|
+
return new Blob([arrayBuffer], { type: this.getMimeTypeByFileName(fileName) });
|
|
7536
|
+
} else {
|
|
7537
|
+
return void 0;
|
|
7538
|
+
}
|
|
7539
|
+
} catch {
|
|
7540
|
+
return void 0;
|
|
7541
|
+
}
|
|
7542
|
+
}
|
|
7543
|
+
/**
|
|
7544
|
+
* 根据文件名推断MIME类型
|
|
7545
|
+
*/
|
|
7546
|
+
getMimeTypeByFileName(fileName) {
|
|
7547
|
+
const extension = fileName?.split(".").pop()?.toLowerCase();
|
|
7548
|
+
switch (extension) {
|
|
7549
|
+
case "csv":
|
|
7550
|
+
return "text/csv; charset=utf-8";
|
|
7551
|
+
case "xlsx":
|
|
7552
|
+
case "xls":
|
|
7553
|
+
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
7554
|
+
case "json":
|
|
7555
|
+
return "application/json; charset=utf-8";
|
|
7556
|
+
default:
|
|
7557
|
+
return "application/octet-stream";
|
|
7558
|
+
}
|
|
7559
|
+
}
|
|
7500
7560
|
/**
|
|
7501
7561
|
* 转换API返回的进度数据
|
|
7502
7562
|
*/
|