mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 16:22:14 +00:00
File preview refactoring
This commit is contained in:
@@ -1,66 +1,97 @@
|
||||
<template>
|
||||
<div class="navigation-panel" v-if="currentFile">
|
||||
<div class="name-wrapper">
|
||||
<div v-if="currentFile" class="items-center px-3.5 py-4 lg:grid lg:grid-cols-3 lg:py-3">
|
||||
<div class="flex items-center justify-between lg:w-auto lg:justify-start">
|
||||
<!--Close icon-->
|
||||
<span @click="closeFullPreview" class="-m-3 p-3">
|
||||
<x-icon size="17" class="icon-close hover-text-theme" />
|
||||
</span>
|
||||
|
||||
<!--Item name-->
|
||||
<div class="name-count-wrapper">
|
||||
<p class="title">{{ currentFile.data.attributes.name }}</p>
|
||||
<span v-if="!fastPreview" class="file-count"> ({{ showingImageIndex + ' ' + $t('pronouns.of') + ' ' + files.length }}) </span>
|
||||
<div @click="closeFullPreview" class="order-last -m-3 cursor-pointer p-3 lg:order-none">
|
||||
<x-icon size="16" class="vue-feather" />
|
||||
</div>
|
||||
|
||||
<!--Context menu handler-->
|
||||
<PopoverWrapper>
|
||||
<!--Icon-->
|
||||
<span @click.stop="showItemContextMenu" class="-m-3 p-3">
|
||||
<div class="inline-block rounded-md bg-light-background py-0.5 px-1.5 align-middle transition-all duration-200 dark:bg-dark-foreground lg:bg-transparent">
|
||||
<more-horizontal-icon size="14" />
|
||||
</div>
|
||||
</span>
|
||||
<!--Item name-->
|
||||
<div class="flex items-center">
|
||||
<div class="mr-3 ml-0 flex items-center lg:mx-3">
|
||||
<span
|
||||
class="inline-block max-w-[230px] overflow-hidden text-ellipsis whitespace-nowrap text-sm font-bold"
|
||||
>
|
||||
{{ currentFile.data.attributes.name }}
|
||||
</span>
|
||||
|
||||
<!--Desktop context menu-->
|
||||
<PopoverItem name="file-preview-contextmenu" side="right">
|
||||
<OptionGroup>
|
||||
<Option @click.native="$renameFileOrFolder(currentFile)" :title="$t('context_menu.rename')" icon="rename" />
|
||||
<Option @click.native="$moveFileOrFolder(currentFile)" :title="$t('context_menu.move')" icon="move-item" />
|
||||
<Option @click.native="$shareFileOrFolder(currentFile)" :title="sharingTitle" icon="share" v-if="$checkPermission('master')" />
|
||||
<Option @click.native="$deleteFileOrFolder(currentFile)" :title="$t('context_menu.delete')" icon="trash" class="menu-option" />
|
||||
</OptionGroup>
|
||||
<OptionGroup>
|
||||
<Option @click.native="downloadItem" :title="$t('context_menu.download')" icon="download" />
|
||||
</OptionGroup>
|
||||
</PopoverItem>
|
||||
</PopoverWrapper>
|
||||
<span v-if="!fastPreview" class="ml-1 text-sm font-bold">
|
||||
({{ showingImageIndex + ' ' + $t('pronouns.of') + ' ' + files.length }})
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!--Context menu handler-->
|
||||
<PopoverWrapper>
|
||||
<!--Icon-->
|
||||
<span @click.stop="showItemContextMenu" class="-m-3 p-3">
|
||||
<div
|
||||
class="inline-block rounded-md bg-light-background py-0.5 px-1.5 align-middle transition-all duration-200 dark:bg-dark-foreground lg:bg-transparent"
|
||||
>
|
||||
<more-horizontal-icon size="14" />
|
||||
</div>
|
||||
</span>
|
||||
|
||||
<!--Desktop context menu-->
|
||||
<PopoverItem name="file-preview-contextmenu" side="right">
|
||||
<OptionGroup>
|
||||
<Option
|
||||
@click.native="$renameFileOrFolder(currentFile)"
|
||||
:title="$t('context_menu.rename')"
|
||||
icon="rename"
|
||||
/>
|
||||
<Option
|
||||
@click.native="$moveFileOrFolder(currentFile)"
|
||||
:title="$t('context_menu.move')"
|
||||
icon="move-item"
|
||||
/>
|
||||
<Option
|
||||
@click.native="$shareFileOrFolder(currentFile)"
|
||||
:title="sharingTitle"
|
||||
icon="share"
|
||||
v-if="$checkPermission('master')"
|
||||
/>
|
||||
<Option
|
||||
@click.native="$deleteFileOrFolder(currentFile)"
|
||||
:title="$t('context_menu.delete')"
|
||||
icon="trash"
|
||||
class="menu-option"
|
||||
/>
|
||||
</OptionGroup>
|
||||
<OptionGroup>
|
||||
<Option @click.native="downloadItem" :title="$t('context_menu.download')" icon="download" />
|
||||
</OptionGroup>
|
||||
</PopoverItem>
|
||||
</PopoverWrapper>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--Item metadata-->
|
||||
<div class="created-at-wrapper">
|
||||
<p>
|
||||
{{ currentFile.data.attributes.filesize }},
|
||||
{{ currentFile.data.attributes.created_at }}
|
||||
</p>
|
||||
</div>
|
||||
<!--Item info-->
|
||||
<small class="hidden text-center text-tiny font-normal text-gray-600 lg:block">
|
||||
{{ currentFile.data.attributes.filesize }}, {{ currentFile.data.attributes.created_at }}
|
||||
</small>
|
||||
|
||||
<!--Icon actions-->
|
||||
<div class="navigation-icons">
|
||||
<div v-if="isPdf" class="navigation-tool-wrapper">
|
||||
<!--Actions-->
|
||||
<div class="hidden items-center lg:flex lg:justify-end">
|
||||
<div v-if="isPdf">
|
||||
<ToolbarButton @click.native="decreaseSizeOfPDF" source="zoom-out" :action="$t('pdf_zoom_out')" />
|
||||
<ToolbarButton @click.native="increaseSizeOfPDF" source="zoom-in" :action="$t('pdf_zoom_in')" />
|
||||
</div>
|
||||
<div class="navigation-tool-wrapper">
|
||||
<ToolbarButton @click.native="downloadItem" class="mobile-hide" source="download" :action="$t('actions.download')" />
|
||||
|
||||
<div class="ml-5">
|
||||
<ToolbarButton @click.native="downloadItem" source="download" :action="$t('actions.download')" />
|
||||
<ToolbarButton
|
||||
v-if="canShareItem"
|
||||
@click.native="$shareFileOrFolder(currentFile)"
|
||||
class="mobile-hide"
|
||||
:class="{ 'is-inactive': !canShareItem }"
|
||||
source="share"
|
||||
:action="$t('actions.share')"
|
||||
/>
|
||||
<ToolbarButton v-if="isImage" @click.native="printMethod()" source="print" :action="$t('actions.print')" />
|
||||
<ToolbarButton
|
||||
v-if="isImage"
|
||||
@click.native="printMethod()"
|
||||
source="print"
|
||||
:action="$t('actions.print')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -94,7 +125,9 @@ export default {
|
||||
return this.fastPreview ? this.fastPreview : this.clipboard[0]
|
||||
},
|
||||
sharingTitle() {
|
||||
return this.currentFile.data.relationships.shared ? this.$t('context_menu.share_edit') : this.$t('context_menu.share')
|
||||
return this.currentFile.data.relationships.shared
|
||||
? this.$t('context_menu.share_edit')
|
||||
: this.$t('context_menu.share')
|
||||
},
|
||||
isImage() {
|
||||
return this.currentFile.data.type === 'image'
|
||||
@@ -154,7 +187,10 @@ export default {
|
||||
win.print()
|
||||
},
|
||||
downloadItem() {
|
||||
this.$downloadFile(this.currentFile.data.attributes.file_url, this.currentFile.data.attributes.name + '.' + this.currentFile.data.attributes.mimetype)
|
||||
this.$downloadFile(
|
||||
this.currentFile.data.attributes.file_url,
|
||||
this.currentFile.data.attributes.name + '.' + this.currentFile.data.attributes.mimetype
|
||||
)
|
||||
},
|
||||
closeFullPreview() {
|
||||
events.$emit('file-preview:hide')
|
||||
@@ -162,188 +198,3 @@ export default {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '../../../sass/vuefilemanager/variables';
|
||||
@import '../../../sass/vuefilemanager/mixins';
|
||||
|
||||
.name-wrapper {
|
||||
width: 33%;
|
||||
height: 22px;
|
||||
display: flex;
|
||||
position: relative;
|
||||
align-items: center;
|
||||
flex-grow: 1;
|
||||
align-self: center;
|
||||
white-space: nowrap;
|
||||
|
||||
.name-count-wrapper {
|
||||
margin-left: 6px;
|
||||
margin-right: 6px;
|
||||
|
||||
.file-count {
|
||||
@include font-size(15);
|
||||
line-height: 1;
|
||||
font-weight: 700;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
align-self: center;
|
||||
color: $text;
|
||||
}
|
||||
|
||||
.title {
|
||||
@include font-size(15);
|
||||
max-width: 250px;
|
||||
line-height: 1;
|
||||
font-weight: 700;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
color: $text;
|
||||
}
|
||||
|
||||
@media (max-width: 570px) {
|
||||
.title {
|
||||
max-width: 180px;
|
||||
@include font-size(17);
|
||||
}
|
||||
.file-count {
|
||||
@include font-size(17);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.icon-close {
|
||||
min-width: 22px;
|
||||
border-radius: 6px;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
@include transition(150ms);
|
||||
|
||||
&:hover {
|
||||
background: $light_background;
|
||||
|
||||
line {
|
||||
color: inherit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.context-menu {
|
||||
min-width: 250px;
|
||||
position: absolute;
|
||||
z-index: 99;
|
||||
box-shadow: $shadow;
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
top: 29px;
|
||||
|
||||
&.showed {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.created-at-wrapper {
|
||||
width: 33%;
|
||||
display: flex;
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
|
||||
p {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@include font-size(11);
|
||||
}
|
||||
}
|
||||
|
||||
.navigation-icons {
|
||||
width: 33%;
|
||||
text-align: right;
|
||||
|
||||
.navigation-tool-wrapper {
|
||||
margin-left: 28px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.button {
|
||||
margin-left: 5px;
|
||||
|
||||
&:hover {
|
||||
background: $light_background;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.navigation-panel {
|
||||
height: 63px;
|
||||
width: 100%;
|
||||
padding: 10px 15px;
|
||||
display: flex;
|
||||
position: absolute;
|
||||
z-index: 8;
|
||||
align-items: center;
|
||||
background-color: white;
|
||||
color: $text;
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
.context-menu {
|
||||
.name-wrapper {
|
||||
width: 67%;
|
||||
}
|
||||
}
|
||||
|
||||
.navigation-icons {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.navigation-panel {
|
||||
height: 53px;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.created-at-wrapper {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.name-wrapper {
|
||||
justify-content: space-between;
|
||||
flex-direction: row-reverse;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.dark {
|
||||
.navigation-panel {
|
||||
background-color: $dark_mode_background;
|
||||
color: $dark_mode_text_primary;
|
||||
|
||||
.icon-close {
|
||||
color: $dark_mode_text_primary;
|
||||
|
||||
&:hover {
|
||||
background-color: $dark_mode_background;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.name-wrapper {
|
||||
.title,
|
||||
.file-count {
|
||||
color: $dark_mode_text_primary !important;
|
||||
}
|
||||
}
|
||||
|
||||
.navigation-icons {
|
||||
.button:hover {
|
||||
background: $dark_mode_background;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user