diff --git a/changelog/unreleased/enhancement-add-multiple-selection-sidebar b/changelog/unreleased/enhancement-add-multiple-selection-sidebar new file mode 100644 index 00000000000..49b7f609108 --- /dev/null +++ b/changelog/unreleased/enhancement-add-multiple-selection-sidebar @@ -0,0 +1,7 @@ +Enhancement: Add multiple selection Sidebar + +We've changed the sidebar so if a user selects multiple files or folders +he sees a detailed view of his selection in the sidebar. + +https://github.com/owncloud/web/issues/5164 +https://github.com/owncloud/web/pull/5630 \ No newline at end of file diff --git a/packages/web-app-files/src/App.vue b/packages/web-app-files/src/App.vue index e810c7194e7..0d3af18ac05 100644 --- a/packages/web-app-files/src/App.vue +++ b/packages/web-app-files/src/App.vue @@ -4,7 +4,6 @@ ref="filesListWrapper" tabindex="-1" class="files-list-wrapper uk-width-expand" - :class="{ 'uk-visible@m': _sidebarOpen }" @dragover="$_ocApp_dragOver" > @@ -12,12 +11,11 @@ import Mixins from './mixins' import MixinRoutes from './mixins/routes' -import MixinDestroySideBar from './mixins/sidebar/destroySideBar' import { mapActions, mapGetters, mapMutations } from 'vuex' import AppBar from './components/AppBar/AppBar.vue' import ProgressBar from './components/Upload/ProgressBar.vue' import SideBar from './components/SideBar/SideBar.vue' +import { bus } from 'web-pkg/src/instance' export default { components: { @@ -39,7 +37,7 @@ export default { ProgressBar, SideBar }, - mixins: [Mixins, MixinRoutes, MixinDestroySideBar], + mixins: [Mixins, MixinRoutes], data() { return { createFolder: false, @@ -48,36 +46,39 @@ export default { upload: false, fileName: '', selected: [], - breadcrumbs: [] + breadcrumbs: [], + sidebarClosed: true } }, computed: { - ...mapGetters('Files', ['dropzone', 'highlightedFile', 'inProgress']), - - _sidebarOpen() { - return this.highlightedFile !== null - }, + ...mapGetters('Files', ['dropzone', 'inProgress', 'selectedFiles']), $_uploadProgressVisible() { return this.inProgress.length > 0 + }, + showSidebar() { + return this.selectedFiles && this.selectedFiles.length > 0 && !this.sidebarClosed } }, watch: { $route() { - this.$_destroySideBar_hideDetails() this.resetFileSelection() }, - highlightedFile(file) { - if (file !== null) { - return - } - this.$_destroySideBar_hideDetails() + showSidebar(visible) { + if (visible) return + this.SET_APP_SIDEBAR_ACTIVE_PANEL(null) } }, created() { this.$root.$on('upload-end', () => { this.delayForScreenreader(() => this.$refs.filesListWrapper.focus()) }) + bus.on('app.files.sidebar.close', () => { + this.sidebarClosed = true + }) + bus.on('app.files.sidebar.show', () => { + this.sidebarClosed = false + }) }, beforeDestroy() { @@ -87,7 +88,10 @@ export default { methods: { ...mapActions('Files', ['dragOver', 'resetFileSelection']), ...mapActions(['showMessage']), - ...mapMutations(['SET_SIDEBAR_FOOTER_CONTENT_COMPONENT']), + ...mapMutations('Files', [ + 'SET_SIDEBAR_FOOTER_CONTENT_COMPONENT', + 'SET_APP_SIDEBAR_ACTIVE_PANEL' + ]), trace() { console.info('trace', arguments) diff --git a/packages/web-app-files/src/components/AppBar/AppBar.vue b/packages/web-app-files/src/components/AppBar/AppBar.vue index 901178cd3f1..5208c6d1093 100644 --- a/packages/web-app-files/src/components/AppBar/AppBar.vue +++ b/packages/web-app-files/src/components/AppBar/AppBar.vue @@ -288,7 +288,12 @@ export default { }, methods: { - ...mapActions('Files', ['updateFileProgress', 'removeFilesFromTrashbin', 'loadIndicators']), + ...mapActions('Files', [ + 'updateFileProgress', + 'removeFilesFromTrashbin', + 'loadIndicators', + 'setFileSelection' + ]), ...mapActions(['openFile', 'showMessage', 'createModal', 'setModalInputErrorMessage']), ...mapMutations('Files', ['UPSERT_RESOURCE', 'SET_HIDDEN_FILES_VISIBILITY']), ...mapMutations(['SET_QUOTA']), @@ -362,7 +367,7 @@ export default { } setTimeout(() => { - this.setHighlightedFile(resource) + this.setFileSelection([resource]) this.scrollToResource(resource) }) } catch (error) { @@ -451,7 +456,7 @@ export default { } setTimeout(() => { - this.setHighlightedFile(resource) + this.setFileSelection([resource]) this.scrollToResource(resource) }) } catch (error) { diff --git a/packages/web-app-files/src/components/AppBar/SelectedResources/BatchActions.vue b/packages/web-app-files/src/components/AppBar/SelectedResources/BatchActions.vue index 4b72cd60d2e..6b39352ef8a 100644 --- a/packages/web-app-files/src/components/AppBar/SelectedResources/BatchActions.vue +++ b/packages/web-app-files/src/components/AppBar/SelectedResources/BatchActions.vue @@ -181,7 +181,7 @@ export default { }, methods: { - ...mapActions('Files', ['removeFilesFromTrashbin', 'resetFileSelection', 'setHighlightedFile']), + ...mapActions('Files', ['removeFilesFromTrashbin', 'resetFileSelection']), ...mapActions(['showMessage']), ...mapMutations('Files', ['UPDATE_RESOURCE']), @@ -206,7 +206,6 @@ export default { }) } this.resetFileSelection() - this.setHighlightedFile(null) }, emptyTrashbin() { diff --git a/packages/web-app-files/src/components/AppBar/SelectedResources/SizeInfo.vue b/packages/web-app-files/src/components/AppBar/SelectedResources/SizeInfo.vue index 3f2dd82b3d8..40a9e3a8df6 100644 --- a/packages/web-app-files/src/components/AppBar/SelectedResources/SizeInfo.vue +++ b/packages/web-app-files/src/components/AppBar/SelectedResources/SizeInfo.vue @@ -19,6 +19,7 @@ >%{ amount } selected item diff --git a/packages/web-app-files/src/components/SideBar/Details/FileDetails.vue b/packages/web-app-files/src/components/SideBar/Details/FileDetails.vue index 901318f4e74..845a08d4bb4 100644 --- a/packages/web-app-files/src/components/SideBar/Details/FileDetails.vue +++ b/packages/web-app-files/src/components/SideBar/Details/FileDetails.vue @@ -6,7 +6,7 @@ :style="{ 'background-image': $asyncComputed.preview.updating ? 'none' : `url(${preview})` }" - class="details-preview uk-flex uk-flex-middle uk-flex-center oc-mb-m" + class="details-preview uk-flex uk-flex-middle uk-flex-center oc-mb" data-testid="preview" > @@ -34,7 +34,7 @@

- +
@@ -233,7 +233,7 @@ export default { } }, methods: { - ...mapActions('Files', ['setHighlightedFile', 'loadPreview', 'loadVersions']), + ...mapActions('Files', ['loadPreview', 'loadVersions']), ...mapMutations('Files', ['SET_APP_SIDEBAR_ACTIVE_PANEL']), expandPeoplesAccordion() { this.SET_APP_SIDEBAR_ACTIVE_PANEL('sharing-item') diff --git a/packages/web-app-files/src/components/SideBar/Details/FileDetailsMultiple.vue b/packages/web-app-files/src/components/SideBar/Details/FileDetailsMultiple.vue new file mode 100644 index 00000000000..b0f29cf47cd --- /dev/null +++ b/packages/web-app-files/src/components/SideBar/Details/FileDetailsMultiple.vue @@ -0,0 +1,120 @@ + + + diff --git a/packages/web-app-files/src/components/SideBar/SideBar.vue b/packages/web-app-files/src/components/SideBar/SideBar.vue index 345ed543b8e..b3eafe0b1de 100644 --- a/packages/web-app-files/src/components/SideBar/SideBar.vue +++ b/packages/web-app-files/src/components/SideBar/SideBar.vue @@ -1,6 +1,5 @@