🏷️ FileUpload component interface file updated
This commit is contained in:
parent
bf13fec2eb
commit
abae860b58
|
@ -1,7 +1,9 @@
|
|||
import type { HintedString } from '@primevue/core';
|
||||
|
||||
/**
|
||||
* Interface representing the properties of a FileUpload component.
|
||||
*/
|
||||
export default interface IFile {
|
||||
export interface IFile {
|
||||
/**
|
||||
* Optional unique identifier for the file input.
|
||||
*/
|
||||
|
@ -44,3 +46,153 @@ export default interface IFile {
|
|||
*/
|
||||
modelValue?: string;
|
||||
}
|
||||
|
||||
export interface FileUploadProps {
|
||||
/**
|
||||
* Name of the request parameter to identify the files at backend.
|
||||
*/
|
||||
name?: string | undefined;
|
||||
/**
|
||||
* Remote url to upload the files.
|
||||
*/
|
||||
url?: string | undefined;
|
||||
/**
|
||||
* Defines the UI of the component, possible values are 'advanced' and 'basic'.
|
||||
* @defaultValue advanced
|
||||
*/
|
||||
mode?: HintedString<'advanced' | 'basic'> | undefined;
|
||||
/**
|
||||
* Used to select multiple files at once from file dialog.
|
||||
* @defaultValue false
|
||||
*/
|
||||
multiple?: boolean | undefined;
|
||||
/**
|
||||
* Pattern to restrict the allowed file types such as 'image/*'.
|
||||
*/
|
||||
accept?: string | undefined;
|
||||
/**
|
||||
* Disables the upload functionality.
|
||||
* @defaultValue false
|
||||
*/
|
||||
disabled?: boolean | undefined;
|
||||
/**
|
||||
* When enabled, upload begins automatically after selection is completed.
|
||||
* @defaultValue false
|
||||
*/
|
||||
auto?: boolean | undefined;
|
||||
/**
|
||||
* Maximum file size allowed in bytes.
|
||||
*/
|
||||
maxFileSize?: number | undefined;
|
||||
/**
|
||||
* Message of the invalid fize size.
|
||||
* @defaultValue {0}: Invalid file size, file size should be smaller than {1.}
|
||||
*/
|
||||
invalidFileSizeMessage?: string | undefined;
|
||||
/**
|
||||
* Message to display when number of files to be uploaded exceeeds the limit.
|
||||
* @defaultValue Maximum number of files to be uploaded is {0.}
|
||||
*/
|
||||
invalidFileLimitMessage?: string | undefined;
|
||||
/**
|
||||
* Message of the invalid fize type.
|
||||
* @defaultValue '{0}: Invalid file type.'
|
||||
*/
|
||||
invalidFileTypeMessage?: string | undefined;
|
||||
/**
|
||||
* Maximum number of files that can be uploaded.
|
||||
*/
|
||||
fileLimit?: number | undefined;
|
||||
/**
|
||||
* Cross-site Access-Control requests should be made using credentials such as cookies, authorization headers or TLS client certificates.
|
||||
* @defaultValue false
|
||||
*/
|
||||
withCredentials?: boolean | undefined;
|
||||
/**
|
||||
* Width of the image thumbnail in pixels.
|
||||
* @defaultValue 50
|
||||
*/
|
||||
previewWidth?: number | undefined;
|
||||
/**
|
||||
* Label of the choose button. Defaults to PrimeVue Locale configuration.
|
||||
*/
|
||||
chooseLabel?: string | undefined;
|
||||
/**
|
||||
* Label of the upload button. Defaults to PrimeVue Locale configuration.
|
||||
*/
|
||||
uploadLabel?: string | undefined;
|
||||
/**
|
||||
* Label of the cancel button. Defaults to PrimeVue Locale configuration.
|
||||
* @defaultValue Cancel
|
||||
*/
|
||||
cancelLabel?: string | undefined;
|
||||
/**
|
||||
* Whether to use the default upload or a manual implementation defined in uploadHandler callback. Defaults to PrimeVue Locale configuration.
|
||||
*/
|
||||
customUpload?: boolean | undefined;
|
||||
/**
|
||||
* Whether to show the upload button.
|
||||
* @defaultValue true
|
||||
*/
|
||||
showUploadButton?: boolean | undefined;
|
||||
/**
|
||||
* Whether to show the cancel button.
|
||||
* @defaultValue true
|
||||
*/
|
||||
showCancelButton?: boolean | undefined;
|
||||
/**
|
||||
* Icon of the choose button.
|
||||
*/
|
||||
chooseIcon?: string | undefined;
|
||||
/**
|
||||
* Icon of the upload button.
|
||||
*/
|
||||
uploadIcon?: string | undefined;
|
||||
/**
|
||||
* Icon of the cancel button.
|
||||
*/
|
||||
cancelIcon?: string | undefined;
|
||||
/**
|
||||
* Inline style of the component.
|
||||
*/
|
||||
style?: unknown;
|
||||
/**
|
||||
* Style class of the component.
|
||||
*/
|
||||
class?: unknown;
|
||||
/**
|
||||
* Used to pass all properties of the ButtonProps to the choose button inside the component.
|
||||
* @type {ButtonProps}
|
||||
* @defaultValue null
|
||||
*/
|
||||
chooseButtonProps?: object | undefined;
|
||||
/**
|
||||
* Used to pass all properties of the ButtonProps to the upload button inside the component.
|
||||
* @type {ButtonProps}
|
||||
* @defaultValue { severity: 'secondary' }
|
||||
*/
|
||||
uploadButtonProps?: object | undefined;
|
||||
/**
|
||||
* Used to pass all properties of the ButtonProps to the cancel button inside the component.
|
||||
* @type {ButtonProps}
|
||||
* @defaultValue { severity: 'secondary' }
|
||||
*/
|
||||
cancelButtonProps?: object | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extended interface for a customizable FileUpload component.
|
||||
*
|
||||
* Combines selected properties from IFile and FileUploadProps,
|
||||
* while omitting and overriding specific ones for more control.
|
||||
*/
|
||||
export default interface IVFileUpload extends
|
||||
Partial<Omit<IFile, 'accept' | 'error'>>,
|
||||
Partial<Omit<FileUploadProps, 'auto' | 'mode' | 'multiple'>> {
|
||||
|
||||
/**
|
||||
* If true, enables the advanced mode of the file upload component,
|
||||
* which may include features like drag-and-drop, file previews, etc.
|
||||
*/
|
||||
advanced?: boolean;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user