@amirjalili1374/ui-kit 1.5.84 → 1.5.85
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/ui-kit.es.js
CHANGED
|
@@ -14342,8 +14342,7 @@ function apiService(axiosInst, resource) {
|
|
|
14342
14342
|
async exportExcel(params = {}, customUrl) {
|
|
14343
14343
|
const url = customUrl || baseUrl;
|
|
14344
14344
|
const response = await axiosInst.get(url, {
|
|
14345
|
-
params
|
|
14346
|
-
responseType: "blob"
|
|
14345
|
+
params
|
|
14347
14346
|
});
|
|
14348
14347
|
return response;
|
|
14349
14348
|
}
|
|
@@ -18708,7 +18707,18 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
|
|
|
18708
18707
|
emit("update:selectedItems", selectedItems.value);
|
|
18709
18708
|
emit("selection-change", selectedItems.value);
|
|
18710
18709
|
};
|
|
18710
|
+
const base64ToBlob = (base64, mimeType) => {
|
|
18711
|
+
const cleanedBase64 = base64.includes(",") ? base64.split(",")[1] : base64;
|
|
18712
|
+
const byteCharacters = atob(cleanedBase64);
|
|
18713
|
+
const byteNumbers = new Array(byteCharacters.length);
|
|
18714
|
+
for (let i = 0; i < byteCharacters.length; i++) {
|
|
18715
|
+
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
|
18716
|
+
}
|
|
18717
|
+
const byteArray = new Uint8Array(byteNumbers);
|
|
18718
|
+
return new Blob([byteArray], { type: mimeType });
|
|
18719
|
+
};
|
|
18711
18720
|
const handleExport = async () => {
|
|
18721
|
+
var _a, _b, _c;
|
|
18712
18722
|
try {
|
|
18713
18723
|
exportLoading.value = true;
|
|
18714
18724
|
const rawFilter = buildFilterParams();
|
|
@@ -18727,7 +18737,11 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
|
|
|
18727
18737
|
};
|
|
18728
18738
|
}
|
|
18729
18739
|
const response = await api.exportExcel(params, props.exportUrl);
|
|
18730
|
-
const
|
|
18740
|
+
const base64Data = typeof response.data === "string" ? response.data : ((_a = response.data) == null ? void 0 : _a.data) || ((_b = response.data) == null ? void 0 : _b.file) || ((_c = response.data) == null ? void 0 : _c.content) || "";
|
|
18741
|
+
if (!base64Data || typeof base64Data !== "string") {
|
|
18742
|
+
throw new Error("Export response is not a valid base64 string.");
|
|
18743
|
+
}
|
|
18744
|
+
const blob = base64ToBlob(base64Data, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
18731
18745
|
const url = window.URL.createObjectURL(blob);
|
|
18732
18746
|
const link = document.createElement("a");
|
|
18733
18747
|
link.href = url;
|