зеркало из https://github.com/nextcloud/forms.git
fix: make FilePicker work with latest dialogs (#2300)
* fix file picker Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de> * Update .prettierignore Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de> Signed-off-by: Chartman123 <chris-hartmann@gmx.de> --------- Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de> Signed-off-by: Chartman123 <chris-hartmann@gmx.de> Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
Родитель
004b5d2fb2
Коммит
9aa2a89929
|
@ -3,6 +3,9 @@
|
|||
**/.svn
|
||||
**/.hg
|
||||
|
||||
# Github workflows
|
||||
.github/workflows/
|
||||
|
||||
# 3rdparty dependencies
|
||||
**/node_modules
|
||||
**/vendor
|
||||
|
|
|
@ -736,13 +736,40 @@ export default {
|
|||
t('forms', 'Choose spreadsheet location'),
|
||||
)
|
||||
.setMultiSelect(false)
|
||||
.allowDirectories()
|
||||
.allowDirectories(true)
|
||||
.setButtonFactory((selectedNodes, currentPath, currentView) => {
|
||||
if (selectedNodes.length === 1) {
|
||||
const extension = selectedNodes[0].extension
|
||||
.slice(1)
|
||||
.toLowerCase()
|
||||
if (SUPPORTED_FILE_FORMATS[extension]) {
|
||||
?.slice(1)
|
||||
?.toLowerCase()
|
||||
if (!extension) {
|
||||
return [
|
||||
{
|
||||
label: t('forms', 'Create XLSX'),
|
||||
icon: IconFileExcelSvg,
|
||||
callback() {
|
||||
fileFormat = 'xlsx'
|
||||
},
|
||||
type: 'secondary',
|
||||
},
|
||||
{
|
||||
label: t('forms', 'Create CSV'),
|
||||
icon: IconFileDelimitedSvg,
|
||||
callback() {
|
||||
fileFormat = 'csv'
|
||||
},
|
||||
type: 'secondary',
|
||||
},
|
||||
{
|
||||
label: t('forms', 'Create ODS'),
|
||||
icon: IconTableSvg,
|
||||
callback() {
|
||||
fileFormat = 'ods'
|
||||
},
|
||||
type: 'primary',
|
||||
},
|
||||
]
|
||||
} else if (SUPPORTED_FILE_FORMATS[extension]) {
|
||||
return [
|
||||
{
|
||||
label: t('forms', 'Select {file}', {
|
||||
|
@ -756,36 +783,9 @@ export default {
|
|||
},
|
||||
]
|
||||
}
|
||||
|
||||
return []
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
label: t('forms', 'Create XLSX'),
|
||||
icon: IconFileExcelSvg,
|
||||
callback() {
|
||||
fileFormat = 'xlsx'
|
||||
},
|
||||
type: 'secondary',
|
||||
},
|
||||
{
|
||||
label: t('forms', 'Create CSV'),
|
||||
icon: IconFileDelimitedSvg,
|
||||
callback() {
|
||||
fileFormat = 'csv'
|
||||
},
|
||||
type: 'secondary',
|
||||
},
|
||||
{
|
||||
label: t('forms', 'Create ODS'),
|
||||
icon: IconTableSvg,
|
||||
callback() {
|
||||
fileFormat = 'ods'
|
||||
},
|
||||
type: 'primary',
|
||||
},
|
||||
]
|
||||
return []
|
||||
})
|
||||
.build()
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче