refactor: use new documents interfaces
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -3,17 +3,20 @@ import { computed } from 'vue'
|
||||
import { CollectionObject } from '@DocumentsManager/models/collection'
|
||||
import { EntityObject } from '@DocumentsManager/models/entity'
|
||||
import { getFileIcon, formatSize, formatDate } from '@/utils/fileHelpers'
|
||||
import { FileActionsMenu } from '@/components'
|
||||
import { FileActionsMenu, FilePreviewPopover } from '@/components'
|
||||
|
||||
type ItemWithType = {
|
||||
item: CollectionObject | EntityObject
|
||||
type: 'collection' | 'entity'
|
||||
}
|
||||
|
||||
type PreviewSource = (item: { id: string; meta?: Record<string, unknown> }) => string | Blob | Promise<string | Blob>
|
||||
|
||||
const props = defineProps<{
|
||||
collections: CollectionObject[]
|
||||
entities: EntityObject[]
|
||||
selectedIds: Set<string>
|
||||
previewSource?: PreviewSource
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -105,6 +108,13 @@ function isCollection(wrapped: ItemWithType): wrapped is { item: CollectionObjec
|
||||
@show-details="emit('show-details', $event)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<FilePreviewPopover
|
||||
v-if="previewSource"
|
||||
:entity="(wrapped.item as EntityObject)"
|
||||
:source="previewSource"
|
||||
@expand="emit('open', $event)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</v-virtual-scroll>
|
||||
|
||||
Reference in New Issue
Block a user