@brftech/filex-core 0.1.56
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/LICENSE +21 -0
- package/README.md +108 -0
- package/dist/ArchiveViewer-CJdaw5x3.js +99 -0
- package/dist/ArchiveViewer-CJdaw5x3.js.map +1 -0
- package/dist/CsvViewer-QYx_tePQ.js +132 -0
- package/dist/CsvViewer-QYx_tePQ.js.map +1 -0
- package/dist/DrawioViewer-GWt0TyB7.js +141 -0
- package/dist/DrawioViewer-GWt0TyB7.js.map +1 -0
- package/dist/EpubViewer-Je0ywklQ.js +146 -0
- package/dist/EpubViewer-Je0ywklQ.js.map +1 -0
- package/dist/IpynbViewer-TsB4gqP-.js +175 -0
- package/dist/IpynbViewer-TsB4gqP-.js.map +1 -0
- package/dist/MermaidViewer-CXfeDS-7.js +128 -0
- package/dist/MermaidViewer-CXfeDS-7.js.map +1 -0
- package/dist/PsdViewer-VtPpxKVe.js +113 -0
- package/dist/PsdViewer-VtPpxKVe.js.map +1 -0
- package/dist/TiffViewer-OINn9bbb.js +133 -0
- package/dist/TiffViewer-OINn9bbb.js.map +1 -0
- package/dist/UTIF-Cjsrlm0l.js +3104 -0
- package/dist/UTIF-Cjsrlm0l.js.map +1 -0
- package/dist/Viewer3D-xvvyiWHd.js +61 -0
- package/dist/Viewer3D-xvvyiWHd.js.map +1 -0
- package/dist/_commonjsHelpers-DaMA6jEr.js +9 -0
- package/dist/_commonjsHelpers-DaMA6jEr.js.map +1 -0
- package/dist/filex-core.js +26 -0
- package/dist/filex-core.js.map +1 -0
- package/dist/filex-core.umd.cjs +285 -0
- package/dist/filex-core.umd.cjs.map +1 -0
- package/dist/index-CmSYzt6L.js +5404 -0
- package/dist/index-CmSYzt6L.js.map +1 -0
- package/dist/index-UFULWo35.js +10736 -0
- package/dist/index-UFULWo35.js.map +1 -0
- package/dist/index.d.ts +1089 -0
- package/dist/katex-yuB6V-q6.js +11616 -0
- package/dist/katex-yuB6V-q6.js.map +1 -0
- package/dist/papaparse.min-VB1HBwYX.js +441 -0
- package/dist/papaparse.min-VB1HBwYX.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/useViewerFetch-czqbd2Lj.js +25 -0
- package/dist/useViewerFetch-czqbd2Lj.js.map +1 -0
- package/package.json +113 -0
- package/src/FileExplorer.vue +1872 -0
- package/src/components/Breadcrumb.vue +282 -0
- package/src/components/ContextMenu.vue +152 -0
- package/src/components/GridView.vue +166 -0
- package/src/components/ListView.vue +212 -0
- package/src/components/PendingOpsTray.vue +91 -0
- package/src/components/RecentlyOpened.vue +155 -0
- package/src/components/StarButton.vue +101 -0
- package/src/components/TagPicker.vue +184 -0
- package/src/components/Toolbar.vue +220 -0
- package/src/components/UploadProgress.vue +78 -0
- package/src/composables/useFileApi.ts +692 -0
- package/src/composables/useKeyboardShortcuts.ts +144 -0
- package/src/composables/useLocale.ts +60 -0
- package/src/composables/useMonacoLoader.ts +98 -0
- package/src/composables/usePendingOps.ts +200 -0
- package/src/composables/useSelection.ts +81 -0
- package/src/composables/useUploadChunked.ts +250 -0
- package/src/composables/useViewerFetch.ts +58 -0
- package/src/index.ts +80 -0
- package/src/locales/en.ts +122 -0
- package/src/locales/index.ts +12 -0
- package/src/locales/tr.ts +122 -0
- package/src/modals/ConvertModal.vue +254 -0
- package/src/modals/DeleteConfirmModal.vue +32 -0
- package/src/modals/Modal.vue +104 -0
- package/src/modals/NewFolderModal.vue +64 -0
- package/src/modals/PermissionsModal.vue +815 -0
- package/src/modals/PreviewModal.vue +1070 -0
- package/src/modals/RenameModal.vue +58 -0
- package/src/modals/ShareModal.vue +135 -0
- package/src/styles/base.css +1224 -0
- package/src/styles/variables.css +90 -0
- package/src/types/ExplorerConfig.ts +282 -0
- package/src/types/FileNode.ts +136 -0
- package/src/types/index.ts +27 -0
- package/src/types/peers.d.ts +45 -0
- package/src/viewers/ArchiveViewer.vue +186 -0
- package/src/viewers/CsvViewer.vue +319 -0
- package/src/viewers/DrawioViewer.vue +243 -0
- package/src/viewers/EpubViewer.vue +307 -0
- package/src/viewers/IpynbViewer.vue +365 -0
- package/src/viewers/MermaidViewer.vue +259 -0
- package/src/viewers/PdfViewer.vue +562 -0
- package/src/viewers/PsdViewer.vue +264 -0
- package/src/viewers/TiffViewer.vue +273 -0
- package/src/viewers/Viewer3D.vue +120 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* TagPicker — small chip list with add/remove for a node.
|
|
4
|
+
*
|
|
5
|
+
* Reads `GET /api/files/manager/tags?node_id=…` on mount, writes the
|
|
6
|
+
* full new array via `POST /api/files/manager/tags`.
|
|
7
|
+
*
|
|
8
|
+
* Tag colors are deterministic: hash(name) → palette index. Consumers
|
|
9
|
+
* can override with the `palette` prop.
|
|
10
|
+
*/
|
|
11
|
+
import { ref, watch, onMounted, computed } from 'vue';
|
|
12
|
+
|
|
13
|
+
const props = defineProps<{
|
|
14
|
+
nodeId: number;
|
|
15
|
+
apiBase?: string;
|
|
16
|
+
authHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
|
|
17
|
+
/** Optional list of palette swatches; one is picked per tag deterministically. */
|
|
18
|
+
palette?: string[];
|
|
19
|
+
}>();
|
|
20
|
+
|
|
21
|
+
const emit = defineEmits<{
|
|
22
|
+
(e: 'change', tags: string[]): void;
|
|
23
|
+
(e: 'error', message: string): void;
|
|
24
|
+
}>();
|
|
25
|
+
|
|
26
|
+
const tags = ref<string[]>([]);
|
|
27
|
+
const loading = ref(false);
|
|
28
|
+
const adding = ref(false);
|
|
29
|
+
const newTag = ref('');
|
|
30
|
+
|
|
31
|
+
const palette = computed(() => props.palette ?? [
|
|
32
|
+
'#ef4444', '#f59e0b', '#10b981', '#3b82f6',
|
|
33
|
+
'#8b5cf6', '#ec4899', '#14b8a6', '#f97316',
|
|
34
|
+
]);
|
|
35
|
+
|
|
36
|
+
function colorFor(tag: string): string {
|
|
37
|
+
let h = 0;
|
|
38
|
+
for (let i = 0; i < tag.length; i++) h = (h * 31 + tag.charCodeAt(i)) | 0;
|
|
39
|
+
const arr = palette.value;
|
|
40
|
+
return arr[Math.abs(h) % arr.length];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async function buildHeaders(extra: Record<string, string> = {}): Promise<Record<string, string>> {
|
|
44
|
+
return { ...(await (props.authHeaders ?? (() => ({})))()), ...extra };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function load() {
|
|
48
|
+
loading.value = true;
|
|
49
|
+
try {
|
|
50
|
+
const base = props.apiBase ?? '';
|
|
51
|
+
const res = await fetch(`${base}/api/files/manager/tags?node_id=${props.nodeId}`, {
|
|
52
|
+
headers: await buildHeaders(),
|
|
53
|
+
credentials: 'include',
|
|
54
|
+
});
|
|
55
|
+
if (res.ok) {
|
|
56
|
+
const body = await res.json();
|
|
57
|
+
tags.value = Array.isArray(body.tags) ? body.tags : [];
|
|
58
|
+
}
|
|
59
|
+
} catch (err) {
|
|
60
|
+
emit('error', err instanceof Error ? err.message : String(err));
|
|
61
|
+
} finally {
|
|
62
|
+
loading.value = false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function persist(next: string[]) {
|
|
67
|
+
const previous = [...tags.value];
|
|
68
|
+
tags.value = next;
|
|
69
|
+
try {
|
|
70
|
+
const base = props.apiBase ?? '';
|
|
71
|
+
const res = await fetch(`${base}/api/files/manager/tags`, {
|
|
72
|
+
method: 'POST',
|
|
73
|
+
headers: await buildHeaders({ 'Content-Type': 'application/json' }),
|
|
74
|
+
credentials: 'include',
|
|
75
|
+
body: JSON.stringify({ node_id: props.nodeId, tags: next }),
|
|
76
|
+
});
|
|
77
|
+
if (!res.ok) throw new Error(`tag save failed: ${res.status}`);
|
|
78
|
+
emit('change', next);
|
|
79
|
+
} catch (err) {
|
|
80
|
+
tags.value = previous;
|
|
81
|
+
emit('error', err instanceof Error ? err.message : String(err));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function add() {
|
|
86
|
+
const v = newTag.value.trim();
|
|
87
|
+
if (!v || tags.value.includes(v)) {
|
|
88
|
+
newTag.value = '';
|
|
89
|
+
adding.value = false;
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
persist([...tags.value, v]);
|
|
93
|
+
newTag.value = '';
|
|
94
|
+
adding.value = false;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function remove(tag: string) {
|
|
98
|
+
persist(tags.value.filter((t) => t !== tag));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
onMounted(load);
|
|
102
|
+
watch(() => props.nodeId, load);
|
|
103
|
+
</script>
|
|
104
|
+
|
|
105
|
+
<template>
|
|
106
|
+
<div class="filex-tag-picker" :class="{ 'is-loading': loading }">
|
|
107
|
+
<span
|
|
108
|
+
v-for="tag in tags"
|
|
109
|
+
:key="tag"
|
|
110
|
+
class="filex-tag"
|
|
111
|
+
:style="{ '--filex-tag-color': colorFor(tag) }"
|
|
112
|
+
>
|
|
113
|
+
{{ tag }}
|
|
114
|
+
<button class="filex-tag-x" type="button" @click="remove(tag)" aria-label="Remove tag">×</button>
|
|
115
|
+
</span>
|
|
116
|
+
|
|
117
|
+
<form v-if="adding" class="filex-tag-add" @submit.prevent="add">
|
|
118
|
+
<input
|
|
119
|
+
v-model="newTag"
|
|
120
|
+
autofocus
|
|
121
|
+
placeholder="tag name"
|
|
122
|
+
@blur="add"
|
|
123
|
+
@keydown.escape="adding = false; newTag = ''"
|
|
124
|
+
/>
|
|
125
|
+
</form>
|
|
126
|
+
<button v-else class="filex-tag-add-btn" type="button" @click="adding = true">+ Add tag</button>
|
|
127
|
+
</div>
|
|
128
|
+
</template>
|
|
129
|
+
|
|
130
|
+
<style scoped>
|
|
131
|
+
.filex-tag-picker {
|
|
132
|
+
display: flex;
|
|
133
|
+
flex-wrap: wrap;
|
|
134
|
+
gap: 6px;
|
|
135
|
+
align-items: center;
|
|
136
|
+
}
|
|
137
|
+
.filex-tag-picker.is-loading {
|
|
138
|
+
opacity: 0.6;
|
|
139
|
+
pointer-events: none;
|
|
140
|
+
}
|
|
141
|
+
.filex-tag {
|
|
142
|
+
display: inline-flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
gap: 4px;
|
|
145
|
+
border-radius: 999px;
|
|
146
|
+
padding: 2px 10px;
|
|
147
|
+
font-size: 12px;
|
|
148
|
+
font-weight: 500;
|
|
149
|
+
color: #fff;
|
|
150
|
+
background: var(--filex-tag-color);
|
|
151
|
+
}
|
|
152
|
+
.filex-tag-x {
|
|
153
|
+
background: transparent;
|
|
154
|
+
border: none;
|
|
155
|
+
color: rgba(255, 255, 255, 0.85);
|
|
156
|
+
cursor: pointer;
|
|
157
|
+
padding: 0 2px;
|
|
158
|
+
font-size: 14px;
|
|
159
|
+
line-height: 1;
|
|
160
|
+
}
|
|
161
|
+
.filex-tag-x:hover {
|
|
162
|
+
color: #fff;
|
|
163
|
+
}
|
|
164
|
+
.filex-tag-add input {
|
|
165
|
+
border: 1px solid var(--filex-border, #d1d5db);
|
|
166
|
+
border-radius: 12px;
|
|
167
|
+
padding: 2px 10px;
|
|
168
|
+
font-size: 12px;
|
|
169
|
+
width: 110px;
|
|
170
|
+
}
|
|
171
|
+
.filex-tag-add-btn {
|
|
172
|
+
border: 1px dashed var(--filex-border, #d1d5db);
|
|
173
|
+
background: transparent;
|
|
174
|
+
border-radius: 999px;
|
|
175
|
+
padding: 2px 10px;
|
|
176
|
+
font-size: 12px;
|
|
177
|
+
color: var(--filex-text-muted, #6b7280);
|
|
178
|
+
cursor: pointer;
|
|
179
|
+
}
|
|
180
|
+
.filex-tag-add-btn:hover {
|
|
181
|
+
border-color: var(--filex-accent, #6366f1);
|
|
182
|
+
color: var(--filex-accent, #6366f1);
|
|
183
|
+
}
|
|
184
|
+
</style>
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Toolbar — selection-aware action row.
|
|
4
|
+
*
|
|
5
|
+
* Layout:
|
|
6
|
+
* - No selection → [📁 Yeni Klasör] [search | ⬆ ↻] [☰ ▦]
|
|
7
|
+
* - 1 file selected → [👁 ⬇ 🔗 ✎ 🗑] [search | ⬆ ↻] [☰ ▦]
|
|
8
|
+
* - 1 folder selected → [↗ ✎ 🗑] [search | ⬆ ↻] [☰ ▦]
|
|
9
|
+
* - Multi selection → [✂ ❐ 🗑] [search | ⬆ ↻] [☰ ▦]
|
|
10
|
+
*
|
|
11
|
+
* Presentational only — all logic (rename, share, …) lives in
|
|
12
|
+
* FileExplorer.vue, which listens for `action` emits.
|
|
13
|
+
*/
|
|
14
|
+
import { computed, ref, watch } from 'vue';
|
|
15
|
+
import type { ViewMode } from '../types/FileNode';
|
|
16
|
+
import type { LocaleCode } from '../types/ExplorerConfig';
|
|
17
|
+
import type { ContextAction } from './ContextMenu.vue';
|
|
18
|
+
import { useLocale } from '../composables/useLocale';
|
|
19
|
+
|
|
20
|
+
export type SelectionMode = 'none' | 'single-file' | 'single-dir' | 'multi';
|
|
21
|
+
|
|
22
|
+
const props = defineProps<{
|
|
23
|
+
viewMode: ViewMode;
|
|
24
|
+
searchQuery: string;
|
|
25
|
+
/**
|
|
26
|
+
* Tells the toolbar which action set to render (a `.trash/` listing
|
|
27
|
+
* gets a restore-only menu instead of cut/copy/etc).
|
|
28
|
+
*/
|
|
29
|
+
trashActive: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The action list to render, supplied by FileExplorer. This is the SAME
|
|
32
|
+
* list the right-click context menu renders for the current selection, so
|
|
33
|
+
* the two menus can never drift apart. Dividers/hidden entries are filtered
|
|
34
|
+
* out here (the toolbar is a flat row).
|
|
35
|
+
*/
|
|
36
|
+
actions: ContextAction[];
|
|
37
|
+
/** Current selection metadata — toolbar uses this to pick its mode. */
|
|
38
|
+
selectionMode?: SelectionMode;
|
|
39
|
+
/** True when clipboard has cut/copy items, so we can enable Paste. */
|
|
40
|
+
pasteEnabled?: boolean;
|
|
41
|
+
/** True when the universal converter (FILEX_CONVERT_URL) is available. */
|
|
42
|
+
convertEnabled?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* True when the current dir has a parent the user can step up to.
|
|
45
|
+
* Hidden at storage root because there's nothing above it.
|
|
46
|
+
*/
|
|
47
|
+
canGoUp?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Multi-storage virtual root marker — when true, mutation buttons
|
|
50
|
+
* (New Folder / Upload / Paste) are hidden because there's no real
|
|
51
|
+
* backend folder to write to.
|
|
52
|
+
*/
|
|
53
|
+
atVirtualRoot?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* RBAC: false hides the write affordances (New Folder / Upload / Paste) when
|
|
56
|
+
* the current user lacks edit on this directory. Undefined = no RBAC gating
|
|
57
|
+
* (backward-compatible for embedders that don't pass it).
|
|
58
|
+
*/
|
|
59
|
+
canWrite?: boolean;
|
|
60
|
+
locale: LocaleCode;
|
|
61
|
+
}>();
|
|
62
|
+
|
|
63
|
+
const emit = defineEmits<{
|
|
64
|
+
(e: 'update:viewMode', v: ViewMode): void;
|
|
65
|
+
(e: 'update:searchQuery', v: string): void;
|
|
66
|
+
(e: 'new-folder'): void;
|
|
67
|
+
(e: 'upload'): void;
|
|
68
|
+
(e: 'refresh'): void;
|
|
69
|
+
(e: 'go-up'): void;
|
|
70
|
+
(e: 'action', key: string): void;
|
|
71
|
+
(e: 'open-recents'): void;
|
|
72
|
+
}>();
|
|
73
|
+
|
|
74
|
+
const { t } = useLocale(() => props.locale);
|
|
75
|
+
|
|
76
|
+
const searchEl = ref<HTMLInputElement | null>(null);
|
|
77
|
+
const localSearch = ref(props.searchQuery);
|
|
78
|
+
|
|
79
|
+
watch(() => props.searchQuery, (v) => {
|
|
80
|
+
localSearch.value = v;
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
let debounce: ReturnType<typeof setTimeout> | undefined;
|
|
84
|
+
function onSearchInput(ev: Event) {
|
|
85
|
+
const v = (ev.target as HTMLInputElement).value;
|
|
86
|
+
localSearch.value = v;
|
|
87
|
+
if (debounce) clearTimeout(debounce);
|
|
88
|
+
debounce = setTimeout(() => emit('update:searchQuery', v), 200);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function focusSearch() {
|
|
92
|
+
searchEl.value?.focus();
|
|
93
|
+
searchEl.value?.select();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
defineExpose({ focusSearch });
|
|
97
|
+
|
|
98
|
+
const mode = computed<SelectionMode>(() => props.selectionMode ?? 'none');
|
|
99
|
+
|
|
100
|
+
// The visible action buttons = the shared list from FileExplorer, minus
|
|
101
|
+
// dividers and hidden entries (the toolbar is a flat row, not a dropdown).
|
|
102
|
+
// Disabled entries render greyed-out. Because this is the SAME list the
|
|
103
|
+
// context menu uses, the two menus are guaranteed to match.
|
|
104
|
+
const toolbarItems = computed(() => props.actions.filter((a) => !a.divider && !a.hidden));
|
|
105
|
+
|
|
106
|
+
function fire(key: string) {
|
|
107
|
+
emit('action', key);
|
|
108
|
+
}
|
|
109
|
+
</script>
|
|
110
|
+
|
|
111
|
+
<template>
|
|
112
|
+
<div class="fe-toolbar">
|
|
113
|
+
<div class="fe-toolbar__primary">
|
|
114
|
+
<button
|
|
115
|
+
v-if="canGoUp"
|
|
116
|
+
type="button"
|
|
117
|
+
class="fe-btn fe-btn--icon-only"
|
|
118
|
+
:title="t('toolbar.go_up')"
|
|
119
|
+
:aria-label="t('toolbar.go_up')"
|
|
120
|
+
@click="emit('go-up')"
|
|
121
|
+
>
|
|
122
|
+
<span class="fe-icon">↑</span>
|
|
123
|
+
</button>
|
|
124
|
+
|
|
125
|
+
<button
|
|
126
|
+
v-if="mode === 'none' && !trashActive && !atVirtualRoot && canWrite !== false"
|
|
127
|
+
type="button"
|
|
128
|
+
class="fe-btn fe-btn--primary"
|
|
129
|
+
:title="t('toolbar.new_folder')"
|
|
130
|
+
@click="emit('new-folder')"
|
|
131
|
+
>
|
|
132
|
+
<span class="fe-icon">📁</span>
|
|
133
|
+
<span class="fe-btn__label">{{ t('toolbar.new_folder') }}</span>
|
|
134
|
+
</button>
|
|
135
|
+
|
|
136
|
+
<button
|
|
137
|
+
v-for="a in toolbarItems"
|
|
138
|
+
:key="a.key"
|
|
139
|
+
type="button"
|
|
140
|
+
class="fe-btn"
|
|
141
|
+
:class="{ 'fe-btn--danger': a.danger, 'is-disabled': a.disabled }"
|
|
142
|
+
:disabled="a.disabled"
|
|
143
|
+
:title="a.label"
|
|
144
|
+
@click="fire(a.key)"
|
|
145
|
+
>
|
|
146
|
+
<span class="fe-icon">{{ a.icon }}</span>
|
|
147
|
+
<span class="fe-btn__label">{{ a.label }}</span>
|
|
148
|
+
</button>
|
|
149
|
+
|
|
150
|
+
<button
|
|
151
|
+
v-if="pasteEnabled && mode === 'none' && !trashActive && !atVirtualRoot && canWrite !== false"
|
|
152
|
+
type="button"
|
|
153
|
+
class="fe-btn"
|
|
154
|
+
:title="t('ctx.paste')"
|
|
155
|
+
@click="fire('paste')"
|
|
156
|
+
>
|
|
157
|
+
<span class="fe-icon">📋</span>
|
|
158
|
+
<span class="fe-btn__label">{{ t('ctx.paste') }}</span>
|
|
159
|
+
</button>
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
<div class="fe-toolbar__spacer" />
|
|
163
|
+
|
|
164
|
+
<div class="fe-toolbar__search-group">
|
|
165
|
+
<div class="fe-search">
|
|
166
|
+
<input
|
|
167
|
+
ref="searchEl"
|
|
168
|
+
type="search"
|
|
169
|
+
class="fe-search__input"
|
|
170
|
+
:placeholder="t('toolbar.search.placeholder')"
|
|
171
|
+
:value="localSearch"
|
|
172
|
+
aria-label="Search"
|
|
173
|
+
@input="onSearchInput"
|
|
174
|
+
/>
|
|
175
|
+
</div>
|
|
176
|
+
<button
|
|
177
|
+
v-if="!atVirtualRoot && canWrite !== false"
|
|
178
|
+
type="button"
|
|
179
|
+
class="fe-btn fe-btn--icon-only"
|
|
180
|
+
:title="t('toolbar.upload')"
|
|
181
|
+
@click="emit('upload')"
|
|
182
|
+
>
|
|
183
|
+
<span class="fe-icon">⬆</span>
|
|
184
|
+
</button>
|
|
185
|
+
<button
|
|
186
|
+
type="button"
|
|
187
|
+
class="fe-btn fe-btn--icon-only"
|
|
188
|
+
:title="t('toolbar.refresh')"
|
|
189
|
+
@click="emit('refresh')"
|
|
190
|
+
>
|
|
191
|
+
<span class="fe-icon">↻</span>
|
|
192
|
+
</button>
|
|
193
|
+
</div>
|
|
194
|
+
|
|
195
|
+
<div class="fe-toolbar__view" role="tablist" aria-label="View">
|
|
196
|
+
<button
|
|
197
|
+
type="button"
|
|
198
|
+
class="fe-btn fe-btn--icon-only"
|
|
199
|
+
:class="{ 'is-active': viewMode === 'list' }"
|
|
200
|
+
role="tab"
|
|
201
|
+
:aria-selected="viewMode === 'list'"
|
|
202
|
+
:title="t('toolbar.view.list')"
|
|
203
|
+
@click="emit('update:viewMode', 'list')"
|
|
204
|
+
>
|
|
205
|
+
<span class="fe-icon">☰</span>
|
|
206
|
+
</button>
|
|
207
|
+
<button
|
|
208
|
+
type="button"
|
|
209
|
+
class="fe-btn fe-btn--icon-only"
|
|
210
|
+
:class="{ 'is-active': viewMode === 'grid' }"
|
|
211
|
+
role="tab"
|
|
212
|
+
:aria-selected="viewMode === 'grid'"
|
|
213
|
+
:title="t('toolbar.view.grid')"
|
|
214
|
+
@click="emit('update:viewMode', 'grid')"
|
|
215
|
+
>
|
|
216
|
+
<span class="fe-icon">▦</span>
|
|
217
|
+
</button>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
</template>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* UploadProgress — floating footer showing active + recently-done uploads.
|
|
4
|
+
*/
|
|
5
|
+
import { computed } from 'vue';
|
|
6
|
+
import type { UploadJob } from '../composables/useUploadChunked';
|
|
7
|
+
import type { LocaleCode } from '../types/ExplorerConfig';
|
|
8
|
+
import { useLocale } from '../composables/useLocale';
|
|
9
|
+
|
|
10
|
+
const props = defineProps<{
|
|
11
|
+
jobs: UploadJob[];
|
|
12
|
+
locale: LocaleCode;
|
|
13
|
+
}>();
|
|
14
|
+
|
|
15
|
+
const emit = defineEmits<{
|
|
16
|
+
(e: 'cancel', job: UploadJob): void;
|
|
17
|
+
(e: 'dismiss', job: UploadJob): void;
|
|
18
|
+
}>();
|
|
19
|
+
|
|
20
|
+
const { t, formatSize } = useLocale(() => props.locale);
|
|
21
|
+
|
|
22
|
+
const visible = computed(() => props.jobs);
|
|
23
|
+
|
|
24
|
+
function statusLabel(j: UploadJob): string {
|
|
25
|
+
switch (j.status) {
|
|
26
|
+
case 'done':
|
|
27
|
+
return t('upload.done');
|
|
28
|
+
case 'error':
|
|
29
|
+
return `${t('upload.error')}: ${j.error ?? ''}`;
|
|
30
|
+
case 'aborted':
|
|
31
|
+
return t('upload.aborted');
|
|
32
|
+
default:
|
|
33
|
+
return t('upload.progress');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<transition name="fe-upload-slide">
|
|
40
|
+
<div v-if="visible.length > 0" class="fe-upload">
|
|
41
|
+
<div class="fe-upload__header">
|
|
42
|
+
<strong>{{ t('upload.progress') }}</strong>
|
|
43
|
+
<span class="fe-upload__count">{{ visible.length }}</span>
|
|
44
|
+
</div>
|
|
45
|
+
<ul class="fe-upload__list">
|
|
46
|
+
<li
|
|
47
|
+
v-for="j in visible"
|
|
48
|
+
:key="j.id"
|
|
49
|
+
class="fe-upload__item"
|
|
50
|
+
:class="`is-${j.status}`"
|
|
51
|
+
>
|
|
52
|
+
<div class="fe-upload__name" :title="j.file.name">{{ j.file.name }}</div>
|
|
53
|
+
<div class="fe-upload__bar" :aria-valuenow="j.percent" role="progressbar">
|
|
54
|
+
<div class="fe-upload__bar-fill" :style="{ width: j.percent + '%' }" />
|
|
55
|
+
</div>
|
|
56
|
+
<div class="fe-upload__meta">
|
|
57
|
+
<span>{{ statusLabel(j) }}</span>
|
|
58
|
+
<span>{{ formatSize(j.uploadedBytes) }} / {{ formatSize(j.totalBytes) }}</span>
|
|
59
|
+
<button
|
|
60
|
+
v-if="j.status === 'uploading' || j.status === 'initializing'"
|
|
61
|
+
type="button"
|
|
62
|
+
class="fe-upload__cancel"
|
|
63
|
+
@click="emit('cancel', j)"
|
|
64
|
+
>
|
|
65
|
+
{{ t('upload.cancel') }}
|
|
66
|
+
</button>
|
|
67
|
+
<button
|
|
68
|
+
v-else
|
|
69
|
+
type="button"
|
|
70
|
+
class="fe-upload__cancel"
|
|
71
|
+
@click="emit('dismiss', j)"
|
|
72
|
+
>×</button>
|
|
73
|
+
</div>
|
|
74
|
+
</li>
|
|
75
|
+
</ul>
|
|
76
|
+
</div>
|
|
77
|
+
</transition>
|
|
78
|
+
</template>
|