diff --git a/apps/files/src/components/BreadCrumbs.vue b/apps/files/src/components/BreadCrumbs.vue index c423b698d40d8..3569228dbde0f 100644 --- a/apps/files/src/components/BreadCrumbs.vue +++ b/apps/files/src/components/BreadCrumbs.vue @@ -14,7 +14,7 @@ v-bind="section" dir="auto" :to="section.to" - :force-icon-text="index === 0 && filesListWidth >= 486" + :force-icon-text="index === 0 && fileListWidth >= 486" :title="titleForSection(index, section)" :aria-description="ariaForSection(section)" @click.native="onClick(section.to)" @@ -46,15 +46,15 @@ import NcBreadcrumb from '@nextcloud/vue/dist/Components/NcBreadcrumb.js' import NcBreadcrumbs from '@nextcloud/vue/dist/Components/NcBreadcrumbs.js' import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js' -import { useNavigation } from '../composables/useNavigation' -import { onDropInternalFiles, dataTransferToFileTree, onDropExternalFiles } from '../services/DropService' +import { useNavigation } from '../composables/useNavigation.ts' +import { onDropInternalFiles, dataTransferToFileTree, onDropExternalFiles } from '../services/DropService.ts' +import { useFileListWidth } from '../composables/useFileListWidth.ts' import { showError } from '@nextcloud/dialogs' import { useDragAndDropStore } from '../store/dragging.ts' import { useFilesStore } from '../store/files.ts' import { usePathsStore } from '../store/paths.ts' import { useSelectionStore } from '../store/selection.ts' import { useUploaderStore } from '../store/uploader.ts' -import filesListWidthMixin from '../mixins/filesListWidth.ts' import logger from '../logger' export default defineComponent({ @@ -66,10 +66,6 @@ export default defineComponent({ NcIconSvgWrapper, }, - mixins: [ - filesListWidthMixin, - ], - props: { path: { type: String, @@ -83,6 +79,7 @@ export default defineComponent({ const pathsStore = usePathsStore() const selectionStore = useSelectionStore() const uploaderStore = useUploaderStore() + const fileListWidth = useFileListWidth() const { currentView, views } = useNavigation() return { @@ -93,6 +90,7 @@ export default defineComponent({ uploaderStore, currentView, + fileListWidth, views, } }, @@ -129,7 +127,7 @@ export default defineComponent({ wrapUploadProgressBar(): boolean { // if an upload is ongoing, and on small screens / mobile, then // show the progress bar for the upload below breadcrumbs - return this.isUploadInProgress && this.filesListWidth < 512 + return this.isUploadInProgress && this.fileListWidth < 512 }, // used to show the views icon for the first breadcrumb diff --git a/apps/files/src/components/FileEntry.vue b/apps/files/src/components/FileEntry.vue index fc5c7fb97f625..7af76c87c4318 100644 --- a/apps/files/src/components/FileEntry.vue +++ b/apps/files/src/components/FileEntry.vue @@ -36,7 +36,6 @@ @@ -91,6 +89,7 @@ import { formatFileSize } from '@nextcloud/files' import moment from '@nextcloud/moment' import { useNavigation } from '../composables/useNavigation.ts' +import { useFileListWidth } from '../composables/useFileListWidth.ts' import { useRouteParameters } from '../composables/useRouteParameters.ts' import { useActionsMenuStore } from '../store/actionsmenu.ts' import { useDragAndDropStore } from '../store/dragging.ts' @@ -135,6 +134,7 @@ export default defineComponent({ const filesStore = useFilesStore() const renamingStore = useRenamingStore() const selectionStore = useSelectionStore() + const filesListWidth = useFileListWidth() // The file list is guaranteed to be only shown with active view - thus we can set the `loaded` flag const { currentView } = useNavigation(true) const { @@ -152,6 +152,7 @@ export default defineComponent({ currentDir, currentFileId, currentView, + filesListWidth, } }, diff --git a/apps/files/src/components/FileEntry/FileEntryActions.vue b/apps/files/src/components/FileEntry/FileEntryActions.vue index 8c150b780876b..f8fde7842a879 100644 --- a/apps/files/src/components/FileEntry/FileEntryActions.vue +++ b/apps/files/src/components/FileEntry/FileEntryActions.vue @@ -94,6 +94,7 @@ import ArrowLeftIcon from 'vue-material-design-icons/ArrowLeft.vue' import CustomElementRender from '../CustomElementRender.vue' import { useNavigation } from '../../composables/useNavigation' +import { useFileListWidth } from '../../composables/useFileListWidth.ts' import logger from '../../logger.ts' export default defineComponent({ @@ -110,10 +111,6 @@ export default defineComponent({ }, props: { - filesListWidth: { - type: Number, - required: true, - }, loading: { type: String, required: true, @@ -135,11 +132,14 @@ export default defineComponent({ setup() { // The file list is guaranteed to be only shown with active view - thus we can set the `loaded` flag const { currentView } = useNavigation(true) + + const filesListWidth = useFileListWidth() const enabledFileActions = inject('enabledFileActions', []) return { currentView, enabledFileActions, + filesListWidth, } }, diff --git a/apps/files/src/components/FileEntry/FileEntryName.vue b/apps/files/src/components/FileEntry/FileEntryName.vue index e4cffba32b79d..1eff841738b54 100644 --- a/apps/files/src/components/FileEntry/FileEntryName.vue +++ b/apps/files/src/components/FileEntry/FileEntryName.vue @@ -48,6 +48,7 @@ import { defineComponent, inject } from 'vue' import NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js' import { useNavigation } from '../../composables/useNavigation' +import { useFileListWidth } from '../../composables/useFileListWidth.ts' import { useRouteParameters } from '../../composables/useRouteParameters.ts' import { useRenamingStore } from '../../store/renaming.ts' import { getFilenameValidity } from '../../utils/filenameValidity.ts' @@ -75,10 +76,6 @@ export default defineComponent({ type: String, required: true, }, - filesListWidth: { - type: Number, - required: true, - }, nodes: { type: Array as PropType, required: true, @@ -97,6 +94,7 @@ export default defineComponent({ // The file list is guaranteed to be only shown with active view - thus we can set the `loaded` flag const { currentView } = useNavigation(true) const { directory } = useRouteParameters() + const filesListWidth = useFileListWidth() const renamingStore = useRenamingStore() const defaultFileAction = inject('defaultFileAction') @@ -105,6 +103,7 @@ export default defineComponent({ currentView, defaultFileAction, directory, + filesListWidth, renamingStore, } diff --git a/apps/files/src/components/FileEntryGrid.vue b/apps/files/src/components/FileEntryGrid.vue index f0b086ac891d8..0b0344afb99ae 100644 --- a/apps/files/src/components/FileEntryGrid.vue +++ b/apps/files/src/components/FileEntryGrid.vue @@ -38,7 +38,6 @@ , @@ -81,10 +77,12 @@ export default defineComponent({ const actionsMenuStore = useActionsMenuStore() const filesStore = useFilesStore() const selectionStore = useSelectionStore() + const fileListWidth = useFileListWidth() const { directory } = useRouteParameters() return { directory, + fileListWidth, actionsMenuStore, filesStore, @@ -126,13 +124,13 @@ export default defineComponent({ }, inlineActions() { - if (this.filesListWidth < 512) { + if (this.fileListWidth < 512) { return 0 } - if (this.filesListWidth < 768) { + if (this.fileListWidth < 768) { return 1 } - if (this.filesListWidth < 1024) { + if (this.fileListWidth < 1024) { return 2 } return 3 diff --git a/apps/files/src/components/FilesListVirtual.vue b/apps/files/src/components/FilesListVirtual.vue index d4c3d9495b717..52ba69d8b9794 100644 --- a/apps/files/src/components/FilesListVirtual.vue +++ b/apps/files/src/components/FilesListVirtual.vue @@ -12,7 +12,7 @@ isMtimeAvailable, isSizeAvailable, nodes, - filesListWidth, + fileListWidth, }" :scroll-to-index="scrollToIndex" :caption="caption"> @@ -39,7 +39,7 @@