Skip to content

Commit

Permalink
Define a new File type extended with custom objectURL property (#7145)
Browse files Browse the repository at this point in the history
  • Loading branch information
ewenjo authored Sep 9, 2024
1 parent 513af5e commit 6eb779c
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions components/lib/fileupload/fileupload.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,19 @@ export interface FileUploadPassThroughOptions {
hooks?: ComponentHooks;
}

/**
* Defines a custom File type extended with objectURL
*/
type FileUploadFile = File & { objectURL: string };

/**
* Defines current inline state in FileUpload component.
*/
export interface FileUploadState {
/**
* Current files.
*/
files: any[];
files: FileUploadFile[];
/**
* Current uplaoding state as a boolean.
* @defaultValue false
Expand All @@ -162,7 +167,7 @@ export interface FileUploadState {
/**
* Current uploaded files.
*/
uploadedFiles: any[];
uploadedFiles: FileUploadFile[];
}

/**
Expand Down Expand Up @@ -270,7 +275,7 @@ interface ItemTemplateOptions {
/**
* Array of files.
*/
files: File[];
files: FileUploadFile[];
/**
* Index of the file.
*/
Expand Down Expand Up @@ -317,7 +322,7 @@ interface FileUploadFilesEvent {
/**
* Uploaded files.
*/
files: File[];
files: FileUploadFile[];
}

/**
Expand Down Expand Up @@ -676,22 +681,22 @@ export declare class FileUpload extends React.Component<FileUploadProps, any> {
public getInput(): HTMLInputElement;
/**
* Gets the current files list.
* @return {File[]} Current files.
* @return {FileUploadFile[]} Current files.
*/
public getFiles(): File[];
public getFiles(): FileUploadFile[];
/**
* Sets the current files list.
* @param {File[]} files - Current files.
* @param {FileUploadFile[]} files - Current files.
*/
public setFiles(files: File[]): void;
public setFiles(files: FileUploadFile[]): void;
/**
* Gets the current uploaded files list.
* @return {File[]} Current uploaded files.
* @return {FileUploadFile[]} Current uploaded files.
*/
public getUploadedFiles(): File[];
public getUploadedFiles(): FileUploadFile[];
/**
* Sets the current uploaded files list.
* @param {File[]} files - Current uploaded files.
* @param {FileUploadFile[]} files - Current uploaded files.
*/
public setUploadedFiles(files: File[]): void;
public setUploadedFiles(files: FileUploadFile[]): void;
}

0 comments on commit 6eb779c

Please sign in to comment.