Comparing version 4.19.2 to 4.20.0
# Changelog | ||
## 4.20.0 | ||
- Add `allowRemove`, set to `false` to disable remove button. | ||
- Improve TypeScript definitions. | ||
- Fix issue where `removeFiles` would not remove all files. | ||
## 4.19.2 | ||
@@ -4,0 +11,0 @@ |
{ | ||
"name": "filepond", | ||
"version": "4.19.2", | ||
"version": "4.20.0", | ||
"description": "FilePond, Where files go to stretch their bits.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
// Based on definitions by Zach Posten for React-Filepond <https://github.com/zposten> | ||
// Updated by FilePond Contributors | ||
/* Disable no-redundant-jsdoc since @default statements are NOT redundant */ | ||
/* tslint:disable:no-redundant-jsdoc */ | ||
export { }; | ||
@@ -81,4 +84,4 @@ | ||
/** | ||
* A custom FilePond File. Don't confuse this with the native `File` type. | ||
* | ||
* A custom FilePond File. Don't confuse this with the native `File` type. | ||
* | ||
* @deprecated use `FilePondFile` instead. This type will be removed in a future release. | ||
@@ -251,3 +254,3 @@ */ | ||
instantUpload?: boolean; | ||
/** | ||
/** | ||
* The maximum number of files that can be uploaded in parallel. | ||
@@ -274,6 +277,6 @@ * @default 2 | ||
} | null; | ||
/** | ||
* Enable chunk uploads | ||
* @default false | ||
* @default false | ||
*/ | ||
@@ -283,3 +286,3 @@ chunkUploads?: boolean; | ||
* Force use of chunk uploads even for files smaller than chunk size | ||
* @default false | ||
* @default false | ||
*/ | ||
@@ -306,3 +309,2 @@ chunkForce?: boolean; | ||
export interface FilePondDragDropProps { | ||
@@ -314,3 +316,3 @@ /** | ||
dropOnPage?: boolean; | ||
/** | ||
/** | ||
* Require drop on the FilePond element itself to catch the file. | ||
@@ -399,3 +401,3 @@ * @default true | ||
labelFileRemoved?: string; | ||
/** | ||
/** | ||
* Label used when something went during during removing the file upload. | ||
@@ -429,3 +431,3 @@ * @default 'Error during remove' | ||
*/ | ||
labelFileProcessingRevertError?: ((error: any) => string) | string; | ||
labelFileProcessingRevertError?: ((error: any) => string) | string; | ||
/** | ||
@@ -569,3 +571,3 @@ * Label used to indicate to the user that an action can be cancelled. | ||
* FilePond is about to allow this item to be dropped, it can be a URL or a File object. | ||
* | ||
* | ||
* Return `true` or `false` depending on if you want to allow the item to be dropped. | ||
@@ -575,4 +577,4 @@ */ | ||
/** | ||
* FilePond is about to add this file. | ||
* | ||
* FilePond is about to add this file. | ||
* | ||
* Return `false` to prevent adding it, or return a `Promise` and resolve with `true` or `false`. | ||
@@ -582,4 +584,4 @@ */ | ||
/** | ||
* FilePond is about to remove this file. | ||
* | ||
* FilePond is about to remove this file. | ||
* | ||
* Return `false` to prevent adding it, or return a `Promise` and resolve with `true` or `false`. | ||
@@ -591,3 +593,3 @@ */ | ||
export interface FilePondStyleProps { | ||
/** | ||
/** | ||
* Set a different layout render mode. | ||
@@ -599,3 +601,3 @@ * @default null | ||
* Set a forced aspect ratio for the FilePond drop area. | ||
* | ||
* | ||
* Accepts human readable aspect ratios like `1:1` or numeric aspect ratios like `0.75`. | ||
@@ -606,4 +608,4 @@ * @default null | ||
/** | ||
* Set a forced aspect ratio for the file items. | ||
* | ||
* Set a forced aspect ratio for the file items. | ||
* | ||
* Useful when rendering cropped or fixed aspect ratio images in grid view. | ||
@@ -613,3 +615,3 @@ * @default null | ||
styleItemPanelAspectRatio?: string | null; | ||
/** | ||
/** | ||
* The position of the remove item button. | ||
@@ -621,3 +623,3 @@ * @default 'left' | ||
* The position of the remove item button. | ||
* @default 'right' | ||
* @default 'right' | ||
*/ | ||
@@ -645,3 +647,3 @@ styleButtonProcessItemPosition?: string; | ||
export interface FilePondBaseProps { | ||
/** | ||
/** | ||
* The ID to add to the root element. | ||
@@ -656,3 +658,3 @@ * @default null | ||
name?: string; | ||
/** | ||
/** | ||
* Class Name to put on wrapper. | ||
@@ -662,3 +664,3 @@ * @default null | ||
className?: string | null; | ||
/** | ||
/** | ||
* Sets the required attribute to the output field. | ||
@@ -673,3 +675,3 @@ * @default false | ||
disabled?: boolean; | ||
/** | ||
/** | ||
* Sets the given value to the capture attribute. | ||
@@ -683,3 +685,3 @@ * @default null | ||
allowSyncAcceptAttribute?: boolean; | ||
/** | ||
/** | ||
* Enable or disable drag nā drop. | ||
@@ -689,3 +691,3 @@ * @default true | ||
allowDrop?: boolean; | ||
/** | ||
/** | ||
* Enable or disable file browser. | ||
@@ -701,3 +703,3 @@ * @default true | ||
allowPaste?: boolean; | ||
/** | ||
/** | ||
* Enable or disable adding multiple files. | ||
@@ -707,3 +709,3 @@ * @default false | ||
allowMultiple?: boolean; | ||
/** | ||
/** | ||
* Allow drop to replace a file, only works when allowMultiple is false. | ||
@@ -713,3 +715,3 @@ * @default true | ||
allowReplace?: boolean; | ||
/** | ||
/** | ||
* Allows the user to revert file upload. | ||
@@ -719,3 +721,3 @@ * @default true | ||
allowRevert?: boolean; | ||
/** | ||
/** | ||
* Allows user to process a file. When set to false, this removes the file upload button. | ||
@@ -725,7 +727,7 @@ * @default true | ||
allowProcess?: boolean; | ||
/** | ||
/** | ||
* Allows the user to reorder the file items | ||
* @default false | ||
*/ | ||
allowReorder?: boolean; | ||
allowReorder?: boolean; | ||
/** | ||
@@ -737,3 +739,3 @@ * Allow only selecting directories with browse (no support for filtering dnd at this point) | ||
/** | ||
/** | ||
* Require the file to be successfully reverted before continuing. | ||
@@ -744,3 +746,3 @@ * @default false | ||
/** | ||
/** | ||
* The maximum number of files that filepond pond can handle. | ||
@@ -750,3 +752,3 @@ * @default null | ||
maxFiles?: number | null; | ||
/** | ||
/** | ||
* Enables custom validity messages. | ||
@@ -771,3 +773,3 @@ * @default false | ||
*/ | ||
itemInsertInterval?: number; | ||
itemInsertInterval?: number; | ||
} | ||
@@ -829,2 +831,7 @@ | ||
export interface RemoveFileOptions { | ||
remove?: boolean; | ||
revert?: boolean; | ||
} | ||
export interface FilePond extends Required<FilePondOptions> {} | ||
@@ -844,31 +851,48 @@ | ||
/** Override multiple options at once. */ | ||
setOptions: (options: FilePondOptions) => void; | ||
/** | ||
setOptions(options: FilePondOptions): void; | ||
/** | ||
* Adds a file. | ||
* @param options.index The index that the file should be added at. | ||
*/ | ||
addFile: (source: ActualFileObject | Blob | string, options?: { index?: number } & Partial<FilePondInitialFile["options"]>) => Promise<FilePondFile>; | ||
/** | ||
addFile(source: ActualFileObject | Blob | string, options?: { index?: number } & Partial<FilePondInitialFile["options"]>): Promise<FilePondFile>; | ||
/** | ||
* Adds multiple files. | ||
* @param options.index The index that the files should be added at. | ||
*/ | ||
addFiles: (source: ActualFileObject[] | Blob[] | string[], options?: { index: number }) => Promise<FilePondFile[]>; | ||
/** | ||
* Moves a file. Select file with query and supply target index. | ||
addFiles(source: ActualFileObject[] | Blob[] | string[], options?: { index: number }): Promise<FilePondFile[]>; | ||
/** | ||
* Moves a file. Select file with query and supply target index. | ||
* @param query The file reference, id, or index. | ||
* @param index The index to move the file to. | ||
*/ | ||
moveFile: (query: FilePondFile | string | number, index: number) => void; | ||
/** | ||
* Removes a file. If no parameter is provided, removes the first file in the list. | ||
* @param query The file reference, id, or index. | ||
moveFile(query: FilePondFile | string | number, index: number): void; | ||
/** | ||
* Removes a file. | ||
* @param query The file reference, id, or index. If no query is provided, removes the first file in the list. | ||
* @param options Options for removal | ||
*/ | ||
removeFile: (query?: FilePondFile | string | number) => void; | ||
/** Removes all files. */ | ||
removeFiles: () => void; | ||
/** | ||
removeFile(query?: FilePondFile | string | number, options?: RemoveFileOptions): void; | ||
/** | ||
* Removes the first file in the list. | ||
* @param options Options for removal | ||
*/ | ||
removeFile(options: RemoveFileOptions): void; | ||
/** | ||
* Removes files matching the query. | ||
* @param query Array containing file references, ids, and/or indexes. If no array is provided, all files are removed | ||
* @param options Options for removal | ||
*/ | ||
removeFiles(query?: Array<FilePondFile | string | number>, options?: RemoveFileOptions): void; | ||
/** | ||
* Removes all files. | ||
* @param options Options for removal | ||
*/ | ||
removeFiles(options: RemoveFileOptions): void; | ||
/** | ||
* Processes a file. If no parameter is provided, processes the first file in the list. | ||
* @param query The file reference, id, or index | ||
*/ | ||
processFile: (query?: FilePondFile | string | number) => Promise<FilePondFile>; | ||
processFile(query?: FilePondFile | string | number): Promise<FilePondFile>; | ||
/** | ||
@@ -878,16 +902,28 @@ * Processes multiple files. If no parameter is provided, processes all files. | ||
*/ | ||
processFiles: (query?: FilePondFile[] | string[] | number[]) => Promise<FilePondFile[]>; | ||
/** | ||
processFiles(query?: FilePondFile[] | string[] | number[]): Promise<FilePondFile[]>; | ||
/** | ||
* Starts preparing the file matching the given query, returns a Promise, the Promise is resolved with the file item and the output file { file, output } | ||
* @param query The file reference, id, or index | ||
*/ | ||
prepareFile(query?: FilePondFile | string | number): Promise<{file: FilePondFile, output: any}>; | ||
/** | ||
* Processes multiple files. If no parameter is provided, processes all files. | ||
* @param query Array containing file reference(s), id(s), or index(es) | ||
*/ | ||
prepareFiles(query?: FilePondFile[] | string[] | number[]): Promise<Array<{file: FilePondFile, output: any}>>; | ||
/** | ||
* Returns a file. If no parameter is provided, returns the first file in the list. | ||
* @param query The file id, or index | ||
*/ | ||
getFile: (query?: string | number) => FilePondFile; | ||
getFile(query?: string | number): FilePondFile; | ||
/** Returns all files. */ | ||
getFiles: () => FilePondFile[]; | ||
getFiles(): FilePondFile[]; | ||
/** | ||
* Manually trigger the browse files panel. | ||
* | ||
* | ||
* Only works if the call originates from the user. | ||
*/ | ||
browse: () => void; | ||
browse(): void; | ||
/** | ||
@@ -897,20 +933,20 @@ * Sort the items in the files list. | ||
*/ | ||
sort: (compare: (a: FilePondFile, b: FilePondFile) => number) => void; | ||
sort(compare: (a: FilePondFile, b: FilePondFile) => number): void; | ||
/** Destroys this FilePond instance. */ | ||
destroy: () => void; | ||
destroy(): void; | ||
/** Inserts the FilePond instance after the supplied element. */ | ||
insertAfter: (element: Element) => void; | ||
insertAfter(element: Element): void; | ||
/** Inserts the FilePond instance before the supplied element. */ | ||
insertBefore: (element: Element) => void; | ||
insertBefore(element: Element): void; | ||
/** Appends FilePond to the given element. */ | ||
appendTo: (element: Element) => void; | ||
appendTo(element: Element): void; | ||
/** Returns true if the current instance is attached to the supplied element. */ | ||
isAttachedTo: (element: Element) => void; | ||
isAttachedTo(element: Element): void; | ||
/** Replaces the supplied element with FilePond. */ | ||
replaceElement: (element: Element) => void; | ||
replaceElement(element: Element): void; | ||
/** If FilePond replaced the original element, this restores the original element to its original glory. */ | ||
restoreElement: (element: Element) => void; | ||
restoreElement(element: Element): void; | ||
/** | ||
/** | ||
* Adds an event listener to the given event. | ||
@@ -920,4 +956,4 @@ * @param event Name of the event, prefixed with `Filepond:` | ||
*/ | ||
addEventListener: (event: FilePondEventPrefixed, fn: (e: any) => void) => void; | ||
/** | ||
addEventListener(event: FilePondEventPrefixed, fn: (e: any) => void): void; | ||
/** | ||
* Listen to an event. | ||
@@ -927,4 +963,4 @@ * @param event Name of the event | ||
*/ | ||
on: (event: FilePondEvent, fn: (...args: any[]) => void) => void; | ||
/** | ||
on(event: FilePondEvent, fn: (...args: any[]) => void): void; | ||
/** | ||
* Listen to an event once and remove the handler. | ||
@@ -934,4 +970,4 @@ * @param event Name of the event | ||
*/ | ||
onOnce: (event: FilePondEvent, fn: (...args: any[]) => void) => void; | ||
/** | ||
onOnce(event: FilePondEvent, fn: (...args: any[]) => void): void; | ||
/** | ||
* Stop listening to an event. | ||
@@ -941,3 +977,3 @@ * @param event Name of the event | ||
*/ | ||
off: (event: FilePondEvent, fn: (...args: any[]) => void) => void; | ||
off(event: FilePondEvent, fn: (...args: any[]) => void): void; | ||
} | ||
@@ -944,0 +980,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
949293
18
22155