Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nextcloud-libraries/nextcloud-dialogs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.3.1
Choose a base ref
...
head repository: nextcloud-libraries/nextcloud-dialogs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.3.2
Choose a head ref
Loading
Showing with 5,023 additions and 8,737 deletions.
  1. +19 −0 CHANGELOG.md
  2. +2 −3 l10n/es.pot
  3. +14 −1 l10n/it.pot
  4. +8 −1 l10n/ru.pot
  5. +21 −20 l10n/zh_HK.pot
  6. +30 −28 lib/components/FilePicker/FilePicker.vue
  7. +4 −6 lib/components/FilePicker/FilePreview.vue
  8. +6 −0 lib/components/types.ts
  9. +11 −10 lib/composables/dav.spec.ts
  10. +14 −5 lib/composables/dav.ts
  11. +4,876 −8,645 package-lock.json
  12. +18 −18 package.json
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,25 @@

All notable changes to this project will be documented in this file.

## [v5.3.2](https://github.com/nextcloud-libraries/nextcloud-dialogs/tree/v5.3.2) (2024-06-10)
[Full Changelog](https://github.com/nextcloud-libraries/nextcloud-dialogs/compare/v5.3.1...v5.3.2)

### Fixed
* fix: Also add current folder to button factory [\#1351](https://github.com/nextcloud-libraries/nextcloud-dialogs/pull/1351) \([susnux](https://github.com/susnux)\)
* fix(FilePicker): Do not append image preloader to DOM [\#1340](https://github.com/nextcloud-libraries/nextcloud-dialogs/pull/1340) \([susnux](https://github.com/susnux)\)

### Changed
* Updated translations
* chore(deps): Bump webdav to 5.6.0
* chore(deps): Bump @nextcloud/router to 3.0.1
* chore(deps): Bump @nextcloud/auth to 2.3.0
* chore(deps): Bump @nextcloud/axios to 2.5.0
* chore(deps): Bump @nextcloud/initial-state to 2.2.0
* chore(deps): Bump @nextcloud/l10n to 3.1.0
* chore(deps): Bump @nextcloud/event-bus to 3.3.1
* chore(deps): Bump @vueuse/core to 10.10.0
* chore(deps): Bump @nextcloud/files to 3.4.1

## [v5.3.1](https://github.com/nextcloud-libraries/nextcloud-dialogs/tree/v5.3.1) (2024-04-16)
[Full Changelog](https://github.com/nextcloud-libraries/nextcloud-dialogs/compare/v5.3.0...v5.3.1)

5 changes: 2 additions & 3 deletions l10n/es.pot
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
# Translators:
# John Molakvoæ <skjnldsv@protonmail.com>, 2023
# FranciscoFJ <dev-ooo@satel-sa.com>, 2023
# Frenzel Alejandro Avalos Montes de Oca, 2024
# Mark Ziegler <mark.ziegler@rakekniven.de>, 2024
# Julio C. Ortega, 2024
#
@@ -48,10 +47,10 @@ msgid "Could not create the new folder"
msgstr "No se pudo crear la nueva carpeta"

msgid "Could not load files settings"
msgstr "No se pudieron cargar las preferencias de archivos"
msgstr "No se pudieron cargar los ajustes de archivos"

msgid "Could not load files views"
msgstr "No se pudieron cargar las vistas previas de los archivos"
msgstr "No se pudieron cargar las vistas de los archivos"

msgid "Create directory"
msgstr "Crear directorio"
15 changes: 14 additions & 1 deletion l10n/it.pot
Original file line number Diff line number Diff line change
@@ -3,10 +3,11 @@
# John Molakvoæ <skjnldsv@protonmail.com>, 2023
# Claudio Scandella, 2023
# Raffaele Silano <raffaelone@gmail.com>, 2024
# Sebastiano Furlan, 2024
#
msgid ""
msgstr ""
"Last-Translator: Raffaele Silano <raffaelone@gmail.com>, 2024\n"
"Last-Translator: Sebastiano Furlan, 2024\n"
"Language-Team: Italian (https://app.transifex.com/nextcloud/teams/64236/it/)\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Language: it\n"
@@ -30,6 +31,12 @@ msgstr "Scegli"
msgid "Choose {file}"
msgstr "Scegli {file}"

msgid "Choose %n file"
msgid_plural "Choose %n files"
msgstr[0] "Seleziona %n file"
msgstr[1] "Seleziona %n file"
msgstr[2] "Seleziona %n file"

msgid "Copy"
msgstr "Copia"

@@ -39,6 +46,12 @@ msgstr "Copia in {target}"
msgid "Could not create the new folder"
msgstr "Impossibile creare la nuova cartella"

msgid "Could not load files settings"
msgstr "Impossibile caricare le impostazioni dei file"

msgid "Could not load files views"
msgstr "Impossibile caricare le visualizzazioni dei file"

msgid "Create directory"
msgstr "Crea directory"

9 changes: 8 additions & 1 deletion l10n/ru.pot
Original file line number Diff line number Diff line change
@@ -5,10 +5,11 @@
# ashed <craysy@gmail.com>, 2023
# Alex <kekcuha@gmail.com>, 2024
# R4SAS, 2024
# Влад, 2024
#
msgid ""
msgstr ""
"Last-Translator: R4SAS, 2024\n"
"Last-Translator: Влад, 2024\n"
"Language-Team: Russian (https://app.transifex.com/nextcloud/teams/64236/ru/)\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Language: ru\n"
@@ -48,6 +49,12 @@ msgstr "Копировать в «{target}»"
msgid "Could not create the new folder"
msgstr "Не удалось создать новую папку"

msgid "Could not load files settings"
msgstr "Не удалось загрузить настройки файлов"

msgid "Could not load files views"
msgstr "Не удалось загрузить файлы просмотров"

msgid "Create directory"
msgstr "Создать папку"

41 changes: 21 additions & 20 deletions l10n/zh_HK.pot
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
#
# Translators:
# John Molakvoæ <skjnldsv@protonmail.com>, 2023
# Café Tango, 2023
# Café Tango, 2024
#
msgid ""
msgstr ""
"Last-Translator: Café Tango, 2023\n"
"Last-Translator: Café Tango, 2024\n"
"Language-Team: Chinese (Hong Kong) (https://app.transifex.com/nextcloud/teams/64236/zh_HK/)\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Language: zh_HK\n"
"Plural-Forms: nplurals=1; plural=0;\n"

msgid "\"{name}\" is an invalid file name."
msgstr "「{name}」是無效的檔案名稱。"
msgid "\"{name}\" is an invalid folder name."
msgstr "「{name}」是無效的資料夾名稱。"

msgid "\"{name}\" is not an allowed filetype"
msgstr "「{name}」並非允許的檔案類型"
msgid "\"{name}\" is not an allowed folder name"
msgstr "「{name}」是無效的資料夾名稱。"

msgid "\"/\" is not allowed inside a file name."
msgstr "檔案名稱中不允許使用 \"/\"。"
msgid "\"/\" is not allowed inside a folder name."
msgstr "資料夾名稱中不允許使用 \"/\"。"

msgid "All files"
msgstr "所有檔案"
@@ -29,6 +29,10 @@ msgstr "選擇"
msgid "Choose {file}"
msgstr "選擇 {file}"

msgid "Choose %n file"
msgid_plural "Choose %n files"
msgstr[0] "選擇 %n 個檔案"

msgid "Copy"
msgstr "複製"

@@ -38,6 +42,12 @@ msgstr "複製到 {target}"
msgid "Could not create the new folder"
msgstr "無法建立新資料夾"

msgid "Could not load files settings"
msgstr "無法載入檔案設定"

msgid "Could not load files views"
msgstr "無法載入文件視圖"

msgid "Create directory"
msgstr "建立目錄"

@@ -47,12 +57,6 @@ msgstr "目前檢視選取器"
msgid "Favorites"
msgstr "最愛"

msgid "File name cannot be empty."
msgstr "檔案名稱不能為空。"

msgid "Filepicker sections"
msgstr "檔案挑選器部分"

msgid "Files and folders you mark as favorite will show up here."
msgstr "您標記為最愛的檔案與資料夾將會顯示在此處。"

@@ -62,12 +66,12 @@ msgstr "您最近修改的檔案與資料夾將會顯示在此處。"
msgid "Filter file list"
msgstr "過濾檔案清單"

msgid "Folder name cannot be empty."
msgstr "資料夾名稱不能為空。"

msgid "Home"
msgstr "首頁"

msgid "MIME type {mime}"
msgstr "MIME 類型 {mime}"

msgid "Modified"
msgstr "已修改"

@@ -116,8 +120,5 @@ msgstr "大小"
msgid "Undo"
msgstr "還原"

msgid "unknown"
msgstr "不詳"

msgid "Upload some content or sync with your devices!"
msgstr "上傳一些內容或與您的裝置同步"
58 changes: 30 additions & 28 deletions lib/components/FilePicker/FilePicker.vue
Original file line number Diff line number Diff line change
@@ -18,9 +18,10 @@
<div class="file-picker__main">
<!-- Header title / file list breadcrumbs -->
<FilePickerBreadcrumbs v-if="currentView === 'files'"
:path.sync="currentPath"
:path="currentPath"
:show-menu="allowPickDirectory"
@create-node="onCreateFolder" />
@create-node="onCreateFolder"
@update:path="navigatedPath = $event" />
<div v-else class="file-picker__view">
<h3>{{ viewHeadline }}</h3>
</div>
@@ -67,7 +68,7 @@ import FilePickerNavigation from './FilePickerNavigation.vue'
import { emit as emitOnEventBus } from '@nextcloud/event-bus'
import { NcDialog, NcEmptyContent } from '@nextcloud/vue'
import { computed, onMounted, ref, toRef } from 'vue'
import { computed, onMounted, ref, shallowReactive, toRef, watch } from 'vue'
import { showError } from '../../toast'
import { useDAVFiles } from '../../composables/dav'
import { useMimeFilter } from '../../composables/mime'
@@ -148,16 +149,17 @@ const isOpen = ref(true)
* Map buttons to Dialog buttons by wrapping the callback function to pass the selected files
*/
const dialogButtons = computed(() => {
const nodes = selectedFiles.length === 0 && props.allowPickDirectory && currentFolder.value ? [currentFolder.value] : selectedFiles
const buttons = typeof props.buttons === 'function'
? props.buttons(selectedFiles.value as Node[], currentPath.value, currentView.value)
? props.buttons(nodes, currentPath.value, currentView.value)
: props.buttons
return buttons.map((button) => ({
...button,
callback: () => {
// lock default close handling
isHandlingCallback = true
handleButtonClick(button.callback)
handleButtonClick(button.callback, nodes)
},
} as IFilePickerButton))
})
@@ -168,8 +170,7 @@ const dialogButtons = computed(() => {
*/
let isHandlingCallback = false
const handleButtonClick = async (callback: IFilePickerButton['callback']) => {
const nodes = selectedFiles.value.length === 0 && props.allowPickDirectory ? [await getFile(currentPath.value)] : selectedFiles.value as Node[]
const handleButtonClick = async (callback: IFilePickerButton['callback'], nodes: Node[]) => {
callback(nodes)
emit('close', nodes)
// Unlock close
@@ -189,7 +190,7 @@ const viewHeadline = computed(() => currentView.value === 'favorites' ? t('Favor
/**
* All currently selected files
*/
const selectedFiles = ref<Node[]>([])
const selectedFiles = shallowReactive<Node[]>([])
/**
* Last path navigated to using the file picker
@@ -200,28 +201,23 @@ const savedPath = ref(window?.sessionStorage.getItem('NC.FilePicker.LastPath') |
/**
* The path the user manually navigated to using this filepicker instance
*/
const navigatedPath = ref<string>()
const navigatedPath = ref('')
// Save the navigated path to the session storage on change
watch([navigatedPath], () => {
if (props.path === undefined && navigatedPath.value) {
window.sessionStorage.setItem('NC.FilePicker.LastPath', navigatedPath.value)
// Reset selected files
selectedFiles.splice(0, selectedFiles.length)
}
})
/**
* The current path that should be picked from
*/
const currentPath = computed({
const currentPath = computed(() =>
// Only use the path for the files view as favorites and recent only works on the root
get: () => currentView.value === 'files' ? navigatedPath.value || props.path || savedPath.value : '/',
/**
* Navigate to the new path and save it to the session storage
*
* @param path The new path
*/
set: (path: string) => {
if (props.path === undefined) {
window.sessionStorage.setItem('NC.FilePicker.LastPath', path)
}
navigatedPath.value = path
// Reset selected files
selectedFiles.value = []
},
})
currentView.value === 'files' ? navigatedPath.value || props.path || savedPath.value : '/',
)
/**
* A string used to filter files in current view
@@ -230,7 +226,13 @@ const filterString = ref('')
const { isSupportedMimeType } = useMimeFilter(toRef(props, 'mimetypeFilter')) // vue 3.3 will allow cleaner syntax of toRef(() => props.mimetypeFilter)
const { files, isLoading, loadFiles, getFile, createDirectory } = useDAVFiles(currentView, currentPath, isPublic)
const {
files,
folder: currentFolder,
isLoading,
loadFiles,
createDirectory,
} = useDAVFiles(currentView, currentPath, isPublic)
onMounted(() => loadFiles())
@@ -254,7 +256,7 @@ const filteredFiles = computed(() => {
filtered = filtered.filter((file) => file.basename.toLowerCase().includes(filterString.value.toLowerCase()))
}
if (props.filterFn) {
filtered = filtered.filter((f) => props.filterFn(f as Node))
filtered = filtered.filter((f) => props.filterFn!(f as Node))
}
return filtered
})
@@ -281,7 +283,7 @@ const noFilesDescription = computed(() => {
const onCreateFolder = async (name: string) => {
try {
const folder = await createDirectory(name)
currentPath.value = folder.path
navigatedPath.value = folder.path
// emit event bus to force files app to reload that file if needed
emitOnEventBus('files:node:created', files.value.filter((file) => file.basename === name)[0])
} catch (error) {
10 changes: 4 additions & 6 deletions lib/components/FilePicker/FilePreview.vue
Original file line number Diff line number Diff line change
@@ -10,9 +10,8 @@

<script setup lang="ts">
import { FileType, type Node } from '@nextcloud/files'
import { computed, ref, watch } from 'vue'
import { computed, ref, watchEffect } from 'vue'
import { getPreviewURL } from '../../composables/preview'
import { t } from '../../utils/l10n'
import IconFile from 'vue-material-design-icons/File.vue'
import IconFolder from 'vue-material-design-icons/Folder.vue'
@@ -32,17 +31,16 @@ const previewURL = computed(() => getPreviewURL(props.node, { cropPreview: props
const isFile = computed(() => props.node.type === FileType.File)
const canLoadPreview = ref(false)
watch(previewURL, () => {
watchEffect(() => {
canLoadPreview.value = false
if (previewURL.value) {
const loader = document.createElement('img')
const loader = new Image()
loader.src = previewURL.value.href
loader.onerror = () => loader.remove()
loader.onload = () => { canLoadPreview.value = true; loader.remove() }
document.body.appendChild(loader)
}
}, { immediate: true })
})
</script>

<script lang="ts">
6 changes: 6 additions & 0 deletions lib/components/types.ts
Original file line number Diff line number Diff line change
@@ -46,6 +46,12 @@ export interface IDialogButton {
* @see https://nextcloud-vue-components.netlify.app/#/Components/NcButton
*/
type?: 'primary' | 'secondary' | 'error' | 'warning' | 'success'

/**
* Disabled state of the button
* @default false
*/
disabled?: boolean
}

/**
Loading