@securancy/file-explorer 1.0.0
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/README.md +7 -0
- package/default-styling.pcss +39 -0
- package/dist/components/FileExplorer.svelte +443 -0
- package/dist/components/FileExplorer.svelte.d.ts +63 -0
- package/dist/components/FileExplorerBreadcrumb.svelte +263 -0
- package/dist/components/FileExplorerBreadcrumb.svelte.d.ts +18 -0
- package/dist/components/FileExplorerCreateDirectory.svelte +77 -0
- package/dist/components/FileExplorerCreateDirectory.svelte.d.ts +24 -0
- package/dist/components/FileExplorerDirectoryColumn.svelte +456 -0
- package/dist/components/FileExplorerDirectoryColumn.svelte.d.ts +39 -0
- package/dist/components/FileExplorerDirectoryIndex.svelte +367 -0
- package/dist/components/FileExplorerDirectoryIndex.svelte.d.ts +33 -0
- package/dist/components/FileExplorerDisplayModeSwitcher.svelte +300 -0
- package/dist/components/FileExplorerDisplayModeSwitcher.svelte.d.ts +19 -0
- package/dist/components/FileExplorerFileDetailColumn.svelte +340 -0
- package/dist/components/FileExplorerFileDetailColumn.svelte.d.ts +24 -0
- package/dist/components/FileIcon.svelte +310 -0
- package/dist/components/FileIcon.svelte.d.ts +19 -0
- package/dist/file-explorer.pcss +304 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/models/file-explorer-display-mode.d.ts +4 -0
- package/dist/models/file-explorer-display-mode.js +5 -0
- package/dist/models/file-item.d.ts +23 -0
- package/dist/models/file-item.js +1 -0
- package/dist/models/index.d.ts +3 -0
- package/dist/models/index.js +3 -0
- package/dist/models/translations.d.ts +19 -0
- package/dist/models/translations.js +17 -0
- package/dist/utilities/file-utilities.d.ts +8 -0
- package/dist/utilities/file-utilities.js +49 -0
- package/dist/utilities/index.d.ts +1 -0
- package/dist/utilities/index.js +1 -0
- package/dist/validation/file-upload-schema.d.ts +2 -0
- package/dist/validation/file-upload-schema.js +2 -0
- package/package.json +72 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { FileExplorerDisplayMode } from '../index.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
displayMode: FileExplorerDisplayMode;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type FileExplorerDisplayModeSwitcherProps = typeof __propDef.props;
|
|
15
|
+
export type FileExplorerDisplayModeSwitcherEvents = typeof __propDef.events;
|
|
16
|
+
export type FileExplorerDisplayModeSwitcherSlots = typeof __propDef.slots;
|
|
17
|
+
export default class FileExplorerDisplayModeSwitcher extends SvelteComponent<FileExplorerDisplayModeSwitcherProps, FileExplorerDisplayModeSwitcherEvents, FileExplorerDisplayModeSwitcherSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
<script>import { Card, Icon } from "@securancy/svelte-components";
|
|
2
|
+
import FileIcon from "./FileIcon.svelte";
|
|
3
|
+
import { resize, ResizeDirections } from "@securancy/svelte-utilities";
|
|
4
|
+
import { formatBytes, getExtension, isImage } from "../utilities/index.js";
|
|
5
|
+
import { DateTime } from "luxon";
|
|
6
|
+
import { createEventDispatcher } from "svelte";
|
|
7
|
+
export let fileItem;
|
|
8
|
+
export let getFilePreview;
|
|
9
|
+
export let translations;
|
|
10
|
+
const dispatch = createEventDispatcher();
|
|
11
|
+
const fileDateFormat = "cccc FF";
|
|
12
|
+
let filePreview;
|
|
13
|
+
let extension;
|
|
14
|
+
$: refresh(fileItem);
|
|
15
|
+
async function refresh(_fileItem) {
|
|
16
|
+
filePreview = await getFilePreview(_fileItem).catch((error) => {
|
|
17
|
+
console.error(error);
|
|
18
|
+
return void 0;
|
|
19
|
+
});
|
|
20
|
+
extension = getExtension(_fileItem.name);
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<div
|
|
25
|
+
class="file-explorer__column file-explorer__column--file-detail"
|
|
26
|
+
use:resize={{ directions: [ResizeDirections.East], parentPadding: true }}
|
|
27
|
+
>
|
|
28
|
+
<div class="file-explorer__column-scroll-container file-explorer-preview">
|
|
29
|
+
{#if filePreview}
|
|
30
|
+
<Card type="flat">
|
|
31
|
+
{#if isImage(filePreview.url)}
|
|
32
|
+
<img
|
|
33
|
+
class="file-explorer__image-preview"
|
|
34
|
+
alt={fileItem.name}
|
|
35
|
+
src={filePreview.url}
|
|
36
|
+
title={fileItem.name}
|
|
37
|
+
>
|
|
38
|
+
{:else}
|
|
39
|
+
<FileIcon {extension} size="large" />
|
|
40
|
+
{/if}
|
|
41
|
+
</Card>
|
|
42
|
+
<Card type="flat">
|
|
43
|
+
<div
|
|
44
|
+
class="file-explorer-preview__title"
|
|
45
|
+
title={fileItem.name}
|
|
46
|
+
>
|
|
47
|
+
{fileItem.name}
|
|
48
|
+
</div>
|
|
49
|
+
<a
|
|
50
|
+
class="file-explorer-preview__download"
|
|
51
|
+
href={filePreview.url}
|
|
52
|
+
rel="noopener noreferrer"
|
|
53
|
+
target="_blank"
|
|
54
|
+
title="Download {fileItem.name}"
|
|
55
|
+
>
|
|
56
|
+
{translations.previewFile}
|
|
57
|
+
</a>
|
|
58
|
+
<div class="file-explorer-preview__info">
|
|
59
|
+
<span>Size</span>
|
|
60
|
+
<div>{formatBytes(filePreview.fileSize)}</div>
|
|
61
|
+
</div>
|
|
62
|
+
{#if filePreview.createdAt}
|
|
63
|
+
<div class="file-explorer-preview__info">
|
|
64
|
+
<span>{translations.createdAt}</span>
|
|
65
|
+
<div>{DateTime.fromJSDate(filePreview.createdAt).toFormat(fileDateFormat)}</div>
|
|
66
|
+
</div>
|
|
67
|
+
{/if}
|
|
68
|
+
{#if filePreview.modifiedAt}
|
|
69
|
+
<div class="file-explorer-preview__info">
|
|
70
|
+
<span>{translations.modifiedAt}</span>
|
|
71
|
+
<div>{DateTime.fromJSDate(filePreview.modifiedAt).toFormat(fileDateFormat)}</div>
|
|
72
|
+
</div>
|
|
73
|
+
{/if}
|
|
74
|
+
<div class="file-explorer-preview__info">
|
|
75
|
+
<button type="button" on:click={() => dispatch('delete-file', fileItem)}>
|
|
76
|
+
<Icon class="fa-solid fa-trash" />
|
|
77
|
+
</button>
|
|
78
|
+
</div>
|
|
79
|
+
</Card>
|
|
80
|
+
{:else}
|
|
81
|
+
<!-- @todo add loader if needed (test performance) -->
|
|
82
|
+
{/if}
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<style>/* eslint-disable */
|
|
87
|
+
/**
|
|
88
|
+
* Media queries and devices
|
|
89
|
+
*/
|
|
90
|
+
/**
|
|
91
|
+
* Some mixins that can be used dynamically inside @each loops
|
|
92
|
+
*/
|
|
93
|
+
.file-explorer {
|
|
94
|
+
position: relative;
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-direction: column;
|
|
97
|
+
height: 100%;
|
|
98
|
+
width: 100%;
|
|
99
|
+
background: var(--file-explorer-background);
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
}
|
|
102
|
+
.file-explorer__controls {
|
|
103
|
+
flex-shrink: 0;
|
|
104
|
+
display: flex;
|
|
105
|
+
border-bottom: var(--file-explorer-border-style);
|
|
106
|
+
padding: var(--file-explorer-default-spacing);
|
|
107
|
+
background: var(--file-explorer-background-shade);
|
|
108
|
+
}
|
|
109
|
+
.file-explorer__content {
|
|
110
|
+
flex-grow: 1;
|
|
111
|
+
display: flex;
|
|
112
|
+
overflow-x: auto;
|
|
113
|
+
scroll-behavior: smooth;
|
|
114
|
+
}
|
|
115
|
+
/* Keep the index within screen */
|
|
116
|
+
@media (width >= 769px) {
|
|
117
|
+
/* @formatter:off */
|
|
118
|
+
.file-explorer--display-mode-index .file-explorer__content {
|
|
119
|
+
/* @formatter:on */
|
|
120
|
+
overflow-x: inherit;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
.file-explorer__column, .file-explorer__index {
|
|
124
|
+
flex-shrink: 0;
|
|
125
|
+
border-right: var(--file-explorer-border-style);
|
|
126
|
+
background: var(--file-explorer-background);
|
|
127
|
+
}
|
|
128
|
+
.file-explorer__column {
|
|
129
|
+
display: flex;
|
|
130
|
+
flex-direction: column;
|
|
131
|
+
width: var(--file-explorer-column-default-width);
|
|
132
|
+
min-width: var(--file-explorer-column-min-width);
|
|
133
|
+
overflow: hidden;
|
|
134
|
+
}
|
|
135
|
+
.file-explorer__column--file-detail {
|
|
136
|
+
flex-grow: 1;
|
|
137
|
+
width: var(--file-explorer-preview-default-width);
|
|
138
|
+
display: flex;
|
|
139
|
+
flex-direction: column;
|
|
140
|
+
}
|
|
141
|
+
.file-explorer__column--sticky {
|
|
142
|
+
position: sticky;
|
|
143
|
+
left: 0;
|
|
144
|
+
z-index: 1;
|
|
145
|
+
}
|
|
146
|
+
.file-explorer__column::after {
|
|
147
|
+
content: '';
|
|
148
|
+
position: absolute;
|
|
149
|
+
inset: 0;
|
|
150
|
+
pointer-events: none;
|
|
151
|
+
transition: background-color 0.2s ease-in-out;
|
|
152
|
+
}
|
|
153
|
+
.file-explorer__column--dragover {
|
|
154
|
+
cursor: copy;
|
|
155
|
+
}
|
|
156
|
+
.file-explorer__column--dragover::after {
|
|
157
|
+
pointer-events: all;
|
|
158
|
+
background-color: var(--file-explorer-background-dragover);
|
|
159
|
+
}
|
|
160
|
+
.file-explorer__index {
|
|
161
|
+
display: flex;
|
|
162
|
+
flex-direction: column;
|
|
163
|
+
width: var(--file-explorer-index-default-width);
|
|
164
|
+
overflow: hidden;
|
|
165
|
+
}
|
|
166
|
+
@media (width >= 769px) {
|
|
167
|
+
.file-explorer__index {
|
|
168
|
+
flex-shrink: 1
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
.file-explorer__index--hidden {
|
|
172
|
+
display: none;
|
|
173
|
+
}
|
|
174
|
+
.file-explorer__column-scroll-container, .file-explorer__index-scroll-container {
|
|
175
|
+
flex-grow: 1;
|
|
176
|
+
overflow-y: auto;
|
|
177
|
+
padding: calc(var(--file-explorer-default-spacing) * 1.5) var(--file-explorer-default-spacing) 0 var(--file-explorer-default-spacing);
|
|
178
|
+
}
|
|
179
|
+
.file-explorer__grid {
|
|
180
|
+
display: flex;
|
|
181
|
+
align-items: flex-start;
|
|
182
|
+
flex-wrap: wrap;
|
|
183
|
+
gap: var(--file-explorer-default-spacing);
|
|
184
|
+
}
|
|
185
|
+
.file-explorer__breadcrumb {
|
|
186
|
+
/* @todo */
|
|
187
|
+
}
|
|
188
|
+
.file-explorer__display-mode-switcher {
|
|
189
|
+
display: flex;
|
|
190
|
+
gap: calc(0.5 * var(--file-explorer-default-spacing));
|
|
191
|
+
margin-left: auto;
|
|
192
|
+
}
|
|
193
|
+
.file-explorer__search {
|
|
194
|
+
margin-bottom: var(--file-explorer-default-spacing);
|
|
195
|
+
padding: calc(var(--file-explorer-default-spacing) * 1.5) var(--file-explorer-default-spacing) 0 var(--file-explorer-default-spacing);
|
|
196
|
+
}
|
|
197
|
+
.file-explorer__list {
|
|
198
|
+
margin-bottom: var(--file-explorer-default-spacing);
|
|
199
|
+
}
|
|
200
|
+
.file-explorer__list-header {
|
|
201
|
+
display: flex;
|
|
202
|
+
justify-content: space-between;
|
|
203
|
+
gap: calc(0.5 * var(--file-explorer-default-spacing));
|
|
204
|
+
width: 100%;
|
|
205
|
+
margin-bottom: calc(0.5 * var(--file-explorer-default-spacing));
|
|
206
|
+
color: var(--file-explorer-list-header-color);
|
|
207
|
+
}
|
|
208
|
+
.file-explorer__list-header span {
|
|
209
|
+
overflow: hidden;
|
|
210
|
+
white-space: nowrap;
|
|
211
|
+
text-overflow: ellipsis;
|
|
212
|
+
}
|
|
213
|
+
.file-explorer__list-header button {
|
|
214
|
+
flex-shrink: 0;
|
|
215
|
+
color: var(--file-explorer-action-primary-color);
|
|
216
|
+
cursor: pointer;
|
|
217
|
+
}
|
|
218
|
+
.file-explorer__grid-header {
|
|
219
|
+
width: 100%;
|
|
220
|
+
}
|
|
221
|
+
.file-explorer__grid-header button {
|
|
222
|
+
color: var(--file-explorer-action-primary-color);
|
|
223
|
+
cursor: pointer;
|
|
224
|
+
}
|
|
225
|
+
.file-explorer__list-item, .file-explorer__grid-item {
|
|
226
|
+
border-radius: var(--file-explorer-list-item-border-radius);
|
|
227
|
+
background: none;
|
|
228
|
+
color: var(--file-explorer-list-item-color);
|
|
229
|
+
}
|
|
230
|
+
.file-explorer__list-item > :global(i), .file-explorer__grid-item > :global(i) {
|
|
231
|
+
flex-shrink: 0;
|
|
232
|
+
}
|
|
233
|
+
.file-explorer__list-item:not(.file-explorer__list-item--active):hover, .file-explorer__grid-item:not(.file-explorer__grid-item--active):hover {
|
|
234
|
+
background: var(--file-explorer-list-item-background-hover);
|
|
235
|
+
}
|
|
236
|
+
.file-explorer__list-item--active, .file-explorer__grid-item--active {
|
|
237
|
+
color: var(--file-explorer-list-item-color-active);
|
|
238
|
+
background: var(--file-explorer-list-item-background-active);
|
|
239
|
+
}
|
|
240
|
+
.file-explorer__grid-item {
|
|
241
|
+
display: flex;
|
|
242
|
+
flex-direction: column;
|
|
243
|
+
align-items: center;
|
|
244
|
+
|
|
245
|
+
/* 3 items in a grid, spaced out with default spacing means the width of 2 gaps must be subtracted from width */
|
|
246
|
+
width: calc(33.33% - (0.6666 * var(--file-explorer-default-spacing)));
|
|
247
|
+
padding: 5px 2px;
|
|
248
|
+
}
|
|
249
|
+
@media (width >= 769px) {
|
|
250
|
+
.file-explorer__grid-item {
|
|
251
|
+
width: 100px
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
.file-explorer__grid-item--active {
|
|
255
|
+
/* @todo */
|
|
256
|
+
}
|
|
257
|
+
.file-explorer__grid-item > span {
|
|
258
|
+
word-break: break-word;
|
|
259
|
+
margin-top: calc(0.25 * var(--file-explorer-default-spacing));
|
|
260
|
+
}
|
|
261
|
+
.file-explorer__list-item {
|
|
262
|
+
display: flex;
|
|
263
|
+
align-items: baseline;
|
|
264
|
+
width: 100%;
|
|
265
|
+
text-align: left;
|
|
266
|
+
padding: var(--file-explorer-list-item-spacing);
|
|
267
|
+
white-space: nowrap;
|
|
268
|
+
overflow: hidden;
|
|
269
|
+
text-overflow: ellipsis;
|
|
270
|
+
}
|
|
271
|
+
.file-explorer__list-item > span {
|
|
272
|
+
flex-grow: 1;
|
|
273
|
+
min-width: 0;
|
|
274
|
+
overflow: hidden;
|
|
275
|
+
text-overflow: ellipsis;
|
|
276
|
+
}
|
|
277
|
+
.file-explorer__list-item > :global(i:first-child) {
|
|
278
|
+
margin-right: var(--file-explorer-list-item-spacing);
|
|
279
|
+
}
|
|
280
|
+
.file-explorer__list-item > :global(i:last-child) {
|
|
281
|
+
margin-left: var(--file-explorer-list-item-spacing);
|
|
282
|
+
}
|
|
283
|
+
.file-explorer__message {
|
|
284
|
+
display: block;
|
|
285
|
+
padding: var(--file-explorer-list-item-spacing) 0;
|
|
286
|
+
color: var(--file-explorer-message-color);
|
|
287
|
+
}
|
|
288
|
+
.file-explorer__image-preview {
|
|
289
|
+
max-width: 100%;
|
|
290
|
+
margin: 0 auto;
|
|
291
|
+
}
|
|
292
|
+
.file-explorer-preview__title {
|
|
293
|
+
font-size: var(--font-size--h1);
|
|
294
|
+
font-weight: var(--font-weight--semi-bold);
|
|
295
|
+
overflow: hidden;
|
|
296
|
+
text-overflow: ellipsis;
|
|
297
|
+
white-space: nowrap;
|
|
298
|
+
}
|
|
299
|
+
.file-explorer-preview__download {
|
|
300
|
+
color: var(--file-explorer-action-primary-color);
|
|
301
|
+
font-weight: var(--font-weight--semi-bold);
|
|
302
|
+
}
|
|
303
|
+
.file-explorer-preview__download:hover {
|
|
304
|
+
text-decoration-line: underline;
|
|
305
|
+
}
|
|
306
|
+
.file-explorer-preview__info {
|
|
307
|
+
margin-top: 14px;
|
|
308
|
+
}
|
|
309
|
+
.file-explorer-preview__info span {
|
|
310
|
+
color: var(--file-explorer-message-color);
|
|
311
|
+
}
|
|
312
|
+
.file-explorer-preview__info button {
|
|
313
|
+
cursor: pointer;
|
|
314
|
+
}
|
|
315
|
+
.file-explorer__scroll-back-button {
|
|
316
|
+
position: fixed;
|
|
317
|
+
bottom: var(--file-explorer-default-spacing);
|
|
318
|
+
right: var(--file-explorer-default-spacing);
|
|
319
|
+
z-index: 2;
|
|
320
|
+
background: var(--file-explorer-action-primary-color);
|
|
321
|
+
color: var(--file-explorer-action-primary-color-contrast);
|
|
322
|
+
padding: var(--file-explorer-list-item-spacing);
|
|
323
|
+
border-radius: var(--file-explorer-list-item-border-radius);
|
|
324
|
+
}
|
|
325
|
+
.file-explorer__file-icon--large {
|
|
326
|
+
width: 100%;
|
|
327
|
+
text-align: center;
|
|
328
|
+
padding: calc(2 * var(--file-explorer-default-spacing));
|
|
329
|
+
}
|
|
330
|
+
.file-explorer__file-icon--large :global(i) {
|
|
331
|
+
font-size: var(--file-explorer-preview-icon-size);
|
|
332
|
+
}
|
|
333
|
+
.file-explorer__text--semi-bold {
|
|
334
|
+
font-weight: var(--file-explorer-text-semi-bold);
|
|
335
|
+
}
|
|
336
|
+
.file-explorer__loader {
|
|
337
|
+
display: flex;
|
|
338
|
+
justify-content: center;
|
|
339
|
+
}
|
|
340
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { DocumentTranslations, FileItem, FilePreview } from '..';
|
|
3
|
+
import type { DeleteFileEvent } from './FileExplorer.svelte';
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
fileItem: FileItem;
|
|
7
|
+
getFilePreview: (fileItem: FileItem) => Promise<FilePreview>;
|
|
8
|
+
translations: DocumentTranslations;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
'delete-file': CustomEvent<DeleteFileEvent>;
|
|
12
|
+
} & {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {};
|
|
16
|
+
exports?: {} | undefined;
|
|
17
|
+
bindings?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
export type FileExplorerFileDetailColumnProps = typeof __propDef.props;
|
|
20
|
+
export type FileExplorerFileDetailColumnEvents = typeof __propDef.events;
|
|
21
|
+
export type FileExplorerFileDetailColumnSlots = typeof __propDef.slots;
|
|
22
|
+
export default class FileExplorerFileDetailColumn extends SvelteComponent<FileExplorerFileDetailColumnProps, FileExplorerFileDetailColumnEvents, FileExplorerFileDetailColumnSlots> {
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
<script>import { Icon } from "@securancy/svelte-components";
|
|
2
|
+
import { imageExtensions, videoExtensions } from "../utilities/index.js";
|
|
3
|
+
export let extension;
|
|
4
|
+
export let size = "default";
|
|
5
|
+
let iconClass;
|
|
6
|
+
$: iconClass = determineIconString(extension);
|
|
7
|
+
function determineIconString(_extension) {
|
|
8
|
+
if (imageExtensions.includes(_extension)) return "fa-file-image";
|
|
9
|
+
if (videoExtensions.includes(_extension)) return "fa-file-video";
|
|
10
|
+
switch (_extension) {
|
|
11
|
+
case "pdf": {
|
|
12
|
+
return "fa-file-pdf";
|
|
13
|
+
}
|
|
14
|
+
case "doc":
|
|
15
|
+
case "docx": {
|
|
16
|
+
return "fa-file-word";
|
|
17
|
+
}
|
|
18
|
+
case "xls":
|
|
19
|
+
case "xlsx": {
|
|
20
|
+
return "fa-file-spreadsheet";
|
|
21
|
+
}
|
|
22
|
+
case "ppt":
|
|
23
|
+
case "pptx": {
|
|
24
|
+
return "fa-file-powerpoint";
|
|
25
|
+
}
|
|
26
|
+
case "csv": {
|
|
27
|
+
return "fa-file-csv";
|
|
28
|
+
}
|
|
29
|
+
case "txt": {
|
|
30
|
+
return "fa-file-lines";
|
|
31
|
+
}
|
|
32
|
+
case "zip":
|
|
33
|
+
case "tar":
|
|
34
|
+
case "rar": {
|
|
35
|
+
return "fa-file-zipper";
|
|
36
|
+
}
|
|
37
|
+
default: {
|
|
38
|
+
return "fa-file";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
{#if iconClass}
|
|
45
|
+
{#if size === 'large'}
|
|
46
|
+
<div class="file-explorer__file-icon file-explorer__file-icon--large">
|
|
47
|
+
<Icon class="fa-light {iconClass}" size="custom" />
|
|
48
|
+
</div>
|
|
49
|
+
{:else if size === 'grid'}
|
|
50
|
+
<Icon class="fa-light fa-2xl {iconClass}" size="custom" />
|
|
51
|
+
{:else}
|
|
52
|
+
<Icon class="fa-light {iconClass}" />
|
|
53
|
+
{/if}
|
|
54
|
+
{/if}
|
|
55
|
+
|
|
56
|
+
<style>/* eslint-disable */
|
|
57
|
+
/**
|
|
58
|
+
* Media queries and devices
|
|
59
|
+
*/
|
|
60
|
+
/**
|
|
61
|
+
* Some mixins that can be used dynamically inside @each loops
|
|
62
|
+
*/
|
|
63
|
+
.file-explorer {
|
|
64
|
+
position: relative;
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
height: 100%;
|
|
68
|
+
width: 100%;
|
|
69
|
+
background: var(--file-explorer-background);
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
}
|
|
72
|
+
.file-explorer__controls {
|
|
73
|
+
flex-shrink: 0;
|
|
74
|
+
display: flex;
|
|
75
|
+
border-bottom: var(--file-explorer-border-style);
|
|
76
|
+
padding: var(--file-explorer-default-spacing);
|
|
77
|
+
background: var(--file-explorer-background-shade);
|
|
78
|
+
}
|
|
79
|
+
.file-explorer__content {
|
|
80
|
+
flex-grow: 1;
|
|
81
|
+
display: flex;
|
|
82
|
+
overflow-x: auto;
|
|
83
|
+
scroll-behavior: smooth;
|
|
84
|
+
}
|
|
85
|
+
/* Keep the index within screen */
|
|
86
|
+
@media (width >= 769px) {
|
|
87
|
+
/* @formatter:off */
|
|
88
|
+
.file-explorer--display-mode-index .file-explorer__content {
|
|
89
|
+
/* @formatter:on */
|
|
90
|
+
overflow-x: inherit;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
.file-explorer__column, .file-explorer__index {
|
|
94
|
+
flex-shrink: 0;
|
|
95
|
+
border-right: var(--file-explorer-border-style);
|
|
96
|
+
background: var(--file-explorer-background);
|
|
97
|
+
}
|
|
98
|
+
.file-explorer__column {
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
width: var(--file-explorer-column-default-width);
|
|
102
|
+
min-width: var(--file-explorer-column-min-width);
|
|
103
|
+
overflow: hidden;
|
|
104
|
+
}
|
|
105
|
+
.file-explorer__column--file-detail {
|
|
106
|
+
flex-grow: 1;
|
|
107
|
+
width: var(--file-explorer-preview-default-width);
|
|
108
|
+
display: flex;
|
|
109
|
+
flex-direction: column;
|
|
110
|
+
}
|
|
111
|
+
.file-explorer__column--sticky {
|
|
112
|
+
position: sticky;
|
|
113
|
+
left: 0;
|
|
114
|
+
z-index: 1;
|
|
115
|
+
}
|
|
116
|
+
.file-explorer__column::after {
|
|
117
|
+
content: '';
|
|
118
|
+
position: absolute;
|
|
119
|
+
inset: 0;
|
|
120
|
+
pointer-events: none;
|
|
121
|
+
transition: background-color 0.2s ease-in-out;
|
|
122
|
+
}
|
|
123
|
+
.file-explorer__column--dragover {
|
|
124
|
+
cursor: copy;
|
|
125
|
+
}
|
|
126
|
+
.file-explorer__column--dragover::after {
|
|
127
|
+
pointer-events: all;
|
|
128
|
+
background-color: var(--file-explorer-background-dragover);
|
|
129
|
+
}
|
|
130
|
+
.file-explorer__index {
|
|
131
|
+
display: flex;
|
|
132
|
+
flex-direction: column;
|
|
133
|
+
width: var(--file-explorer-index-default-width);
|
|
134
|
+
overflow: hidden;
|
|
135
|
+
}
|
|
136
|
+
@media (width >= 769px) {
|
|
137
|
+
.file-explorer__index {
|
|
138
|
+
flex-shrink: 1
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
.file-explorer__index--hidden {
|
|
142
|
+
display: none;
|
|
143
|
+
}
|
|
144
|
+
.file-explorer__column-scroll-container, .file-explorer__index-scroll-container {
|
|
145
|
+
flex-grow: 1;
|
|
146
|
+
overflow-y: auto;
|
|
147
|
+
padding: calc(var(--file-explorer-default-spacing) * 1.5) var(--file-explorer-default-spacing) 0 var(--file-explorer-default-spacing);
|
|
148
|
+
}
|
|
149
|
+
.file-explorer__grid {
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: flex-start;
|
|
152
|
+
flex-wrap: wrap;
|
|
153
|
+
gap: var(--file-explorer-default-spacing);
|
|
154
|
+
}
|
|
155
|
+
.file-explorer__breadcrumb {
|
|
156
|
+
/* @todo */
|
|
157
|
+
}
|
|
158
|
+
.file-explorer__display-mode-switcher {
|
|
159
|
+
display: flex;
|
|
160
|
+
gap: calc(0.5 * var(--file-explorer-default-spacing));
|
|
161
|
+
margin-left: auto;
|
|
162
|
+
}
|
|
163
|
+
.file-explorer__search {
|
|
164
|
+
margin-bottom: var(--file-explorer-default-spacing);
|
|
165
|
+
padding: calc(var(--file-explorer-default-spacing) * 1.5) var(--file-explorer-default-spacing) 0 var(--file-explorer-default-spacing);
|
|
166
|
+
}
|
|
167
|
+
.file-explorer__list {
|
|
168
|
+
margin-bottom: var(--file-explorer-default-spacing);
|
|
169
|
+
}
|
|
170
|
+
.file-explorer__list-header {
|
|
171
|
+
display: flex;
|
|
172
|
+
justify-content: space-between;
|
|
173
|
+
gap: calc(0.5 * var(--file-explorer-default-spacing));
|
|
174
|
+
width: 100%;
|
|
175
|
+
margin-bottom: calc(0.5 * var(--file-explorer-default-spacing));
|
|
176
|
+
color: var(--file-explorer-list-header-color);
|
|
177
|
+
}
|
|
178
|
+
.file-explorer__list-header span {
|
|
179
|
+
overflow: hidden;
|
|
180
|
+
white-space: nowrap;
|
|
181
|
+
text-overflow: ellipsis;
|
|
182
|
+
}
|
|
183
|
+
.file-explorer__list-header button {
|
|
184
|
+
flex-shrink: 0;
|
|
185
|
+
color: var(--file-explorer-action-primary-color);
|
|
186
|
+
cursor: pointer;
|
|
187
|
+
}
|
|
188
|
+
.file-explorer__grid-header {
|
|
189
|
+
width: 100%;
|
|
190
|
+
}
|
|
191
|
+
.file-explorer__grid-header button {
|
|
192
|
+
color: var(--file-explorer-action-primary-color);
|
|
193
|
+
cursor: pointer;
|
|
194
|
+
}
|
|
195
|
+
.file-explorer__list-item, .file-explorer__grid-item {
|
|
196
|
+
border-radius: var(--file-explorer-list-item-border-radius);
|
|
197
|
+
background: none;
|
|
198
|
+
color: var(--file-explorer-list-item-color);
|
|
199
|
+
}
|
|
200
|
+
.file-explorer__list-item > :global(i), .file-explorer__grid-item > :global(i) {
|
|
201
|
+
flex-shrink: 0;
|
|
202
|
+
}
|
|
203
|
+
.file-explorer__list-item:not(.file-explorer__list-item--active):hover, .file-explorer__grid-item:not(.file-explorer__grid-item--active):hover {
|
|
204
|
+
background: var(--file-explorer-list-item-background-hover);
|
|
205
|
+
}
|
|
206
|
+
.file-explorer__list-item--active, .file-explorer__grid-item--active {
|
|
207
|
+
color: var(--file-explorer-list-item-color-active);
|
|
208
|
+
background: var(--file-explorer-list-item-background-active);
|
|
209
|
+
}
|
|
210
|
+
.file-explorer__grid-item {
|
|
211
|
+
display: flex;
|
|
212
|
+
flex-direction: column;
|
|
213
|
+
align-items: center;
|
|
214
|
+
|
|
215
|
+
/* 3 items in a grid, spaced out with default spacing means the width of 2 gaps must be subtracted from width */
|
|
216
|
+
width: calc(33.33% - (0.6666 * var(--file-explorer-default-spacing)));
|
|
217
|
+
padding: 5px 2px;
|
|
218
|
+
}
|
|
219
|
+
@media (width >= 769px) {
|
|
220
|
+
.file-explorer__grid-item {
|
|
221
|
+
width: 100px
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
.file-explorer__grid-item--active {
|
|
225
|
+
/* @todo */
|
|
226
|
+
}
|
|
227
|
+
.file-explorer__grid-item > span {
|
|
228
|
+
word-break: break-word;
|
|
229
|
+
margin-top: calc(0.25 * var(--file-explorer-default-spacing));
|
|
230
|
+
}
|
|
231
|
+
.file-explorer__list-item {
|
|
232
|
+
display: flex;
|
|
233
|
+
align-items: baseline;
|
|
234
|
+
width: 100%;
|
|
235
|
+
text-align: left;
|
|
236
|
+
padding: var(--file-explorer-list-item-spacing);
|
|
237
|
+
white-space: nowrap;
|
|
238
|
+
overflow: hidden;
|
|
239
|
+
text-overflow: ellipsis;
|
|
240
|
+
}
|
|
241
|
+
.file-explorer__list-item > span {
|
|
242
|
+
flex-grow: 1;
|
|
243
|
+
min-width: 0;
|
|
244
|
+
overflow: hidden;
|
|
245
|
+
text-overflow: ellipsis;
|
|
246
|
+
}
|
|
247
|
+
.file-explorer__list-item > :global(i:first-child) {
|
|
248
|
+
margin-right: var(--file-explorer-list-item-spacing);
|
|
249
|
+
}
|
|
250
|
+
.file-explorer__list-item > :global(i:last-child) {
|
|
251
|
+
margin-left: var(--file-explorer-list-item-spacing);
|
|
252
|
+
}
|
|
253
|
+
.file-explorer__message {
|
|
254
|
+
display: block;
|
|
255
|
+
padding: var(--file-explorer-list-item-spacing) 0;
|
|
256
|
+
color: var(--file-explorer-message-color);
|
|
257
|
+
}
|
|
258
|
+
.file-explorer__image-preview {
|
|
259
|
+
max-width: 100%;
|
|
260
|
+
margin: 0 auto;
|
|
261
|
+
}
|
|
262
|
+
.file-explorer-preview__title {
|
|
263
|
+
font-size: var(--font-size--h1);
|
|
264
|
+
font-weight: var(--font-weight--semi-bold);
|
|
265
|
+
overflow: hidden;
|
|
266
|
+
text-overflow: ellipsis;
|
|
267
|
+
white-space: nowrap;
|
|
268
|
+
}
|
|
269
|
+
.file-explorer-preview__download {
|
|
270
|
+
color: var(--file-explorer-action-primary-color);
|
|
271
|
+
font-weight: var(--font-weight--semi-bold);
|
|
272
|
+
}
|
|
273
|
+
.file-explorer-preview__download:hover {
|
|
274
|
+
text-decoration-line: underline;
|
|
275
|
+
}
|
|
276
|
+
.file-explorer-preview__info {
|
|
277
|
+
margin-top: 14px;
|
|
278
|
+
}
|
|
279
|
+
.file-explorer-preview__info span {
|
|
280
|
+
color: var(--file-explorer-message-color);
|
|
281
|
+
}
|
|
282
|
+
.file-explorer-preview__info button {
|
|
283
|
+
cursor: pointer;
|
|
284
|
+
}
|
|
285
|
+
.file-explorer__scroll-back-button {
|
|
286
|
+
position: fixed;
|
|
287
|
+
bottom: var(--file-explorer-default-spacing);
|
|
288
|
+
right: var(--file-explorer-default-spacing);
|
|
289
|
+
z-index: 2;
|
|
290
|
+
background: var(--file-explorer-action-primary-color);
|
|
291
|
+
color: var(--file-explorer-action-primary-color-contrast);
|
|
292
|
+
padding: var(--file-explorer-list-item-spacing);
|
|
293
|
+
border-radius: var(--file-explorer-list-item-border-radius);
|
|
294
|
+
}
|
|
295
|
+
.file-explorer__file-icon--large {
|
|
296
|
+
width: 100%;
|
|
297
|
+
text-align: center;
|
|
298
|
+
padding: calc(2 * var(--file-explorer-default-spacing));
|
|
299
|
+
}
|
|
300
|
+
.file-explorer__file-icon--large :global(i) {
|
|
301
|
+
font-size: var(--file-explorer-preview-icon-size);
|
|
302
|
+
}
|
|
303
|
+
.file-explorer__text--semi-bold {
|
|
304
|
+
font-weight: var(--file-explorer-text-semi-bold);
|
|
305
|
+
}
|
|
306
|
+
.file-explorer__loader {
|
|
307
|
+
display: flex;
|
|
308
|
+
justify-content: center;
|
|
309
|
+
}
|
|
310
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
extension: string;
|
|
5
|
+
size?: "default" | "large" | "grid";
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type FileIconProps = typeof __propDef.props;
|
|
15
|
+
export type FileIconEvents = typeof __propDef.events;
|
|
16
|
+
export type FileIconSlots = typeof __propDef.slots;
|
|
17
|
+
export default class FileIcon extends SvelteComponent<FileIconProps, FileIconEvents, FileIconSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|