From e879d1d2c81a471979deaeb4a45f79d50826cde1 Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Mon, 25 Mar 2024 09:34:29 +0300 Subject: [PATCH] Refactor #5426 - For FileUpload --- components/lib/fileupload/FileContent.vue | 10 ++-- components/lib/fileupload/FileUpload.d.ts | 20 ++----- components/lib/fileupload/FileUpload.vue | 54 ++++++++++--------- .../lib/fileupload/style/FileUploadStyle.js | 3 +- .../themes/primeone/base/fileupload/index.js | 2 +- 5 files changed, 40 insertions(+), 49 deletions(-) diff --git a/components/lib/fileupload/FileContent.vue b/components/lib/fileupload/FileContent.vue index 1f086ac9e..cf7f27779 100644 --- a/components/lib/fileupload/FileContent.vue +++ b/components/lib/fileupload/FileContent.vue @@ -4,15 +4,15 @@
{{ file.name }}
{{ formatSize(file.size) }} - +
- +
@@ -67,8 +67,8 @@ export default { } }, components: { - FileUploadButton: Button, - FileUploadBadge: Badge, + Button, + Badge, TimesIcon } }; diff --git a/components/lib/fileupload/FileUpload.d.ts b/components/lib/fileupload/FileUpload.d.ts index a449d79d0..221569b44 100755 --- a/components/lib/fileupload/FileUpload.d.ts +++ b/components/lib/fileupload/FileUpload.d.ts @@ -208,16 +208,9 @@ export interface FileUploadPassThroughOptions { buttonbar?: FileUploadPassThroughOptionType; /** * Used to pass attributes to the choose button's DOM element. + * @see {@link ButtonPassThroughOptions} */ - chooseButton?: FileUploadPassThroughOptionType; - /** - * Used to pass attributes to the choose icon's DOM element. - */ - chooseIcon?: FileUploadPassThroughOptionType; - /** - * Used to pass attributes to the choose button label's DOM element. - */ - chooseButtonLabel?: FileUploadPassThroughOptionType; + chooseButton?: ButtonPassThroughOptions; /** * Used to pass attributes to the upload button's DOM element. * @see {@link ButtonPassThroughOptions} @@ -280,13 +273,10 @@ export interface FileUploadPassThroughOptions { */ empty?: FileUploadPassThroughOptionType; /** - * Used to pass attributes to the label's DOM element. + * Used to pass attributes to the basic mode's button's DOM element. + * @see {@link ButtonPassThroughOptions} */ - label?: FileUploadPassThroughOptionType; - /** - * Used to pass attributes to the upload icon's DOM element. - */ - uploadIcon?: FileUploadPassThroughOptionType; + button?: ButtonPassThroughOptions; /** * Used to manage all lifecycle hooks. * @see {@link BaseComponent.ComponentHooks} diff --git a/components/lib/fileupload/FileUpload.vue b/components/lib/fileupload/FileUpload.vue index b41489311..a4e87163f 100755 --- a/components/lib/fileupload/FileUpload.vue +++ b/components/lib/fileupload/FileUpload.vue @@ -3,33 +3,34 @@
- - - - {{ chooseButtonLabel }} - - + + +
@@ -40,17 +41,18 @@
- {{ msg }} - - - - - - {{ basicChooseButtonLabel }} - - + {{ msg }} + +
@@ -403,9 +405,9 @@ export default { } }, components: { - FileUploadButton: Button, - FileUploadProgressBar: ProgressBar, - FileUploadMessage: Message, + Button, + ProgressBar, + Message, FileContent, PlusIcon, UploadIcon, diff --git a/components/lib/fileupload/style/FileUploadStyle.js b/components/lib/fileupload/style/FileUploadStyle.js index 2b0805006..25c62d87c 100644 --- a/components/lib/fileupload/style/FileUploadStyle.js +++ b/components/lib/fileupload/style/FileUploadStyle.js @@ -4,10 +4,9 @@ const classes = { root: ({ props }) => [`p-fileupload p-fileupload-${props.mode} p-component`], buttonbar: 'p-fileupload-buttonbar', chooseButton: ({ instance, props }) => [ - 'p-component p-fileupload-choose', + 'p-fileupload-choose', { 'p-fileupload-choose-selected': props.mode === 'basic' && instance.hasFiles, - 'p-disabled': props.disabled, 'p-focus': instance.focused } ], diff --git a/components/lib/themes/primeone/base/fileupload/index.js b/components/lib/themes/primeone/base/fileupload/index.js index 111e10035..69ab38ef9 100644 --- a/components/lib/themes/primeone/base/fileupload/index.js +++ b/components/lib/themes/primeone/base/fileupload/index.js @@ -5,7 +5,7 @@ export default { overflow: hidden; } -.p-fileupload-choose input[type="file"] { +.p-fileupload input[type="file"] { display: none; }