mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
refactor(files_sharing): adjust note to recipient files header
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
f736ed242e
commit
31dd2acf13
1 changed files with 10 additions and 9 deletions
|
|
@ -1,14 +1,15 @@
|
|||
import type { Folder } from '@nextcloud/files'
|
||||
/**
|
||||
/*!
|
||||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import type { IFolder } from '@nextcloud/files'
|
||||
import type { ComponentPublicInstance, VueConstructor } from 'vue'
|
||||
|
||||
import { Header, registerFileListHeaders } from '@nextcloud/files'
|
||||
import { registerFileListHeader } from '@nextcloud/files'
|
||||
import Vue from 'vue'
|
||||
|
||||
type IFilesHeaderNoteToRecipient = ComponentPublicInstance & { updateFolder: (folder: Folder) => void }
|
||||
type IFilesHeaderNoteToRecipient = ComponentPublicInstance & { updateFolder: (folder: IFolder) => void }
|
||||
|
||||
/**
|
||||
* Register the "note to recipient" as a files list header
|
||||
|
|
@ -17,19 +18,19 @@ export default function registerNoteToRecipient() {
|
|||
let FilesHeaderNoteToRecipient: VueConstructor
|
||||
let instance: IFilesHeaderNoteToRecipient
|
||||
|
||||
registerFileListHeaders(new Header({
|
||||
registerFileListHeader({
|
||||
id: 'note-to-recipient',
|
||||
order: 0,
|
||||
// Always if there is a note
|
||||
enabled: (folder: Folder) => Boolean(folder.attributes.note),
|
||||
enabled: (folder: IFolder) => Boolean(folder.attributes.note),
|
||||
// Update the root folder if needed
|
||||
updated: (folder: Folder) => {
|
||||
updated: (folder: IFolder) => {
|
||||
if (instance) {
|
||||
instance.updateFolder(folder)
|
||||
}
|
||||
},
|
||||
// render simply spawns the component
|
||||
render: async (el: HTMLElement, folder: Folder) => {
|
||||
render: async (el: HTMLElement, folder: IFolder) => {
|
||||
if (FilesHeaderNoteToRecipient === undefined) {
|
||||
const { default: component } = await import('../views/FilesHeaderNoteToRecipient.vue')
|
||||
FilesHeaderNoteToRecipient = Vue.extend(component)
|
||||
|
|
@ -37,5 +38,5 @@ export default function registerNoteToRecipient() {
|
|||
instance = new FilesHeaderNoteToRecipient().$mount(el) as unknown as IFilesHeaderNoteToRecipient
|
||||
instance.updateFolder(folder)
|
||||
},
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue