Skip to content

Commit fdca64b

Browse files
committed
fix(files): drop visible and adjust drag-to-scroll feature
Signed-off-by: John Molakvoæ <[email protected]>
1 parent 0ea83e2 commit fdca64b

5 files changed

Lines changed: 16 additions & 38 deletions

File tree

apps/files/src/components/FileEntry.vue

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
-->
2222

2323
<template>
24-
<tr :class="{'files-list__row--visible': visible, 'files-list__row--active': isActive, 'files-list__row--dragover': dragover, 'files-list__row--loading': isLoading}"
24+
<tr :class="{'files-list__row--dragover': dragover, 'files-list__row--loading': isLoading}"
2525
data-cy-files-list-row
2626
:data-cy-files-list-row-fileid="fileid"
2727
:data-cy-files-list-row-name="source.basename"
@@ -37,8 +37,7 @@
3737
<span v-if="source.attributes.failed" class="files-list__row--failed" />
3838

3939
<!-- Checkbox -->
40-
<FileEntryCheckbox v-if="visible"
41-
:display-name="displayName"
40+
<FileEntryCheckbox :display-name="displayName"
4241
:fileid="fileid"
4342
:is-loading="isLoading"
4443
:nodes="nodes" />
@@ -67,8 +66,7 @@
6766
:files-list-width="filesListWidth"
6867
:loading.sync="loading"
6968
:opened.sync="openedMenu"
70-
:source="source"
71-
:visible="visible" />
69+
:source="source" />
7270

7371
<!-- Size -->
7472
<td v-if="!compact && isSizeAvailable"
@@ -95,8 +93,7 @@
9593
class="files-list__row-column-custom"
9694
:data-cy-files-list-row-column-custom="column.id"
9795
@click="openDetailsIfAvailable">
98-
<CustomElementRender v-if="visible"
99-
:current-view="currentView"
96+
<CustomElementRender :current-view="currentView"
10097
:render="column.render"
10198
:source="source" />
10299
</td>
@@ -146,10 +143,6 @@ export default Vue.extend({
146143
},
147144
148145
props: {
149-
visible: {
150-
type: Boolean,
151-
default: false,
152-
},
153146
isMtimeAvailable: {
154147
type: Boolean,
155148
default: false,

apps/files/src/components/FileEntry/FileEntryActions.vue

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
-
2121
-->
2222
<template>
23-
<td v-show="visible"
24-
class="files-list__row-actions"
23+
<td class="files-list__row-actions"
2524
data-cy-files-list-row-actions>
2625
<!-- Render actions -->
2726
<CustomElementRender v-for="action in enabledRenderActions"
@@ -33,8 +32,7 @@
3332
class="files-list__row-action--inline" />
3433

3534
<!-- Menu actions -->
36-
<NcActions v-if="visible"
37-
ref="actionsMenu"
35+
<NcActions ref="actionsMenu"
3836
:boundaries-element="getBoundariesElement"
3937
:container="getBoundariesElement"
4038
:disabled="isLoading || loading !== ''"
@@ -71,7 +69,6 @@ import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js
7169
import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
7270
7371
import CustomElementRender from '../CustomElementRender.vue'
74-
7572
import logger from '../../logger.js'
7673
7774
// The registered actions list
@@ -105,10 +102,6 @@ export default Vue.extend({
105102
type: Object as PropType<Node>,
106103
required: true,
107104
},
108-
visible: {
109-
type: Boolean,
110-
default: false,
111-
},
112105
gridMode: {
113106
type: Boolean,
114107
default: false,
@@ -153,7 +146,7 @@ export default Vue.extend({
153146
154147
// Enabled action that are displayed inline with a custom render function
155148
enabledRenderActions() {
156-
if (!this.visible || this.gridMode) {
149+
if (this.gridMode) {
157150
return []
158151
}
159152
return this.enabledActions.filter(action => typeof action.renderInline === 'function')

apps/files/src/components/FileEntryGrid.vue

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
-->
2222

2323
<template>
24-
<tr :class="{'files-list__row--visible': visible, 'files-list__row--active': isActive, 'files-list__row--dragover': dragover, 'files-list__row--loading': isLoading}"
24+
<tr :class="{'files-list__row--active': isActive, 'files-list__row--dragover': dragover, 'files-list__row--loading': isLoading}"
2525
data-cy-files-list-row
2626
:data-cy-files-list-row-fileid="fileid"
2727
:data-cy-files-list-row-name="source.basename"
@@ -37,8 +37,7 @@
3737
<span v-if="source.attributes.failed" class="files-list__row--failed" />
3838

3939
<!-- Checkbox -->
40-
<FileEntryCheckbox v-if="visible"
41-
:display-name="displayName"
40+
<FileEntryCheckbox :display-name="displayName"
4241
:fileid="fileid"
4342
:is-loading="isLoading"
4443
:nodes="nodes" />
@@ -69,8 +68,7 @@
6968
:grid-mode="true"
7069
:loading.sync="loading"
7170
:opened.sync="openedMenu"
72-
:source="source"
73-
:visible="visible" />
71+
:source="source" />
7472
</tr>
7573
</template>
7674

@@ -115,10 +113,6 @@ export default Vue.extend({
115113
116114
inheritAttrs: false,
117115
props: {
118-
visible: {
119-
type: Boolean,
120-
default: false,
121-
},
122116
source: {
123117
type: [Folder, NcFile, Node] as PropType<Node>,
124118
required: true,

apps/files/src/components/FilesListVirtual.vue

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,18 +259,17 @@ export default Vue.extend({
259259
event.preventDefault()
260260
event.stopPropagation()
261261
262-
// If reaching top, scroll up
263-
const firstVisible = this.$refs.table?.$el?.querySelector('.files-list__row--visible') as HTMLElement
264-
const firstSibling = firstVisible?.previousElementSibling as HTMLElement
265-
if ([firstVisible, firstSibling].some(elmt => elmt?.contains(event.target as Node))) {
262+
const tableTop = this.$refs.table.$el.getBoundingClientRect().top
263+
const tableBottom = tableTop + this.$refs.table.$el.getBoundingClientRect().height
264+
265+
// If reaching top, scroll up. Using 100 because of the floating header
266+
if (event.clientY < tableTop + 100) {
266267
this.$refs.table.$el.scrollTop = this.$refs.table.$el.scrollTop - 25
267268
return
268269
}
269270
270271
// If reaching bottom, scroll down
271-
const lastVisible = [...(this.$refs.table?.$el?.querySelectorAll('.files-list__row--visible') || [])].pop() as HTMLElement
272-
const nextSibling = lastVisible?.nextElementSibling as HTMLElement
273-
if ([lastVisible, nextSibling].some(elmt => elmt?.contains(event.target as Node))) {
272+
if (event.clientY > tableBottom - 50) {
274273
this.$refs.table.$el.scrollTop = this.$refs.table.$el.scrollTop + 25
275274
}
276275
},

apps/files/src/components/VirtualList.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
<component :is="dataComponent"
1919
v-for="({key, item}, i) in renderedItems"
2020
:key="key"
21-
:visible="true"
2221
:source="item"
2322
:index="i"
2423
v-bind="extraProps" />

0 commit comments

Comments
 (0)