@social-mail/social-mail-client 1.2.607 → 1.2.609
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/public/preview/zip/DownloadZip.d.ts.map +1 -1
- package/dist/public/preview/zip/DownloadZip.js +64 -17
- package/dist/public/preview/zip/DownloadZip.js.map +1 -1
- package/dist/public/preview/zip/DownloadZip.pack.js +64 -17
- package/dist/public/preview/zip/DownloadZip.pack.js.map +1 -1
- package/dist/public/preview/zip/DownloadZip.pack.min.js +7 -1
- package/dist/public/preview/zip/DownloadZip.pack.min.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/public/preview/zip/DownloadZip.tsx +39 -15
package/package.json
CHANGED
|
@@ -21,6 +21,14 @@ import AtomRepeater from "@web-atoms/web-controls/dist/basic/AtomRepeater";
|
|
|
21
21
|
import { toKMBString } from "../../../common/NumberFormats";
|
|
22
22
|
import { UMD } from "@web-atoms/core/dist/core/types";
|
|
23
23
|
|
|
24
|
+
styled.css `
|
|
25
|
+
position: absolute;
|
|
26
|
+
left: 0;
|
|
27
|
+
top: 0;
|
|
28
|
+
bottom: 0;
|
|
29
|
+
right: 0;
|
|
30
|
+
`.installGlobal("[data-download-all]");
|
|
31
|
+
|
|
24
32
|
let fileInfo: Partial<IAppFile> = (window as any).fileInfo;
|
|
25
33
|
|
|
26
34
|
if (!fileInfo) {
|
|
@@ -30,7 +38,7 @@ if (!fileInfo) {
|
|
|
30
38
|
fileInfo[k] = v;
|
|
31
39
|
});
|
|
32
40
|
|
|
33
|
-
|
|
41
|
+
fileInfo = {"$id":2,"url":"/api/files/view/531173/null/woodswork.in","downloadUrl":"/api/files/download/531173/null/woodswork.in","$type":"AppFile","path":"531173/","isFolder":true,"name":"woodswork.in","fileSize":"160138","contentType":"application/site","contentDisposition":null,"contentID":null,"fileContentID":null,"creatorID":"1","parentID":null,"emailID":null,"isDeleted":false,"isShared":true,"dateCreated":"2024-06-12T06:08:24.079Z","dateUpdated":"2024-06-28T14:40:06.097Z","versions":null,"$deleted":false,"appFileID":"531173"} as any;
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
@Pack
|
|
@@ -49,6 +57,7 @@ export default class DownloadZip extends AtomControl {
|
|
|
49
57
|
|
|
50
58
|
constructor(app, e) {
|
|
51
59
|
super(app, e);
|
|
60
|
+
this.element.setAttribute("data-download-all", "download-all");
|
|
52
61
|
this.pushInit();
|
|
53
62
|
}
|
|
54
63
|
|
|
@@ -56,23 +65,27 @@ export default class DownloadZip extends AtomControl {
|
|
|
56
65
|
|
|
57
66
|
|
|
58
67
|
this.renderer = <div>
|
|
59
|
-
<div
|
|
68
|
+
<div data-layout="center-all">
|
|
69
|
+
<div>Preparing Zip</div>
|
|
70
|
+
</div>
|
|
60
71
|
</div>;
|
|
61
72
|
|
|
62
|
-
const { JSZip } = await UMD.import("https://cdn.jsdelivr.net/npm/jszip@3.10.1/dist/jszip.min.js") as any;
|
|
73
|
+
const { default: JSZip } = await UMD.import("https://cdn.jsdelivr.net/npm/jszip@3.10.1/dist/jszip.min.js") as any;
|
|
63
74
|
|
|
64
75
|
this.zipFile = new JSZip();
|
|
65
76
|
|
|
66
|
-
const { name, path } = fileInfo;
|
|
67
|
-
|
|
68
77
|
this.renderer = <div>
|
|
69
|
-
<div
|
|
78
|
+
<div data-layout="center-all">
|
|
79
|
+
<div>Loading folder ...</div>
|
|
80
|
+
</div>
|
|
70
81
|
</div>;
|
|
71
82
|
|
|
72
83
|
await this.loadingFiles();
|
|
73
84
|
|
|
74
85
|
this.renderer = <div>
|
|
75
|
-
<div
|
|
86
|
+
<div data-layout="center-all">
|
|
87
|
+
<div>Downloading Files ...</div>
|
|
88
|
+
</div>
|
|
76
89
|
</div>;
|
|
77
90
|
|
|
78
91
|
for (const element of this.files) {
|
|
@@ -88,16 +101,20 @@ export default class DownloadZip extends AtomControl {
|
|
|
88
101
|
const zipFolder = this.zipFile.folder(this.root.name);
|
|
89
102
|
|
|
90
103
|
this.renderer = <div>
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
104
|
+
<div data-layout="center-all">
|
|
105
|
+
<AtomRepeater
|
|
106
|
+
items={this.slice}
|
|
107
|
+
itemRenderer={(x: IAppFile) => <div text={`Downloading ${x.name} (${toKMBString(x.fileSize)})`}/>}
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
95
110
|
</div>;
|
|
96
111
|
|
|
97
112
|
await this.downloadFiles(this.root, zipFolder);
|
|
98
113
|
|
|
99
114
|
this.renderer = <div>
|
|
100
|
-
<div
|
|
115
|
+
<div data-layout="center-all">
|
|
116
|
+
<div>Generating zip file.</div>
|
|
117
|
+
</div>
|
|
101
118
|
</div>;
|
|
102
119
|
|
|
103
120
|
const zipFile = await this.zipFile.generateAsync({ type: "blob"});
|
|
@@ -107,8 +124,12 @@ export default class DownloadZip extends AtomControl {
|
|
|
107
124
|
const url = URL.createObjectURL(file);
|
|
108
125
|
|
|
109
126
|
this.renderer = <div>
|
|
110
|
-
<div
|
|
111
|
-
|
|
127
|
+
<div data-layout="center-all">
|
|
128
|
+
<div data-layout="vertical-flex-stretch-items">
|
|
129
|
+
<div>Zip File is ready.</div>
|
|
130
|
+
<a href={url} download={file.name}>Save Zip File</a>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
112
133
|
</div>;
|
|
113
134
|
|
|
114
135
|
}
|
|
@@ -135,9 +156,11 @@ export default class DownloadZip extends AtomControl {
|
|
|
135
156
|
const slice = files.splice(0, 5);
|
|
136
157
|
const tasks = [];
|
|
137
158
|
for (const file of slice) {
|
|
159
|
+
this.slice.add(file);
|
|
138
160
|
tasks.push((async () => {
|
|
139
161
|
const blob = await FetchBuilder.get(file.downloadUrl).responseAsBlob();
|
|
140
162
|
zipFolder.file(file.name, blob);
|
|
163
|
+
this.slice.remove(file);
|
|
141
164
|
})());
|
|
142
165
|
}
|
|
143
166
|
await Promise.all(tasks);
|
|
@@ -158,7 +181,7 @@ export default class DownloadZip extends AtomControl {
|
|
|
158
181
|
.where({ path, start }, (p) => (x) => Sql.text.like(x.path, p.path) && x.appFileID > p.start && x.isDeleted === false )
|
|
159
182
|
.orderBy((x) => x.appFileID)
|
|
160
183
|
.toPagedList({
|
|
161
|
-
size:
|
|
184
|
+
size: 100
|
|
162
185
|
});
|
|
163
186
|
|
|
164
187
|
if (!files.items.length) {
|
|
@@ -170,6 +193,7 @@ export default class DownloadZip extends AtomControl {
|
|
|
170
193
|
if (!this.root && file.appFileID === fileInfo.appFileID) {
|
|
171
194
|
this.root = file;
|
|
172
195
|
}
|
|
196
|
+
start = file.appFileID;
|
|
173
197
|
}
|
|
174
198
|
} while (true);
|
|
175
199
|
|