@brftech/filex-core 0.39.1 → 0.41.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 +32 -25
- package/dist/ArchiveViewer-BNqukFg8.js +124 -0
- package/dist/ArchiveViewer-BNqukFg8.js.map +1 -0
- package/dist/CsvViewer-ii_-MgmG.js +141 -0
- package/dist/CsvViewer-ii_-MgmG.js.map +1 -0
- package/dist/{DrawioViewer-BNALOB04.js → DrawioViewer-B2tuu4rX.js} +48 -42
- package/dist/DrawioViewer-B2tuu4rX.js.map +1 -0
- package/dist/EpubViewer-p4B8iiWb.js +163 -0
- package/dist/EpubViewer-p4B8iiWb.js.map +1 -0
- package/dist/IpynbViewer-D_qYRJhu.js +184 -0
- package/dist/IpynbViewer-D_qYRJhu.js.map +1 -0
- package/dist/MermaidViewer-3ZkfNM8v.js +137 -0
- package/dist/MermaidViewer-3ZkfNM8v.js.map +1 -0
- package/dist/PsdViewer-CuV-OPSd.js +122 -0
- package/dist/PsdViewer-CuV-OPSd.js.map +1 -0
- package/dist/TiffViewer-BLeoF4Be.js +142 -0
- package/dist/TiffViewer-BLeoF4Be.js.map +1 -0
- package/dist/Viewer3D-DHhhU76E.js +75 -0
- package/dist/Viewer3D-DHhhU76E.js.map +1 -0
- package/dist/filex-core.js +217 -20077
- package/dist/filex-core.js.map +1 -1
- package/dist/filex-core.umd.cjs +61 -62
- package/dist/filex-core.umd.cjs.map +1 -1
- package/dist/index-BraG7Cz4.js +26664 -0
- package/dist/index-BraG7Cz4.js.map +1 -0
- package/dist/index.d.ts +4276 -851
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/FileExplorer.vue +2170 -492
- package/src/components/AdvancedSearch.vue +870 -0
- package/src/components/Breadcrumb.vue +191 -19
- package/src/components/CommandPalette.vue +66 -22
- package/src/components/ConnectionsPanel.vue +6 -2
- package/src/components/ContextMenu.vue +57 -2
- package/src/components/EncryptedFolderModal.vue +31 -25
- package/src/components/FilePane.vue +939 -0
- package/src/components/FilterBar.vue +568 -72
- package/src/components/GalleryView.vue +162 -30
- package/src/components/GridView.vue +322 -58
- package/src/components/HomeView.vue +331 -0
- package/src/components/InspectorPanel.vue +296 -53
- package/src/components/ListView.vue +1158 -167
- package/src/components/NFSExportsPanel.vue +7 -4
- package/src/components/OnboardingTour.vue +156 -33
- package/src/components/QuickLook.vue +34 -5
- package/src/components/RecentlyOpened.vue +17 -2
- package/src/components/S3KeysPanel.vue +7 -4
- package/src/components/SSHKeysPanel.vue +7 -4
- package/src/components/ShortcutSettings.vue +43 -2
- package/src/components/ShortcutsHelp.vue +4 -1
- package/src/components/SideNav.vue +206 -140
- package/src/components/StorageFields.vue +19 -1
- package/src/components/TabBar.vue +87 -1
- package/src/components/TagPicker.vue +77 -6
- package/src/components/ThemeGallery.vue +13 -198
- package/src/components/ThemePalette.vue +244 -0
- package/src/components/TimeZoneDialog.vue +127 -0
- package/src/components/TimeZonePicker.vue +696 -0
- package/src/components/TokensPanel.vue +16 -4
- package/src/components/Toolbar.vue +965 -469
- package/src/components/ViewSwitcher.vue +9 -4
- package/src/composables/useConnections.ts +35 -4
- package/src/composables/useExplorerTimeZone.ts +85 -0
- package/src/composables/useFileApi.ts +53 -4
- package/src/composables/useKeyboardShortcuts.ts +122 -0
- package/src/composables/useLocale.ts +365 -25
- package/src/index.ts +182 -3
- package/src/lib/actionIcons.ts +330 -0
- package/src/lib/advSearch.ts +162 -0
- package/src/lib/dateGroups.ts +197 -0
- package/src/lib/destinationTree.ts +235 -0
- package/src/lib/downloadSelection.ts +154 -0
- package/src/lib/fileFilters.ts +319 -12
- package/src/lib/fileIcons.ts +299 -5
- package/src/lib/filePreview.ts +605 -0
- package/src/lib/listing.ts +72 -0
- package/src/lib/shareTtl.ts +11 -1
- package/src/lib/sortOrder.ts +459 -0
- package/src/lib/themes.ts +152 -23
- package/src/lib/timezone.ts +456 -0
- package/src/lib/uiProfile.ts +82 -0
- package/src/lib/viewPrefs.ts +1036 -0
- package/src/locales/en.ts +432 -25
- package/src/locales/tr.ts +425 -25
- package/src/modals/ConvertModal.vue +23 -3
- package/src/modals/DestinationPickerModal.vue +341 -0
- package/src/modals/Modal.vue +18 -4
- package/src/modals/NewDocumentModal.vue +525 -0
- package/src/modals/NewFolderModal.vue +15 -9
- package/src/modals/PermissionsModal.vue +543 -473
- package/src/modals/PreviewModal.vue +516 -156
- package/src/styles/base.css +5435 -8
- package/src/styles/variables.css +140 -60
- package/src/types/Connections.ts +9 -0
- package/src/types/ExplorerConfig.ts +144 -39
- package/src/types/FileNode.ts +28 -0
- package/src/viewers/ArchiveViewer.vue +46 -8
- package/src/viewers/CsvViewer.vue +19 -2
- package/src/viewers/DrawioViewer.vue +12 -1
- package/src/viewers/EpubViewer.vue +50 -6
- package/src/viewers/IpynbViewer.vue +19 -2
- package/src/viewers/MermaidViewer.vue +20 -3
- package/src/viewers/PdfViewer.vue +24 -4
- package/src/viewers/PsdViewer.vue +28 -4
- package/src/viewers/TiffViewer.vue +19 -2
- package/src/viewers/Viewer3D.vue +36 -2
- package/dist/ArchiveViewer-Cdfv9LFC.js +0 -99
- package/dist/ArchiveViewer-Cdfv9LFC.js.map +0 -1
- package/dist/CsvViewer-CqWeV8VO.js +0 -131
- package/dist/CsvViewer-CqWeV8VO.js.map +0 -1
- package/dist/DrawioViewer-BNALOB04.js.map +0 -1
- package/dist/EpubViewer-BPmlImG7.js +0 -145
- package/dist/EpubViewer-BPmlImG7.js.map +0 -1
- package/dist/IpynbViewer-CDlQmuCV.js +0 -175
- package/dist/IpynbViewer-CDlQmuCV.js.map +0 -1
- package/dist/MermaidViewer-sfZWdR-d.js +0 -127
- package/dist/MermaidViewer-sfZWdR-d.js.map +0 -1
- package/dist/PsdViewer-DwuySZsb.js +0 -112
- package/dist/PsdViewer-DwuySZsb.js.map +0 -1
- package/dist/TiffViewer-BDQ3d3CQ.js +0 -132
- package/dist/TiffViewer-BDQ3d3CQ.js.map +0 -1
- package/dist/Viewer3D-CJJJgkuv.js +0 -60
- package/dist/Viewer3D-CJJJgkuv.js.map +0 -1
- package/src/components/SecondaryPane.vue +0 -447
- package/src/modals/ShareModal.vue +0 -139
|
@@ -1,447 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* SecondaryPane — wiring:d1 the right-hand (secondary) pane of the split view.
|
|
4
|
-
*
|
|
5
|
-
* Deliberately LIGHT: its own path + its own listing — fetched through
|
|
6
|
-
* the SAME FileApi instance the host already constructed (`api.index`,
|
|
7
|
-
* no copied fetch logic) — a small breadcrumb, double-click navigation,
|
|
8
|
-
* click selection and drag&drop in BOTH directions. No toolbar, no
|
|
9
|
-
* inspector, no upload: those belong to the main panel.
|
|
10
|
-
*
|
|
11
|
-
* Path semantics, confinement (`clamp`) and wire-form resolution
|
|
12
|
-
* (`qualify` / `toUser`) are injected from the host so the pane can
|
|
13
|
-
* never drift from the main panel's multi-storage / rootFloor rules.
|
|
14
|
-
*
|
|
15
|
-
* Cross-pane transfers only EMIT (`transfer`); the host decides
|
|
16
|
-
* move-vs-copy and runs the existing ops APIs. Unscoped styles
|
|
17
|
-
* (`fe-split*` in base.css) — webcomponent data-v rule.
|
|
18
|
-
*/
|
|
19
|
-
import { computed, ref } from 'vue';
|
|
20
|
-
import type { FileApi } from '../composables/useFileApi';
|
|
21
|
-
import type { FileNode, ViewMode } from '../types/FileNode';
|
|
22
|
-
import type { LocaleCode } from '../types/ExplorerConfig';
|
|
23
|
-
import { useLocale } from '../composables/useLocale';
|
|
24
|
-
import { filterListing, injectTrashRow, hydrateTrashRow } from '../lib/listing';
|
|
25
|
-
import ListView from './ListView.vue';
|
|
26
|
-
import GridView from './GridView.vue';
|
|
27
|
-
import GalleryView from './GalleryView.vue';
|
|
28
|
-
|
|
29
|
-
// Same literals ListView/GridView already hardcode for the internal DnD
|
|
30
|
-
// channel; `-src` carries the origin directory so the host can move (and
|
|
31
|
-
// undo) correctly across panes.
|
|
32
|
-
const FE_DND_MIME = 'application/x-brf-files';
|
|
33
|
-
const FE_DND_SRC_MIME = 'application/x-brf-files-src';
|
|
34
|
-
import { hasInternalDrag, internalDragItems, internalDragOrigin } from '../lib/dragOut';
|
|
35
|
-
|
|
36
|
-
const props = defineProps<{
|
|
37
|
-
api: FileApi;
|
|
38
|
-
/** Opening location, in the host's `currentPath` form. */
|
|
39
|
-
initialPath: string;
|
|
40
|
-
locale: LocaleCode;
|
|
41
|
-
/** Host's own qualify(): user path → wire `<adapter>://<rel>`. */
|
|
42
|
-
qualify: (p: string) => string;
|
|
43
|
-
/** Host's wire → user-path converter (multi-storage aware). */
|
|
44
|
-
toUser: (wire: string) => string;
|
|
45
|
-
/** Host's rootFloor clamp — keeps the pane inside the confine. */
|
|
46
|
-
clamp: (p: string) => string;
|
|
47
|
-
/** Label for the root crumb (adapter name / storage list). */
|
|
48
|
-
rootLabel: string;
|
|
49
|
-
/** rootFloor (user-path form, '' when unconfined) — trims crumbs. */
|
|
50
|
-
floor?: string;
|
|
51
|
-
/** Multi-storage mode: '' is the virtual drives root (no fetch). */
|
|
52
|
-
multiRoot?: boolean;
|
|
53
|
-
/** Synthesized storage rows for the virtual drives root. */
|
|
54
|
-
virtualRows?: () => FileNode[];
|
|
55
|
-
/** Active-panel highlight (keyboard target). */
|
|
56
|
-
active?: boolean;
|
|
57
|
-
/** ui-fix — the pane renders the SAME view components as the main
|
|
58
|
-
* panel (list/grid/gallery) instead of its own flat list. */
|
|
59
|
-
viewMode?: ViewMode;
|
|
60
|
-
/** ui-fix — authenticated thumb resolver, forwarded to grid/gallery. */
|
|
61
|
-
thumbSrc?: (n: FileNode) => string | null;
|
|
62
|
-
/** Desktop selective sync badge resolver, forwarded to the views. */
|
|
63
|
-
keepBadgeFor?: (n: FileNode) => 'kept' | 'syncing' | 'cloud' | 'partial' | null;
|
|
64
|
-
/** ui-fix — mirror the main panel's virtual `.trash` row at storage root
|
|
65
|
-
* so both split panes list identical rows (no row-offset). Defaults on. */
|
|
66
|
-
trashVisible?: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* The navigation panel is already offering Trash, so neither pane draws the
|
|
69
|
-
* virtual row. Passed down rather than worked out here: the panel belongs to
|
|
70
|
-
* the host explorer, and a pane that guessed at it is how the two halves of a
|
|
71
|
-
* split end up listing different rows.
|
|
72
|
-
*/
|
|
73
|
-
navOffersTrash?: boolean;
|
|
74
|
-
}>();
|
|
75
|
-
|
|
76
|
-
const emit = defineEmits<{
|
|
77
|
-
(e: 'navigate', path: string): void;
|
|
78
|
-
(e: 'activate'): void;
|
|
79
|
-
(e: 'close'): void;
|
|
80
|
-
(e: 'open-tab', path: string): void;
|
|
81
|
-
(e: 'transfer', p: { sources: string[]; targetWire: string; originWire?: string }): void;
|
|
82
|
-
/* ui-fix — right-click inside the side pane: the menu is opened by the main
|
|
83
|
-
* component (FileExplorer). node=null → right-click on empty space (nothing
|
|
84
|
-
* selected, so "Paste" only). */
|
|
85
|
-
(e: 'context', node: FileNode | null, ev: MouseEvent): void;
|
|
86
|
-
/* ui-fix — when the trash row is opened: the trash view belongs to the main
|
|
87
|
-
* panel (it carries the restore actions), so the host opens it via loadTrash(). */
|
|
88
|
-
(e: 'open-trash'): void;
|
|
89
|
-
}>();
|
|
90
|
-
|
|
91
|
-
const { t } = useLocale(() => props.locale);
|
|
92
|
-
|
|
93
|
-
const path = ref<string>('');
|
|
94
|
-
const files = ref<FileNode[]>([]);
|
|
95
|
-
const loading = ref(false);
|
|
96
|
-
const error = ref('');
|
|
97
|
-
const selected = ref(new Set<string>());
|
|
98
|
-
|
|
99
|
-
function isStorageRow(n: FileNode): boolean {
|
|
100
|
-
return n.mime_type === 'inode/storage';
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const atVirtualRoot = computed(
|
|
104
|
-
() => !!props.multiRoot && !(path.value ?? '').replace(/^\/+|\/+$/g, ''),
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
async function loadPane(target?: string): Promise<void> {
|
|
108
|
-
const requested = props.clamp(target ?? path.value ?? '');
|
|
109
|
-
loading.value = true;
|
|
110
|
-
error.value = '';
|
|
111
|
-
try {
|
|
112
|
-
// Multi-storage virtual root: synthesize the drives list, no backend
|
|
113
|
-
// call — mirrors the main panel's load() branch.
|
|
114
|
-
if (props.multiRoot && !requested) {
|
|
115
|
-
files.value = props.virtualRows ? props.virtualRows() : [];
|
|
116
|
-
path.value = '';
|
|
117
|
-
selected.value = new Set();
|
|
118
|
-
emit('navigate', '');
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
const resp = await props.api.index(props.qualify(requested));
|
|
122
|
-
// Same internal-entry filter + virtual `.trash` row as the main panel
|
|
123
|
-
// (shared helpers → both split panes list identical rows, no offset).
|
|
124
|
-
files.value = filterListing(resp.files);
|
|
125
|
-
if (
|
|
126
|
-
injectTrashRow(files.value, resp.adapter, resp.dirname, props.trashVisible !== false, {
|
|
127
|
-
// ⚠ The panel is a sibling of BOTH panes. If it is offering Trash, this
|
|
128
|
-
// pane must drop the row too — otherwise the duplication is not removed,
|
|
129
|
-
// it just moves to the right-hand half of a split.
|
|
130
|
-
navOffersTrash: props.navOffersTrash,
|
|
131
|
-
})
|
|
132
|
-
) {
|
|
133
|
-
void hydrateTrashRow(files.value, resp.adapter, props.api);
|
|
134
|
-
}
|
|
135
|
-
path.value = props.toUser(resp.dirname);
|
|
136
|
-
selected.value = new Set();
|
|
137
|
-
emit('navigate', path.value);
|
|
138
|
-
} catch (err) {
|
|
139
|
-
error.value = err instanceof Error ? err.message : String(err);
|
|
140
|
-
} finally {
|
|
141
|
-
loading.value = false;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
void loadPane(props.initialPath ?? '');
|
|
146
|
-
|
|
147
|
-
// ------------------------------------------------------------------
|
|
148
|
-
// Breadcrumb
|
|
149
|
-
// ------------------------------------------------------------------
|
|
150
|
-
|
|
151
|
-
interface Crumb {
|
|
152
|
-
label: string;
|
|
153
|
-
target: string;
|
|
154
|
-
last: boolean;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
const crumbs = computed<Crumb[]>(() => {
|
|
158
|
-
const clean = (path.value || '').replace(/^\/+|\/+$/g, '');
|
|
159
|
-
const segs = clean ? clean.split('/') : [];
|
|
160
|
-
const floor = (props.floor || '').replace(/^\/+|\/+$/g, '');
|
|
161
|
-
const out: Crumb[] = [];
|
|
162
|
-
let acc = '';
|
|
163
|
-
for (const s of segs) {
|
|
164
|
-
acc = acc ? `${acc}/${s}` : s;
|
|
165
|
-
// Confined embeds: hide the segments strictly ABOVE the floor — the
|
|
166
|
-
// floor segment itself acts as the pane's root crumb.
|
|
167
|
-
if (floor && !(acc === floor || acc.startsWith(floor + '/'))) continue;
|
|
168
|
-
out.push({ label: s, target: acc, last: false });
|
|
169
|
-
}
|
|
170
|
-
if (out.length > 0) out[out.length - 1].last = true;
|
|
171
|
-
return out;
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
const showRootCrumb = computed(() => !props.floor);
|
|
175
|
-
|
|
176
|
-
function crumbGo(target: string) {
|
|
177
|
-
emit('activate');
|
|
178
|
-
void loadPane(target);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// ------------------------------------------------------------------
|
|
182
|
-
// Selection + navigation
|
|
183
|
-
// ------------------------------------------------------------------
|
|
184
|
-
|
|
185
|
-
/* ui-fix — adapter for the shared view components' click contract
|
|
186
|
-
* ({ctrl, shift} mod object instead of a MouseEvent). Shift behaves as
|
|
187
|
-
* ctrl here: the pane keeps a simple Set, no range anchor. */
|
|
188
|
-
function onViewClick(n: FileNode, mod: { ctrl: boolean; shift: boolean }) {
|
|
189
|
-
emit('activate');
|
|
190
|
-
const multi = mod.ctrl || mod.shift;
|
|
191
|
-
const next = new Set<string>(multi ? selected.value : []);
|
|
192
|
-
if (multi && next.has(n.path)) next.delete(n.path);
|
|
193
|
-
else next.add(n.path);
|
|
194
|
-
selected.value = next;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/* ui-fix — right-click on a pane item: activate + select it, then let the
|
|
198
|
-
* host open the pane context menu (its actions are pane-routed). Selecting
|
|
199
|
-
* first keeps the menu's targets on THIS pane, not the main panel. */
|
|
200
|
-
function onViewContext(n: FileNode, ev: MouseEvent) {
|
|
201
|
-
ev.preventDefault();
|
|
202
|
-
ev.stopPropagation();
|
|
203
|
-
emit('activate');
|
|
204
|
-
if (!selected.value.has(n.path)) selected.value = new Set([n.path]);
|
|
205
|
-
emit('context', n, ev);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/* ui-fix — right-click on empty space (the background): a selection-less menu
|
|
209
|
-
* ("Paste" only) → pasting files into an empty / into the current folder. The
|
|
210
|
-
* row menu calls stopProp, so this only fires on genuinely empty space. */
|
|
211
|
-
function onBgContext(ev: MouseEvent) {
|
|
212
|
-
ev.preventDefault();
|
|
213
|
-
ev.stopPropagation(); // don't bubble into the canvas menu on the FileExplorer root
|
|
214
|
-
emit('activate');
|
|
215
|
-
selected.value = new Set();
|
|
216
|
-
emit('context', null, ev);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/* ui-fix — drop-into from the shared views: same payload path as the
|
|
220
|
-
* old flat rows (dir check + wire-qualified row paths). */
|
|
221
|
-
function onViewDropInto(target: FileNode, ev: DragEvent) {
|
|
222
|
-
dropBg.value = false;
|
|
223
|
-
if (target.type !== 'dir' || isStorageRow(target)) return;
|
|
224
|
-
if (!acceptDrag(ev)) return;
|
|
225
|
-
handleDropPayload(ev, target.path);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
function onRowDbl(n: FileNode) {
|
|
229
|
-
if (n.type !== 'dir') return;
|
|
230
|
-
// The virtual `.trash` row opens the backend trash listing (restore
|
|
231
|
-
// actions) — that view lives in the main panel; let the host open it.
|
|
232
|
-
if (n.basename === '.trash') {
|
|
233
|
-
emit('activate');
|
|
234
|
-
emit('open-trash');
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
void loadPane(isStorageRow(n) ? n.path : props.toUser(n.path));
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
function clearSelection() {
|
|
241
|
-
selected.value = new Set();
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// ------------------------------------------------------------------
|
|
245
|
-
// Drag source
|
|
246
|
-
// ------------------------------------------------------------------
|
|
247
|
-
|
|
248
|
-
function onRowDragStart(n: FileNode, ev: DragEvent) {
|
|
249
|
-
if (!ev.dataTransfer) return;
|
|
250
|
-
if (isStorageRow(n) || atVirtualRoot.value || n.basename === '.trash') {
|
|
251
|
-
ev.preventDefault();
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
if (!selected.value.has(n.path)) selected.value = new Set([n.path]);
|
|
255
|
-
const items = files.value
|
|
256
|
-
.filter((f) => selected.value.has(f.path) && !isStorageRow(f))
|
|
257
|
-
.map((f) => ({ path: f.path, basename: f.basename, type: f.type }));
|
|
258
|
-
if (items.length === 0) {
|
|
259
|
-
ev.preventDefault();
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
ev.dataTransfer.setData(FE_DND_MIME, JSON.stringify(items));
|
|
263
|
-
ev.dataTransfer.setData(FE_DND_SRC_MIME, props.qualify(path.value));
|
|
264
|
-
ev.dataTransfer.setData('text/plain', items.map((i) => i.path).join('\n'));
|
|
265
|
-
ev.dataTransfer.effectAllowed = 'move';
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// ------------------------------------------------------------------
|
|
269
|
-
// Drop target (dir rows + pane background)
|
|
270
|
-
// ------------------------------------------------------------------
|
|
271
|
-
|
|
272
|
-
const dropBg = ref(false);
|
|
273
|
-
|
|
274
|
-
function acceptDrag(ev: DragEvent): boolean {
|
|
275
|
-
return hasInternalDrag(ev);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
function handleDropPayload(ev: DragEvent, targetWire: string) {
|
|
279
|
-
const items = internalDragItems(ev);
|
|
280
|
-
if (!items || !targetWire) return;
|
|
281
|
-
const origin = internalDragOrigin(ev);
|
|
282
|
-
const sources = items
|
|
283
|
-
.map((i) => i.path)
|
|
284
|
-
.filter((p) => p && p !== targetWire && !targetWire.startsWith(p + '/'));
|
|
285
|
-
if (sources.length === 0) return;
|
|
286
|
-
ev.preventDefault();
|
|
287
|
-
ev.stopPropagation();
|
|
288
|
-
emit('transfer', { sources, targetWire, originWire: origin });
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function onBgDragOver(ev: DragEvent) {
|
|
292
|
-
if (!acceptDrag(ev) || atVirtualRoot.value) return;
|
|
293
|
-
ev.preventDefault();
|
|
294
|
-
ev.stopPropagation();
|
|
295
|
-
if (ev.dataTransfer) ev.dataTransfer.dropEffect = 'move';
|
|
296
|
-
dropBg.value = true;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
function onBgDragLeave() {
|
|
300
|
-
dropBg.value = false;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
function onBgDrop(ev: DragEvent) {
|
|
304
|
-
dropBg.value = false;
|
|
305
|
-
if (!acceptDrag(ev) || atVirtualRoot.value) return;
|
|
306
|
-
handleDropPayload(ev, props.qualify(path.value));
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
// ------------------------------------------------------------------
|
|
310
|
-
// Host API (keyboard routing when this pane is active)
|
|
311
|
-
// ------------------------------------------------------------------
|
|
312
|
-
|
|
313
|
-
function goUp() {
|
|
314
|
-
const cur = (path.value ?? '').replace(/^\/+|\/+$/g, '');
|
|
315
|
-
const floor = (props.floor || '').replace(/^\/+|\/+$/g, '');
|
|
316
|
-
if (!cur || cur === floor) return;
|
|
317
|
-
const idx = cur.lastIndexOf('/');
|
|
318
|
-
void loadPane(idx === -1 ? '' : cur.slice(0, idx));
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
function selectAll() {
|
|
322
|
-
selected.value = new Set(files.value.filter((f) => !isStorageRow(f)).map((f) => f.path));
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
function selectedNodes(): FileNode[] {
|
|
326
|
-
return files.value.filter((f) => selected.value.has(f.path));
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
function openSelected() {
|
|
330
|
-
const n = selectedNodes()[0];
|
|
331
|
-
if (n && n.type === 'dir') onRowDbl(n);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
function reload(): Promise<void> {
|
|
335
|
-
return loadPane();
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
function getPath(): string {
|
|
339
|
-
return path.value;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
defineExpose({ reload, goUp, selectAll, openSelected, selectedNodes, getPath });
|
|
343
|
-
</script>
|
|
344
|
-
|
|
345
|
-
<template>
|
|
346
|
-
<section
|
|
347
|
-
class="fe-split"
|
|
348
|
-
:class="{ 'fe-pane--focus': active }"
|
|
349
|
-
role="region"
|
|
350
|
-
:aria-label="t('split.pane')"
|
|
351
|
-
@pointerdown="emit('activate')"
|
|
352
|
-
>
|
|
353
|
-
<header class="fe-split__crumbs">
|
|
354
|
-
<button
|
|
355
|
-
v-if="showRootCrumb"
|
|
356
|
-
type="button"
|
|
357
|
-
class="fe-split__crumb"
|
|
358
|
-
:class="{ 'is-last': crumbs.length === 0 }"
|
|
359
|
-
:title="rootLabel"
|
|
360
|
-
@click="crumbGo('')"
|
|
361
|
-
>{{ rootLabel }}</button>
|
|
362
|
-
<template v-for="c in crumbs" :key="c.target">
|
|
363
|
-
<span class="fe-split__sep" aria-hidden="true">›</span>
|
|
364
|
-
<button
|
|
365
|
-
type="button"
|
|
366
|
-
class="fe-split__crumb"
|
|
367
|
-
:class="{ 'is-last': c.last }"
|
|
368
|
-
:title="c.label"
|
|
369
|
-
@click="crumbGo(c.target)"
|
|
370
|
-
>{{ c.label }}</button>
|
|
371
|
-
</template>
|
|
372
|
-
<span class="fe-split__spacer"></span>
|
|
373
|
-
<button
|
|
374
|
-
type="button"
|
|
375
|
-
class="fe-split__closebtn"
|
|
376
|
-
:aria-label="t('split.close')"
|
|
377
|
-
:title="t('split.close')"
|
|
378
|
-
@click="emit('close')"
|
|
379
|
-
>×</button>
|
|
380
|
-
</header>
|
|
381
|
-
|
|
382
|
-
<div
|
|
383
|
-
class="fe-split__body"
|
|
384
|
-
:class="{ 'is-dropover': dropBg }"
|
|
385
|
-
@click.self="clearSelection"
|
|
386
|
-
@contextmenu="onBgContext"
|
|
387
|
-
@dragover="onBgDragOver"
|
|
388
|
-
@dragleave="onBgDragLeave"
|
|
389
|
-
@drop="onBgDrop"
|
|
390
|
-
>
|
|
391
|
-
<div v-if="loading && files.length === 0" class="fe-split__state" role="status">
|
|
392
|
-
{{ t('loading') }}
|
|
393
|
-
</div>
|
|
394
|
-
<div v-else-if="error" class="fe-split__state">
|
|
395
|
-
<span>{{ t('split.error') }}</span>
|
|
396
|
-
<button type="button" class="fe-btn" @click="() => loadPane()">
|
|
397
|
-
{{ t('split.retry') }}
|
|
398
|
-
</button>
|
|
399
|
-
</div>
|
|
400
|
-
<div v-else-if="files.length === 0" class="fe-split__state">
|
|
401
|
-
{{ t('empty.folder') }}
|
|
402
|
-
</div>
|
|
403
|
-
<!-- ui-fix — the same view components (list/grid/gallery), driven by the
|
|
404
|
-
pane's own viewMode; the old flat fe-split__list is gone. -->
|
|
405
|
-
<ListView
|
|
406
|
-
v-else-if="(viewMode ?? 'list') === 'list'"
|
|
407
|
-
:files="files"
|
|
408
|
-
:selected="selected"
|
|
409
|
-
:locale="locale"
|
|
410
|
-
:loading="loading"
|
|
411
|
-
:keep-badge-for="keepBadgeFor"
|
|
412
|
-
@click-row="onViewClick"
|
|
413
|
-
@dbl-row="onRowDbl"
|
|
414
|
-
@context-row="onViewContext"
|
|
415
|
-
@item-drag-start="onRowDragStart"
|
|
416
|
-
@item-drop-into="onViewDropInto"
|
|
417
|
-
/>
|
|
418
|
-
<GridView
|
|
419
|
-
v-else-if="viewMode === 'grid'"
|
|
420
|
-
:files="files"
|
|
421
|
-
:selected="selected"
|
|
422
|
-
:locale="locale"
|
|
423
|
-
:loading="loading"
|
|
424
|
-
:thumb-src="thumbSrc"
|
|
425
|
-
:keep-badge-for="keepBadgeFor"
|
|
426
|
-
@click-card="onViewClick"
|
|
427
|
-
@dbl-card="onRowDbl"
|
|
428
|
-
@context-card="onViewContext"
|
|
429
|
-
@item-drag-start="onRowDragStart"
|
|
430
|
-
@item-drop-into="onViewDropInto"
|
|
431
|
-
/>
|
|
432
|
-
<GalleryView
|
|
433
|
-
v-else
|
|
434
|
-
:files="files"
|
|
435
|
-
:selected="selected"
|
|
436
|
-
:locale="locale"
|
|
437
|
-
:loading="loading"
|
|
438
|
-
:thumb-src="thumbSrc"
|
|
439
|
-
@click-card="onViewClick"
|
|
440
|
-
@dbl-card="onRowDbl"
|
|
441
|
-
@context-card="onViewContext"
|
|
442
|
-
@item-drag-start="onRowDragStart"
|
|
443
|
-
@item-drop-into="onViewDropInto"
|
|
444
|
-
/>
|
|
445
|
-
</div>
|
|
446
|
-
</section>
|
|
447
|
-
</template>
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, ref, watch } from 'vue';
|
|
3
|
-
import type { LocaleCode } from '../types/ExplorerConfig';
|
|
4
|
-
import type { ShareInfo } from '../types/FileNode';
|
|
5
|
-
import { useLocale } from '../composables/useLocale';
|
|
6
|
-
import { shareCliCommand } from '../lib/shareCli';
|
|
7
|
-
import { clampExpiryDate, expiryInputMax, ttlCeilingHint, validUntilLine } from '../lib/shareTtl';
|
|
8
|
-
import Modal from './Modal.vue';
|
|
9
|
-
|
|
10
|
-
const props = defineProps<{
|
|
11
|
-
open: boolean;
|
|
12
|
-
locale: LocaleCode;
|
|
13
|
-
share?: (ShareInfo & { url: string; filename?: string }) | null;
|
|
14
|
-
/** Server ceiling on a new link's life in days (0/undefined = none). */
|
|
15
|
-
shareMaxTtlDays?: number;
|
|
16
|
-
}>();
|
|
17
|
-
|
|
18
|
-
const emit = defineEmits<{
|
|
19
|
-
(e: 'close'): void;
|
|
20
|
-
(
|
|
21
|
-
e: 'submit',
|
|
22
|
-
payload: { password: boolean; expires_at: string | null; max_downloads: number | null },
|
|
23
|
-
): void;
|
|
24
|
-
(e: 'toast', msg: string): void;
|
|
25
|
-
}>();
|
|
26
|
-
|
|
27
|
-
const { t } = useLocale(() => props.locale);
|
|
28
|
-
|
|
29
|
-
const usePin = ref(false);
|
|
30
|
-
const expiresAt = ref<string>('');
|
|
31
|
-
const maxDownloads = ref<string>('');
|
|
32
|
-
|
|
33
|
-
watch(() => props.open, (v) => {
|
|
34
|
-
if (v) {
|
|
35
|
-
usePin.value = false;
|
|
36
|
-
expiresAt.value = '';
|
|
37
|
-
maxDownloads.value = '';
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// The picker is capped at the server's ceiling and the value is clamped once
|
|
42
|
-
// more on submit — the server clamps too, but asking for a date it will
|
|
43
|
-
// refuse is how the user ends up with a link that says one thing and does
|
|
44
|
-
// another.
|
|
45
|
-
const expiryMax = computed(() => expiryInputMax(props.shareMaxTtlDays));
|
|
46
|
-
const ttlHint = computed(() => ttlCeilingHint(props.shareMaxTtlDays, props.locale === 'tr' ? 'tr' : 'en'));
|
|
47
|
-
const validUntil = computed(() =>
|
|
48
|
-
props.share ? validUntilLine(props.share.expires_at ?? null, props.locale === 'tr' ? 'tr' : 'en') : '',
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
function submit() {
|
|
52
|
-
const chosen = expiresAt.value ? new Date(expiresAt.value) : null;
|
|
53
|
-
emit('submit', {
|
|
54
|
-
password: usePin.value,
|
|
55
|
-
expires_at: clampExpiryDate(chosen, props.shareMaxTtlDays).iso,
|
|
56
|
-
max_downloads: maxDownloads.value ? Number(maxDownloads.value) : null,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async function copy(value: string, toast: string) {
|
|
61
|
-
try {
|
|
62
|
-
await navigator.clipboard.writeText(value);
|
|
63
|
-
emit('toast', toast);
|
|
64
|
-
} catch {
|
|
65
|
-
/* no-op */
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// One-line curl that downloads the shared file straight onto a server.
|
|
70
|
-
// Built by the shared helper so this dialog and the "Share / Permissions"
|
|
71
|
-
// panel cannot drift into two different commands.
|
|
72
|
-
const cliCommand = computed(() =>
|
|
73
|
-
shareCliCommand(props.share ? { url: props.share.url, pin: props.share.password_pin, filename: props.share.filename } : null),
|
|
74
|
-
);
|
|
75
|
-
</script>
|
|
76
|
-
|
|
77
|
-
<template>
|
|
78
|
-
<Modal :open="open" :title="t('modal.share.title')" size="md" @close="emit('close')">
|
|
79
|
-
<template v-if="!share">
|
|
80
|
-
<form class="fe-form" @submit.prevent="submit">
|
|
81
|
-
<label class="fe-form__row">
|
|
82
|
-
<input v-model="usePin" type="checkbox" />
|
|
83
|
-
<span>{{ t('modal.share.pin') }}</span>
|
|
84
|
-
</label>
|
|
85
|
-
<label class="fe-form__row fe-form__row--stack">
|
|
86
|
-
<span>{{ t('modal.share.expires') }}</span>
|
|
87
|
-
<input v-model="expiresAt" type="datetime-local" class="fe-input" :max="expiryMax" />
|
|
88
|
-
<small v-if="ttlHint" class="fe-form__hint">{{ ttlHint }}</small>
|
|
89
|
-
</label>
|
|
90
|
-
<label class="fe-form__row fe-form__row--stack">
|
|
91
|
-
<span>{{ t('modal.share.max_downloads') }}</span>
|
|
92
|
-
<input v-model="maxDownloads" type="number" min="1" class="fe-input" />
|
|
93
|
-
</label>
|
|
94
|
-
</form>
|
|
95
|
-
</template>
|
|
96
|
-
<template v-else>
|
|
97
|
-
<div class="fe-share-result">
|
|
98
|
-
<div class="fe-share-result__row fe-share-result__row--note">
|
|
99
|
-
<small>{{ validUntil }}<template v-if="share.expiry_clamped"> {{ t('modal.share.limit_applied') }}</template></small>
|
|
100
|
-
</div>
|
|
101
|
-
<div class="fe-share-result__row">
|
|
102
|
-
<label>Link</label>
|
|
103
|
-
<div class="fe-share-result__copy">
|
|
104
|
-
<input :value="share.url" readonly class="fe-input" />
|
|
105
|
-
<button type="button" class="fe-btn" @click="copy(share.url, t('modal.share.url_copied'))">
|
|
106
|
-
{{ t('modal.share.copy') }}
|
|
107
|
-
</button>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
<div v-if="share.password_pin" class="fe-share-result__row">
|
|
111
|
-
<label>PIN</label>
|
|
112
|
-
<div class="fe-share-result__copy">
|
|
113
|
-
<input :value="share.password_pin" readonly class="fe-input fe-input--mono" />
|
|
114
|
-
<button type="button" class="fe-btn" @click="copy(share.password_pin, t('modal.share.pin_copied'))">
|
|
115
|
-
{{ t('modal.share.copy') }}
|
|
116
|
-
</button>
|
|
117
|
-
</div>
|
|
118
|
-
</div>
|
|
119
|
-
<div class="fe-share-result__row">
|
|
120
|
-
<label>CLI</label>
|
|
121
|
-
<div class="fe-share-result__copy">
|
|
122
|
-
<input :value="cliCommand" readonly class="fe-input fe-input--mono" />
|
|
123
|
-
<button type="button" class="fe-btn" @click="copy(cliCommand, t('modal.share.cli_copied'))">
|
|
124
|
-
{{ t('modal.share.copy') }}
|
|
125
|
-
</button>
|
|
126
|
-
</div>
|
|
127
|
-
</div>
|
|
128
|
-
</div>
|
|
129
|
-
</template>
|
|
130
|
-
<template #actions>
|
|
131
|
-
<button type="button" class="fe-btn" @click="emit('close')">
|
|
132
|
-
{{ share ? t('modal.share.close') : t('modal.share.cancel') }}
|
|
133
|
-
</button>
|
|
134
|
-
<button v-if="!share" type="button" class="fe-btn fe-btn--primary" @click="submit">
|
|
135
|
-
{{ t('modal.share.create') }}
|
|
136
|
-
</button>
|
|
137
|
-
</template>
|
|
138
|
-
</Modal>
|
|
139
|
-
</template>
|