|
@@ -23,10 +23,7 @@ import type {
|
|
|
CompanionClientProvider,
|
|
|
CompanionClientSearchProvider,
|
|
|
} from '@uppy/utils/lib/CompanionClientProvider'
|
|
|
-import type {
|
|
|
- FileProgressNotStarted,
|
|
|
- FileProgressStarted,
|
|
|
-} from '@uppy/utils/lib/FileProgress'
|
|
|
+import type { FileProgressStarted } from '@uppy/utils/lib/FileProgress'
|
|
|
import type {
|
|
|
Locale,
|
|
|
I18n,
|
|
@@ -259,7 +256,6 @@ export interface _UppyEventMap<M extends Meta, B extends Body> {
|
|
|
progress: NonNullable<FileProgressStarted['preprocess']>,
|
|
|
) => void
|
|
|
progress: (progress: number) => void
|
|
|
- 'reset-progress': () => void
|
|
|
restored: (pluginData: any) => void
|
|
|
'restore-confirmed': () => void
|
|
|
'restore-canceled': () => void
|
|
@@ -560,31 +556,6 @@ export class Uppy<M extends Meta, B extends Body> {
|
|
|
this.setState(undefined) // so that UI re-renders with new options
|
|
|
}
|
|
|
|
|
|
- resetProgress(): void {
|
|
|
- const defaultProgress: Omit<FileProgressNotStarted, 'bytesTotal'> = {
|
|
|
- percentage: 0,
|
|
|
- bytesUploaded: false,
|
|
|
- uploadComplete: false,
|
|
|
- uploadStarted: null,
|
|
|
- }
|
|
|
- const files = { ...this.getState().files }
|
|
|
- const updatedFiles: State<M, B>['files'] = {}
|
|
|
-
|
|
|
- Object.keys(files).forEach((fileID) => {
|
|
|
- updatedFiles[fileID] = {
|
|
|
- ...files[fileID],
|
|
|
- progress: {
|
|
|
- ...files[fileID].progress,
|
|
|
- ...defaultProgress,
|
|
|
- },
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- this.setState({ files: updatedFiles, ...defaultUploadState })
|
|
|
-
|
|
|
- this.emit('reset-progress')
|
|
|
- }
|
|
|
-
|
|
|
clear(): void {
|
|
|
this.setState({ ...defaultUploadState, files: {} })
|
|
|
}
|