Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e4d60949ef |
+12
-7
@@ -2,14 +2,13 @@
|
||||
|
||||
namespace KTXM\Documents;
|
||||
|
||||
use KTXF\Module\Configuration\BrowserModuleContextInterface;
|
||||
use KTXF\Module\Configuration\ModuleContextInterface;
|
||||
use KTXF\Module\ModuleBrowserInterface;
|
||||
use KTXF\Module\ModuleInstanceAbstract;
|
||||
|
||||
/**
|
||||
* Documents Module - Document Browser UI
|
||||
*/
|
||||
class Module extends ModuleInstanceAbstract
|
||||
class Module extends ModuleInstanceAbstract implements ModuleBrowserInterface
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
@@ -51,10 +50,16 @@ class Module extends ModuleInstanceAbstract
|
||||
];
|
||||
}
|
||||
|
||||
public function configure(ModuleContextInterface $context): void
|
||||
public function registerBI(): array
|
||||
{
|
||||
if ($context instanceof BrowserModuleContextInterface) {
|
||||
$context->registerModule($this, 'Documents', 'static/module.mjs');
|
||||
}
|
||||
return [
|
||||
'handle' => $this->handle(),
|
||||
'namespace' => 'Documents',
|
||||
'version' => $this->version(),
|
||||
'label' => $this->label(),
|
||||
'author' => $this->author(),
|
||||
'description' => $this->description(),
|
||||
'boot' => 'static/module.mjs',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
+8
-14
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted, watch, nextTick, defineAsyncComponent } from 'vue'
|
||||
import { useDisplay } from 'vuetify'
|
||||
import { useModuleStore, useIntegrationStore, usePreviewStore } from '@KTXC'
|
||||
import { useModuleStore, useIntegrationStore } from '@KTXC'
|
||||
import { useDocumentManager, useDocumentSelection, useFileUpload, useFileEditor } from '@/composables'
|
||||
import type { ViewMode, SortField, SortOrder, BreadcrumbItem } from '@/types'
|
||||
import { CollectionObject } from '@DocumentsManager/models/collection'
|
||||
@@ -31,8 +31,6 @@ const isMobile = computed(() => display.mdAndDown.value)
|
||||
|
||||
const moduleStore = useModuleStore()
|
||||
const integrationStore = useIntegrationStore()
|
||||
const previewStore = usePreviewStore()
|
||||
const previewsAvailable = computed(() => previewStore.availability.storage)
|
||||
const isFileManagerAvailable = computed(() => {
|
||||
return moduleStore.has('documents_manager') || moduleStore.has('DocumentsManager')
|
||||
})
|
||||
@@ -130,10 +128,7 @@ function entityToViewerItem(entity: EntityObject): ViewerItem {
|
||||
}
|
||||
}
|
||||
|
||||
function resolveViewerSource(item: ViewerItem): string | Promise<string> {
|
||||
if (!previewsAvailable.value) {
|
||||
return Promise.reject(new Error('Preview storage is unavailable'))
|
||||
}
|
||||
function resolveViewerSource(item: ViewerItem): string {
|
||||
return documentManager.getEntityPreviewUrl(
|
||||
item.id,
|
||||
(item.meta?.collection as string | null) ?? null,
|
||||
@@ -159,7 +154,6 @@ function resolveThumbnailSource(item: ViewerItem): string {
|
||||
|
||||
// Preview shown in the info panel sidebar for the current single selection
|
||||
const infoPanelPreviewUrl = computed<string | null>(() => {
|
||||
if (!previewsAvailable.value) return null
|
||||
const items = selection.selectedNodeArray.value
|
||||
if (items.length !== 1) return null
|
||||
const item = items[0]
|
||||
@@ -821,8 +815,8 @@ onMounted(async () => {
|
||||
:collections="sortedItems.collections"
|
||||
:entities="sortedItems.entities"
|
||||
:selected-ids="selectedIds"
|
||||
:preview-source="previewsAvailable ? resolvePreviewSource : undefined"
|
||||
:thumbnail-source="previewsAvailable ? resolveThumbnailSource : undefined"
|
||||
:preview-source="resolvePreviewSource"
|
||||
:thumbnail-source="resolveThumbnailSource"
|
||||
@item-click="handleItemClick"
|
||||
@open="handleOpenItem"
|
||||
@edit="handleEditItem"
|
||||
@@ -838,8 +832,8 @@ onMounted(async () => {
|
||||
:collections="sortedItems.collections"
|
||||
:entities="sortedItems.entities"
|
||||
:selected-ids="selectedIds"
|
||||
:preview-source="previewsAvailable ? resolvePreviewSource : undefined"
|
||||
:thumbnail-source="previewsAvailable ? resolveThumbnailSource : undefined"
|
||||
:preview-source="resolvePreviewSource"
|
||||
:thumbnail-source="resolveThumbnailSource"
|
||||
@item-click="handleItemClick"
|
||||
@open="handleOpenItem"
|
||||
@edit="handleEditItem"
|
||||
@@ -855,8 +849,8 @@ onMounted(async () => {
|
||||
:collections="sortedItems.collections"
|
||||
:entities="sortedItems.entities"
|
||||
:selected-ids="selectedIds"
|
||||
:preview-source="previewsAvailable ? resolvePreviewSource : undefined"
|
||||
:thumbnail-source="previewsAvailable ? resolveThumbnailSource : undefined"
|
||||
:preview-source="resolvePreviewSource"
|
||||
:thumbnail-source="resolveThumbnailSource"
|
||||
@item-click="handleItemClick"
|
||||
@open="handleOpenItem"
|
||||
@edit="handleEditItem"
|
||||
|
||||
Reference in New Issue
Block a user