Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions apps/files/src/components/FileEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<script lang='ts'>
import { debounce } from 'debounce'
import { formatFileSize } from '@nextcloud/files'
import { Fragment } from 'vue-fragment'
import { Fragment } from 'vue-frag'
import { join } from 'path'
import { showError, showSuccess } from '@nextcloud/dialogs'
import { translate } from '@nextcloud/l10n'
Expand All @@ -115,7 +115,6 @@ import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js'
import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
import isMobileMixin from '@nextcloud/vue/dist/Mixins/isMobile.js'
import Vue from 'vue'

import { getFileActions } from '../services/FileAction.ts'
Expand Down Expand Up @@ -147,10 +146,6 @@ export default Vue.extend({
NcLoadingIcon,
},

mixins: [
isMobileMixin,
],

props: {
active: {
type: Boolean,
Expand All @@ -172,6 +167,10 @@ export default Vue.extend({
type: Array,
required: true,
},
filesListWidth: {
type: Number,
default: 0,
},
},

setup() {
Expand Down Expand Up @@ -207,6 +206,10 @@ export default Vue.extend({
},

columns() {
// Hide columns if the list is too small
if (this.filesListWidth < 512) {
return []
}
return this.currentView?.columns || []
},

Expand Down Expand Up @@ -300,14 +303,14 @@ export default Vue.extend({
},

enabledInlineActions() {
if (this.isMobile) {
if (this.filesListWidth < 768) {
return []
}
return this.enabledActions.filter(action => action?.inline?.(this.source, this.currentView))
},

enabledMenuActions() {
if (this.isMobile) {
if (this.filesListWidth < 768) {
return this.enabledActions
}

Expand Down
11 changes: 10 additions & 1 deletion apps/files/src/components/FilesListFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
<td class="files-list__row-actions" />

<!-- Size -->
<td v-if="isSizeAvailable" class="files-list__column files-list__row-size">
<td v-if="isSizeAvailable"
class="files-list__column files-list__row-size">
<span>{{ totalSize }}</span>
</td>

Expand Down Expand Up @@ -78,6 +79,10 @@ export default Vue.extend({
type: String,
default: '',
},
filesListWidth: {
type: Number,
default: 0,
},
},

setup() {
Expand Down Expand Up @@ -112,6 +117,10 @@ export default Vue.extend({
},

columns() {
// Hide columns if the list is too small
if (this.filesListWidth < 512) {
return []
}
return this.currentView?.columns || []
},

Expand Down
8 changes: 8 additions & 0 deletions apps/files/src/components/FilesListHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ export default Vue.extend({
type: Array,
required: true,
},
filesListWidth: {
type: Number,
default: 0,
},
},

setup() {
Expand All @@ -123,6 +127,10 @@ export default Vue.extend({
},

columns() {
// Hide columns if the list is too small
if (this.filesListWidth < 512) {
return []
}
return this.currentView?.columns || []
},

Expand Down
13 changes: 8 additions & 5 deletions apps/files/src/components/FilesListHeaderActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
:disabled="!!loading || areSomeNodesLoading"
:force-title="true"
:inline="inlineActions"
:menu-title="inlineActions === 0 ? t('files', 'Actions') : null"
:menu-title="inlineActions <= 1 ? t('files', 'Actions') : null"
:open.sync="openedMenu">
<NcActionButton v-for="action in enabledActions"
:key="action.id"
Expand Down Expand Up @@ -53,7 +53,7 @@ import { getFileActions } from '../services/FileAction.ts'
import { useActionsMenuStore } from '../store/actionsmenu.ts'
import { useFilesStore } from '../store/files.ts'
import { useSelectionStore } from '../store/selection.ts'
import clientWidthMixin from '../mixins/clientWidth.ts'
import filesListWidthMixin from '../mixins/filesListWidth.ts'
import CustomSvgIconRender from './CustomSvgIconRender.vue'
import logger from '../logger.js'

Expand All @@ -71,7 +71,7 @@ export default Vue.extend({
},

mixins: [
clientWidthMixin,
filesListWidthMixin,
],

props: {
Expand Down Expand Up @@ -130,10 +130,13 @@ export default Vue.extend({
},

inlineActions() {
if (this.clientWidth < 480) {
if (this.filesListWidth < 512) {
return 0
}
if (this.filesListWidth < 768) {
return 1
}
if (this.clientWidth < 768) {
if (this.filesListWidth < 1024) {
return 2
}
return 3
Expand Down
35 changes: 17 additions & 18 deletions apps/files/src/components/FilesListVirtual.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<FileEntry :active="active"
:index="index"
:is-size-available="isSizeAvailable"
:files-list-width="filesListWidth"
:nodes="nodes"
:source="item" />
</template>
Expand All @@ -48,12 +49,17 @@
</caption>

<!-- Thead-->
<FilesListHeader :is-size-available="isSizeAvailable" :nodes="nodes" />
<FilesListHeader :files-list-width="filesListWidth"
:is-size-available="isSizeAvailable"
:nodes="nodes" />
</template>

<template #after>
<!-- Tfoot-->
<FilesListFooter :is-size-available="isSizeAvailable" :nodes="nodes" :summary="summary" />
<FilesListFooter :files-list-width="filesListWidth"
:is-size-available="isSizeAvailable"
:nodes="nodes"
:summary="summary" />
</template>
</RecycleScroller>
</template>
Expand All @@ -66,6 +72,7 @@ import Vue from 'vue'
import FileEntry from './FileEntry.vue'
import FilesListFooter from './FilesListFooter.vue'
import FilesListHeader from './FilesListHeader.vue'
import filesListWidthMixin from '../mixins/filesListWidth.ts'

export default Vue.extend({
name: 'FilesListVirtual',
Expand All @@ -77,6 +84,10 @@ export default Vue.extend({
FilesListFooter,
},

mixins: [
filesListWidthMixin,
],

props: {
currentView: {
type: Object,
Expand Down Expand Up @@ -111,6 +122,10 @@ export default Vue.extend({
return translate('files', '{summaryFile} and {summaryFolder}', this)
},
isSizeAvailable() {
// Hide size column on narrow screens
if (this.filesListWidth < 768) {
return false
}
return this.nodes.some(node => node.attributes.size !== undefined)
},
},
Expand Down Expand Up @@ -318,22 +333,6 @@ export default Vue.extend({
.files-list__row-column-custom {
width: calc(var(--row-height) * 2);
}

@media (max-width: 768px) {
// Hide any column after the size menu on mobile
.files-list__row-size ~ td,
.files-list__row-size ~ th {
display: none;
}
}

@media (max-width: 480px) {
// Hide any column after the actions menu on short mobile
.files-list__row-actions ~ td,
.files-list__row-actions ~ th {
display: none;
}
}
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ import Vue from 'vue'
export default Vue.extend({
data() {
return {
clientWidth: null as number | null,
filesListWidth: null as number | null,
}
},
created() {
window.addEventListener('resize', this.handleWindowResize)
this.handleWindowResize()
const fileListEl = document.querySelector('#app-content-vue')
this.$resizeObserver = new ResizeObserver((entries) => {
if (entries.length > 0 && entries[0].target === fileListEl) {
this.filesListWidth = entries[0].contentRect.width
}
})
this.$resizeObserver.observe(fileListEl as Element)
},
beforeDestroy() {
window.removeEventListener('resize', this.handleWindowResize)
},
methods: {
handleWindowResize() {
this.clientWidth = document.documentElement.clientWidth
},
this.$resizeObserver.disconnect()
},
})
4 changes: 2 additions & 2 deletions dist/comments-comments-app.js

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions dist/comments-comments-app.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,25 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
* @copyright Copyright (c) 2021 John Molakvoæ <[email protected]>
*
* @author John Molakvoæ <[email protected]>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
2 changes: 1 addition & 1 deletion dist/comments-comments-app.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/comments-comments-tab.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading