From 78810e9653895da293ed210a7249283931aae501 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 6 Mar 2024 14:25:48 -0700 Subject: [PATCH] VfsSelectDialog bugfixes: - Fix passing mimeList via loadWebComponent() did not preserve objects but stringified them - Fix initial search fired before attributes got set when loaded via loadWebComponent() - Fix show() did not always wait for dialog --- api/js/etemplate/Et2Vfs/Et2VfsSelectDialog.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/api/js/etemplate/Et2Vfs/Et2VfsSelectDialog.ts b/api/js/etemplate/Et2Vfs/Et2VfsSelectDialog.ts index 2a61203d5d..fe2d672753 100644 --- a/api/js/etemplate/Et2Vfs/Et2VfsSelectDialog.ts +++ b/api/js/etemplate/Et2Vfs/Et2VfsSelectDialog.ts @@ -100,7 +100,7 @@ export class Et2VfsSelectDialog @property() mime : string | string[] | RegExp = ""; /** List of mimetypes to allow user to filter. */ - @property() mimeList : SelectOption[] = [ + @property({type: Array}) mimeList : SelectOption[] = [ { value: "/(application\\/vnd.oasis.opendocument.text|application\\/vnd.openxmlformats-officedocument.wordprocessingml.document)/i", label: "Documents" @@ -209,8 +209,6 @@ export class Et2VfsSelectDialog { this.path = this.egw()?.preference("startfolder", "filemanager") || "~"; } - // Get file list - this.startSearch(); } async getUpdateComplete() @@ -230,6 +228,8 @@ export class Et2VfsSelectDialog this._dialog.panel.style.width = "60em"; this._dialog.panel.style.height = "40em"; }); + // Get file list + this.startSearch(); } protected willUpdate(changedProperties : PropertyValues) @@ -297,9 +297,11 @@ export class Et2VfsSelectDialog } return Promise.all([ this.updateComplete, - this._searchPromise, - this._dialog.show() + this._searchPromise ]).then(() => + { + return this._dialog.show(); + }).then(() => { // Set current file to first value if(this.value && this.value[0]) @@ -320,6 +322,7 @@ export class Et2VfsSelectDialog async getComplete() : Promise<[number, Object]> { + await this.updateComplete; const value = await this._dialog.getComplete(); await this.handleClose(); value[1] = this.value;