@nkhang1902/strapi-plugin-export-import-clsx 1.5.0 → 1.5.2
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.
|
@@ -175,9 +175,9 @@ const ExportImportButtons = (props) => {
|
|
|
175
175
|
const a = document.createElement("a");
|
|
176
176
|
a.href = url;
|
|
177
177
|
|
|
178
|
-
const filename =
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
const filename = response.headers
|
|
179
|
+
.get("Content-Disposition")
|
|
180
|
+
.split("filename=")[1];
|
|
181
181
|
|
|
182
182
|
a.download = filename;
|
|
183
183
|
document.body.appendChild(a);
|
|
@@ -79,7 +79,9 @@ const ExportButtonsEditView = (props) => {
|
|
|
79
79
|
const a = document.createElement("a");
|
|
80
80
|
a.href = url;
|
|
81
81
|
|
|
82
|
-
const filename =
|
|
82
|
+
const filename = response.headers
|
|
83
|
+
.get("Content-Disposition")
|
|
84
|
+
.split("filename=")[1];
|
|
83
85
|
|
|
84
86
|
a.download = filename;
|
|
85
87
|
document.body.appendChild(a);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nkhang1902/strapi-plugin-export-import-clsx",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "A powerful Strapi plugin for exporting and importing data with Excel support and advanced filtering",
|
|
5
5
|
"main": "./strapi-server.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,9 +15,20 @@ module.exports = ({ strapi }) => ({
|
|
|
15
15
|
);
|
|
16
16
|
|
|
17
17
|
const filename = `${
|
|
18
|
-
contentType?.
|
|
18
|
+
contentType?.split(".")[1]|| "strapi"
|
|
19
19
|
}-export-${new Date().toISOString().split("T")[0]}.xlsx`;
|
|
20
20
|
|
|
21
|
+
if (mode === "participant") {
|
|
22
|
+
console.log(ctx.query)
|
|
23
|
+
const expName = await strapi.documents(contentType).findOne({
|
|
24
|
+
select: ["name"],
|
|
25
|
+
filters: {
|
|
26
|
+
documentId: ctx.query[`filters[documentId][$eq]`],
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
filename = `${expName?.name}-participant-export-${new Date().toISOString().split("T")[0]}.xlsx`;
|
|
30
|
+
}
|
|
31
|
+
|
|
21
32
|
ctx.set(
|
|
22
33
|
"Content-Type",
|
|
23
34
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
@@ -40,7 +51,10 @@ module.exports = ({ strapi }) => ({
|
|
|
40
51
|
ctx.set("Content-Type", "application/json");
|
|
41
52
|
ctx.set("Content-Disposition", `attachment; filename="${filename}"`);
|
|
42
53
|
|
|
43
|
-
ctx.body = JSON.stringify(
|
|
54
|
+
ctx.body = JSON.stringify({
|
|
55
|
+
filename: filename,
|
|
56
|
+
data: data,
|
|
57
|
+
}, null, 2);
|
|
44
58
|
}
|
|
45
59
|
} catch (error) {
|
|
46
60
|
strapi.log.error("Export error:", error);
|
|
@@ -421,22 +421,24 @@ module.exports = ({ strapi }) => ({
|
|
|
421
421
|
const participants = [
|
|
422
422
|
...tag(experienceData?.corporates, 'corporate'),
|
|
423
423
|
...tag(experienceData?.investors, 'investor'),
|
|
424
|
-
...tag(experienceData?.vipGuests, '
|
|
424
|
+
...tag(experienceData?.vipGuests, 'vipGuest'),
|
|
425
425
|
];
|
|
426
426
|
|
|
427
427
|
const data = participants.map((p) => ({
|
|
428
428
|
type: p.type,
|
|
429
|
-
corporateName: p.corporateName ??
|
|
429
|
+
corporateName: p.corporateName ?? '',
|
|
430
430
|
tickerCode: p.tickerCode ?? '',
|
|
431
431
|
fullName:
|
|
432
432
|
p.fullName ??
|
|
433
433
|
[p.firstName, p.lastName].filter(Boolean).join(' ') ??
|
|
434
434
|
'',
|
|
435
|
+
salutation: p.salutation ?? '',
|
|
435
436
|
businessEmail: p.businessEmail ?? '',
|
|
437
|
+
businessTitle: p.businessTitle ?? '',
|
|
438
|
+
companyName: p.companyInformation?.companyName ?? '',
|
|
436
439
|
mobile: p.mobile ?? '',
|
|
437
440
|
}));
|
|
438
441
|
|
|
439
|
-
console.log(data)
|
|
440
442
|
const worksheet = XLSX.utils.json_to_sheet(data);
|
|
441
443
|
XLSX.utils.book_append_sheet(
|
|
442
444
|
workbook,
|