From b7df4196e2883da9028f8c5d646fbbf5ae10cf49 Mon Sep 17 00:00:00 2001 From: John Molakvoæ Date: Tue, 11 Apr 2023 09:31:30 +0200 Subject: feat(files): right click MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- apps/files/src/components/FileEntry.vue | 47 +++++++++++++++++++--- .../src/components/FilesListHeaderActions.vue | 15 ++++++- apps/files/src/store/actionsmenu.ts | 31 ++++++++++++++ apps/files/src/types.ts | 7 ++++ 4 files changed, 93 insertions(+), 7 deletions(-) create mode 100644 apps/files/src/store/actionsmenu.ts (limited to 'apps/files/src') diff --git a/apps/files/src/components/FileEntry.vue b/apps/files/src/components/FileEntry.vue index eb6ad9f7e18..337e4c7b6ac 100644 --- a/apps/files/src/components/FileEntry.vue +++ b/apps/files/src/components/FileEntry.vue @@ -66,7 +66,8 @@ ref="actionsMenu" :disabled="source._loading" :force-title="true" - :inline="enabledInlineActions.length"> + :inline="enabledInlineActions.length" + :open.sync="openedMenu"> 1 + this.actionsMenuStore.opened = this.isSelected && isMoreThanOneSelected ? 'global' : this + + // Prevent any browser defaults + event.preventDefault() + event.stopPropagation() + }, + t: translate, formatFileSize, }, diff --git a/apps/files/src/components/FilesListHeaderActions.vue b/apps/files/src/components/FilesListHeaderActions.vue index d60fd81ad00..f136e281f09 100644 --- a/apps/files/src/components/FilesListHeaderActions.vue +++ b/apps/files/src/components/FilesListHeaderActions.vue @@ -24,7 +24,8 @@ + :inline="3" + :open.sync="openedMenu"> node._loading) }, + + openedMenu: { + get() { + return this.actionsMenuStore.opened === 'global' + }, + set(opened) { + this.actionsMenuStore.opened = opened ? 'global' : null + }, + }, }, methods: { diff --git a/apps/files/src/store/actionsmenu.ts b/apps/files/src/store/actionsmenu.ts new file mode 100644 index 00000000000..b68f4998470 --- /dev/null +++ b/apps/files/src/store/actionsmenu.ts @@ -0,0 +1,31 @@ +/** + * @copyright Copyright (c) 2023 John Molakvoæ + * + * @author John Molakvoæ + * + * @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 . + * + */ +/* eslint-disable */ +import { defineStore } from 'pinia' +import Vue from 'vue' +import type { ActionsMenuStore } from '../types' + +export const useActionsMenuStore = defineStore('actionsmenu', { + state: () => ({ + opened: null, + } as ActionsMenuStore), +}) diff --git a/apps/files/src/types.ts b/apps/files/src/types.ts index 9bbb572faaf..4c3d57d3e62 100644 --- a/apps/files/src/types.ts +++ b/apps/files/src/types.ts @@ -22,6 +22,7 @@ /* eslint-disable */ import type { Folder } from '@nextcloud/files' import type { Node } from '@nextcloud/files' +import type { ComponentInstance } from 'vue' // Global definitions export type Service = string @@ -86,3 +87,9 @@ export interface SelectionStore { lastSelection: FileId[] lastSelectedIndex: number | null } + +// Actions menu store +export type GlobalActions = 'global' +export interface ActionsMenuStore { + opened: ComponentInstance|GlobalActions|null +} -- cgit v1.2.3