vuefinder 4.0.7 → 4.0.8
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 +4 -331
- package/dist/vuefinder.css +1 -1
- package/dist/vuefinder.js +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ If you like it, please follow and ⭐ star on GitHub.
|
|
|
15
15
|
|
|
16
16
|
### Demo
|
|
17
17
|
|
|
18
|
-
[Live Demo](https://vuefinder.ozdemir.be/)
|
|
18
|
+
[Live Demo](https://vuefinder.ozdemir.be/) - Explore Vuefinder's features and capabilities in action.
|
|
19
19
|
|
|
20
20
|
### Installation
|
|
21
21
|
|
|
@@ -23,336 +23,7 @@ If you like it, please follow and ⭐ star on GitHub.
|
|
|
23
23
|
npm i vuefinder
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
```js
|
|
29
|
-
import { createApp } from 'vue';
|
|
30
|
-
import App from './App.vue';
|
|
31
|
-
|
|
32
|
-
import 'vuefinder/dist/style.css';
|
|
33
|
-
import VueFinder from 'vuefinder';
|
|
34
|
-
|
|
35
|
-
const app = createApp(App);
|
|
36
|
-
|
|
37
|
-
//By default, Vuefinder will use English as the main language.
|
|
38
|
-
// However, if you want to support multiple languages and customize the localization,
|
|
39
|
-
// you can import the language files manually during component registration.
|
|
40
|
-
app.use(VueFinder);
|
|
41
|
-
|
|
42
|
-
app.mount('#app');
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Localization
|
|
46
|
-
|
|
47
|
-
You can manually import the localization files from the package and register them with Vuefinder. The localization files are located in the dist/locales folder.
|
|
48
|
-
|
|
49
|
-
```js
|
|
50
|
-
import en from 'vuefinder/dist/locales/en.js';
|
|
51
|
-
import tr from 'vuefinder/dist/locales/tr.js';
|
|
52
|
-
import ru from 'vuefinder/dist/locales/ru.js';
|
|
53
|
-
|
|
54
|
-
app.use(VueFinder, {
|
|
55
|
-
i18n: { en, tr, ru },
|
|
56
|
-
});
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Async Localization
|
|
60
|
-
|
|
61
|
-
Alternatively, you can import the localization files asynchronously during component registration. This can be useful for lazy loading or if you prefer to load the files dynamically.
|
|
62
|
-
|
|
63
|
-
```js
|
|
64
|
-
app.use(VueFinder, {
|
|
65
|
-
i18n: {
|
|
66
|
-
en: async () => await import('vuefinder/dist/locales/en.js'),
|
|
67
|
-
de: async () => await import('vuefinder/dist/locales/de.js'),
|
|
68
|
-
// Add more locales as needed
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
#### Vue Template
|
|
74
|
-
|
|
75
|
-
```vue
|
|
76
|
-
<div>
|
|
77
|
-
<vue-finder
|
|
78
|
-
id="my_vuefinder"
|
|
79
|
-
:driver="driver"
|
|
80
|
-
:config="{ initialPath: 'local://public', persist: true }"
|
|
81
|
-
/>
|
|
82
|
-
</div>
|
|
83
|
-
|
|
84
|
-
<script setup>
|
|
85
|
-
import { RemoteDriver } from 'vuefinder';
|
|
86
|
-
|
|
87
|
-
// Create a driver instance
|
|
88
|
-
const driver = new RemoteDriver({
|
|
89
|
-
baseURL: '/api',
|
|
90
|
-
url: {
|
|
91
|
-
list: '/files',
|
|
92
|
-
upload: '/upload',
|
|
93
|
-
delete: '/delete',
|
|
94
|
-
rename: '/rename',
|
|
95
|
-
copy: '/copy',
|
|
96
|
-
move: '/move',
|
|
97
|
-
archive: '/archive',
|
|
98
|
-
unarchive: '/unarchive',
|
|
99
|
-
createFile: '/create-file',
|
|
100
|
-
createFolder: '/create-folder',
|
|
101
|
-
preview: '/preview',
|
|
102
|
-
download: '/download',
|
|
103
|
-
search: '/search',
|
|
104
|
-
save: '/save',
|
|
105
|
-
},
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
// Or use ArrayDriver for in-memory operations:
|
|
109
|
-
// import { ArrayDriver } from 'vuefinder';
|
|
110
|
-
// const driver = new ArrayDriver({
|
|
111
|
-
// files: filesArray,
|
|
112
|
-
// storage: 'memory',
|
|
113
|
-
// readOnly: false
|
|
114
|
-
// });
|
|
115
|
-
</script>
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Styling
|
|
119
|
-
|
|
120
|
-
Vuefinder uses the BEM (Block Element Modifier) convention for its CSS classes, with default styles applied using TailwindCSS. This structured approach helps maintain a clear and consistent naming convention for CSS classes, making it easier to understand and manage styles across the project.
|
|
121
|
-
|
|
122
|
-
To customize or update the styles, simply find the appropriate BEM class in the component’s style section and override the styles as needed.
|
|
123
|
-
|
|
124
|
-
### Props
|
|
125
|
-
|
|
126
|
-
| Prop | Value | Default | Description |
|
|
127
|
-
| --------------------------- | :------------------------------: | ---------- | :----------------------------------------------------------- |
|
|
128
|
-
| id | string | _null_ | required |
|
|
129
|
-
| driver | Driver | _null_ | **required** - Driver instance used for file operations |
|
|
130
|
-
| config | ConfigDefaults | _object_ | optional - configuration store defaults (e.g., initialPath) |
|
|
131
|
-
| locale | string | en | optional - default language code |
|
|
132
|
-
| features | FeaturesPreset \| FeaturesConfig | 'advanced' | optional - feature preset ('simple'/'advanced') or object |
|
|
133
|
-
| selectionMode | 'single' \| 'multiple' | 'multiple' | optional - selection mode |
|
|
134
|
-
| selectionFilterType | 'files' \| 'dirs' \| 'both' | 'both' | optional - filter selectable items by type |
|
|
135
|
-
| selectionFilterMimeIncludes | string[] | [] | optional - MIME type filters for selection |
|
|
136
|
-
| contextMenuItems | ContextMenuItem[] | _null_ | optional - custom context menu items |
|
|
137
|
-
| debug | boolean | false | optional - enable debug mode |
|
|
138
|
-
| onError | function | _function_ | optional - error handler callback |
|
|
139
|
-
| onSelect | function | _function_ | optional - selection handler (alternative to @select) |
|
|
140
|
-
| onPathChange | function | _function_ | optional - path change handler (alternative to @path-change) |
|
|
141
|
-
| onUploadComplete | function | _function_ | optional - upload handler (alternative to @upload-complete) |
|
|
142
|
-
| onDeleteComplete | function | _function_ | optional - delete handler (alternative to @delete-complete) |
|
|
143
|
-
| onReady | function | _function_ | optional - ready handler (alternative to @ready) |
|
|
144
|
-
| onFileDclick | function | _function_ | optional - file double-click handler |
|
|
145
|
-
| onFolderDclick | function | _function_ | optional - folder double-click handler |
|
|
146
|
-
|
|
147
|
-
**Note:** Configuration options like `theme`, `maxFileSize`, `fullScreen`, `loadingIndicator`, etc. are now part of the `config` prop. See the [Configuration Guide](https://vuefinder.ozdemir.be/guide/configuration) for details.
|
|
148
|
-
|
|
149
|
-
### Events
|
|
150
|
-
|
|
151
|
-
| Event | Description |
|
|
152
|
-
| ------------------ | :--------------------------------------------------------------------------------------------------------- |
|
|
153
|
-
| `@select` | Emitted when the user selects a file or folder. `(items: DirEntry[]) => void` |
|
|
154
|
-
| `@path-change` | Emitted when the user navigates to a different folder. `(path: string) => void` |
|
|
155
|
-
| `@upload-complete` | Emitted when file uploads are completed successfully. `(files: DirEntry[]) => void` |
|
|
156
|
-
| `@delete-complete` | Emitted when files or folders are deleted successfully. `(deletedItems: DirEntry[]) => void` |
|
|
157
|
-
| `@error` | Emitted when an error occurs during any operation. `(error: any) => void` |
|
|
158
|
-
| `@ready` | Emitted when VueFinder is initialized and ready to use. `() => void` |
|
|
159
|
-
| `@file-dclick` | Emitted when a file is double-clicked. Overrides default preview behavior. `(item: DirEntry) => void` |
|
|
160
|
-
| `@folder-dclick` | Emitted when a folder is double-clicked. Overrides default navigation behavior. `(item: DirEntry) => void` |
|
|
161
|
-
|
|
162
|
-
### Selection
|
|
163
|
-
|
|
164
|
-
There are 2 ways to select files and folders.
|
|
165
|
-
|
|
166
|
-
#### 1) Inline select button via status bar scoped slot (recommended)
|
|
167
|
-
|
|
168
|
-
You can inject a custom button into the status bar and access the reactive selection via the `status-bar` scoped slot:
|
|
169
|
-
|
|
170
|
-
```vue
|
|
171
|
-
<vue-finder id="my_vuefinder" :driver="driver">
|
|
172
|
-
<template #status-bar="{ selected, count, path }">
|
|
173
|
-
<div class="vuefinder__status-bar__actions">
|
|
174
|
-
<button class="btn"
|
|
175
|
-
@click="() => {
|
|
176
|
-
console.log(selected);
|
|
177
|
-
console.log(count);
|
|
178
|
-
console.log(path);
|
|
179
|
-
}"
|
|
180
|
-
:disabled="!count">
|
|
181
|
-
Show Selected ({{ count ?? 0 }} selected)
|
|
182
|
-
</button>
|
|
183
|
-
</div>
|
|
184
|
-
</template>
|
|
185
|
-
</vue-finder>
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
Alternatively, you can use the select event to get the selected items.
|
|
189
|
-
|
|
190
|
-
```vue
|
|
191
|
-
<vue-finder
|
|
192
|
-
id="my_vuefinder"
|
|
193
|
-
:driver="driver"
|
|
194
|
-
@select="handleSelect"
|
|
195
|
-
@path-change="handlePathChange"
|
|
196
|
-
@upload-complete="handleUploadComplete"
|
|
197
|
-
@delete-complete="handleDeleteComplete"
|
|
198
|
-
@error="handleError"
|
|
199
|
-
@ready="handleReady"
|
|
200
|
-
@file-dclick="handleFileDoubleClick"
|
|
201
|
-
@folder-dclick="handleFolderDoubleClick"
|
|
202
|
-
/>
|
|
203
|
-
|
|
204
|
-
<script setup>
|
|
205
|
-
import { ref } from 'vue';
|
|
206
|
-
import { RemoteDriver } from 'vuefinder';
|
|
207
|
-
|
|
208
|
-
// Create driver instance
|
|
209
|
-
const driver = new RemoteDriver({
|
|
210
|
-
baseURL: '/api',
|
|
211
|
-
url: {
|
|
212
|
-
list: '/files',
|
|
213
|
-
// ... other endpoints
|
|
214
|
-
},
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
// we can define a ref object to store the selected items
|
|
218
|
-
const selectedFiles = ref([]);
|
|
219
|
-
|
|
220
|
-
// handle select event, and store the selected items
|
|
221
|
-
const handleSelect = (selection) => {
|
|
222
|
-
selectedFiles.value = selection;
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
// handle path change event
|
|
226
|
-
const handlePathChange = (path) => {
|
|
227
|
-
console.log('Current path:', path);
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
// handle upload complete event
|
|
231
|
-
const handleUploadComplete = (uploadedFiles) => {
|
|
232
|
-
console.log('Uploaded files:', uploadedFiles);
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
// handle delete complete event
|
|
236
|
-
const handleDeleteComplete = (deletedItems) => {
|
|
237
|
-
console.log('Deleted items:', deletedItems);
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
// handle error event
|
|
241
|
-
const handleError = (error) => {
|
|
242
|
-
console.error('VueFinder error:', error);
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
// handle ready event
|
|
246
|
-
const handleReady = () => {
|
|
247
|
-
console.log('VueFinder is ready!');
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
// handle file double-click event
|
|
251
|
-
const handleFileDoubleClick = (file) => {
|
|
252
|
-
console.log('File double-clicked:', file);
|
|
253
|
-
// Custom logic here - maybe download, open in external app, etc.
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
// handle folder double-click event
|
|
257
|
-
const handleFolderDoubleClick = (folder) => {
|
|
258
|
-
console.log('Folder double-clicked:', folder);
|
|
259
|
-
// Custom logic here - maybe show folder info, add to favorites, etc.
|
|
260
|
-
};
|
|
261
|
-
// then with a button click, you can get the selected items easily
|
|
262
|
-
// you can add this method to the click event of a button.
|
|
263
|
-
const handleButtonClick = () => {
|
|
264
|
-
console.log(selectedFiles.value);
|
|
265
|
-
};
|
|
266
|
-
</script>
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
### Custom Double-Click Behavior
|
|
270
|
-
|
|
271
|
-
By default, VueFinder handles double-click events as follows:
|
|
272
|
-
|
|
273
|
-
- **File double-click**: Opens preview modal
|
|
274
|
-
- **Folder double-click**: Navigates to folder (changes path)
|
|
275
|
-
|
|
276
|
-
You can customize this behavior by providing `@file-dclick` and `@folder-dclick` event handlers. When these handlers are provided, they will override the default behavior.
|
|
277
|
-
|
|
278
|
-
```vue
|
|
279
|
-
<vue-finder
|
|
280
|
-
id="my_vuefinder"
|
|
281
|
-
:driver="driver"
|
|
282
|
-
@file-dclick="handleFileDoubleClick"
|
|
283
|
-
@folder-dclick="handleFolderDoubleClick"
|
|
284
|
-
/>
|
|
285
|
-
|
|
286
|
-
<script setup>
|
|
287
|
-
import { RemoteDriver } from 'vuefinder';
|
|
288
|
-
|
|
289
|
-
const driver = new RemoteDriver({
|
|
290
|
-
baseURL: '/api',
|
|
291
|
-
url: { list: '/files' },
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
const handleFileDoubleClick = (file) => {
|
|
295
|
-
// Custom file double-click behavior
|
|
296
|
-
// Example: Download file, open in external app, etc.
|
|
297
|
-
console.log('Custom file action:', file.basename);
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
const handleFolderDoubleClick = (folder) => {
|
|
301
|
-
// Custom folder double-click behavior
|
|
302
|
-
// Example: Show folder info, add to favorites, etc.
|
|
303
|
-
console.log('Custom folder action:', folder.basename);
|
|
304
|
-
};
|
|
305
|
-
</script>
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
**Note**: If you don't provide these handlers, VueFinder will use the default behavior (preview for files, navigation for folders).
|
|
309
|
-
|
|
310
|
-
### Features
|
|
311
|
-
|
|
312
|
-
- Multi storage (see https://github.com/thephpleague/flysystem)
|
|
313
|
-
- File and folder operations
|
|
314
|
-
- Create a new file
|
|
315
|
-
- Create a new folder
|
|
316
|
-
- Rename
|
|
317
|
-
- Delete
|
|
318
|
-
- Archive (zip)
|
|
319
|
-
- Unarchive (unzip)
|
|
320
|
-
- Text editing
|
|
321
|
-
- Image Crop Tool
|
|
322
|
-
- Upload / Download files
|
|
323
|
-
- Search (deep based on current folder)
|
|
324
|
-
- Nice UI
|
|
325
|
-
- Context Menu
|
|
326
|
-
- Breadcrumb links
|
|
327
|
-
- Toolbar
|
|
328
|
-
- File explorer
|
|
329
|
-
- Status bar
|
|
330
|
-
- Image thumbnails
|
|
331
|
-
- Toast notifications
|
|
332
|
-
- Appearance
|
|
333
|
-
- Multi language (17 languages supported)
|
|
334
|
-
- Full Screen mode
|
|
335
|
-
- View Modes: list, grid
|
|
336
|
-
- 12 Beautiful Themes: silver, valorite, midnight, latte, rose, mythril, lime, sky, ocean, palenight, arctic, code
|
|
337
|
-
- Accessibility
|
|
338
|
-
- Drag & drop support
|
|
339
|
-
- Move items (to a folder or up one folder) with drag and drop
|
|
340
|
-
- Mouse selection
|
|
341
|
-
|
|
342
|
-
### Typescript
|
|
343
|
-
|
|
344
|
-
Vuefinder ships with built-in type declarations. You can enable type hints for the global Vuefinder component.
|
|
345
|
-
|
|
346
|
-
```ts
|
|
347
|
-
// src/global-components.d.ts
|
|
348
|
-
import { VueFinder } from 'vuefinder';
|
|
349
|
-
|
|
350
|
-
declare module 'vue' {
|
|
351
|
-
export interface GlobalComponents {
|
|
352
|
-
VueFinder: typeof VueFinder;
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
```
|
|
26
|
+
For detailed installation instructions, configuration options, and usage examples, visit the [documentation website](https://vuefinder.ozdemir.be/).
|
|
356
27
|
|
|
357
28
|
### Backend
|
|
358
29
|
|
|
@@ -384,6 +55,8 @@ If you want to contribute to the project, please feel free to fork the repositor
|
|
|
384
55
|
- [mitt](https://github.com/developit/mitt) : Tiny 200 byte functional event emitter / pubsub
|
|
385
56
|
- [OverlayScrollbars](https://kingsora.github.io/OverlayScrollbars) : scrollbar plugin
|
|
386
57
|
- [nanostores](https://github.com/nanostores/nanostores) : A tiny state manager
|
|
58
|
+
- [vue-sonner](https://github.com/wobsoriano/vue-sonner) : Toast notification component
|
|
59
|
+
- [@floating-ui/dom](https://floating-ui.com/) : Floating UI positioning library
|
|
387
60
|
|
|
388
61
|
### License
|
|
389
62
|
|