Skip to content

v1.0.0

Latest
Compare
Choose a tag to compare
@lionng429 lionng429 released this 29 Mar 01:01

Proposed Version: v1.0.0

Receiver

  • [BREAKING] prevented mutating the file data object e.dataTransfer.files, and creates upload object instead. File Object is now assigned and preserved with property of "data" inside the upload object.
second argument in this.props.onFileDrop:

// v0.3.x
files = [
  {
    id: string,
    status: number,
    prgroess: number,
    src: string,
    lastModified: number,
    lastModifiedDate: string,
    name: string,
    size: number,
    type: string,
    webkitRelativePath: string,
  },
  ...
];

// v1.0.0
uploads = [
  {
    id: string,
    status: number,
    prgroess: number,
    src: string,
    // File Object moved into data property
    data: {
      lastModified: number,
      lastModifiedDate: string,
      name: string,
      size: number,
      type: string,
      webkitRelativePath: string,
    },
  },
  ...
];

UploadHandler

  • checks for the existence of props.upload and props.file in componentDidMount
  • removed unused getStatusString function
  • allows render function as children to provide abort and upload function

UploadManager

  • [BREAKING] baked-in with debounced on progress callback, accepts props.progressDebounce for configuration
  • [BREAKING] prevented mutating the file data object in onUploadProgress and onUploadEnd
  • [BREAKING] for onUploadAbort, onUploadStart, onUploadProgress and onUploadEnd, the first argument now becomes just the file (upload task) id but not the file object. It minimizes the chance of File object mutation from the callback.
  • [BREAKING] props.formDataParser is DEPRECATED and replaced by props.uploadDataHandler
  • [BREAKING] props.uploadHeader is DEPRECATED and replaced by props.uploadHeaderHandler
  • supports abort function to an upload task and accepts props.onUploadAbort callback
// v0.3.x
this.props.onUploadStart = (file, { progress, status }) => { ... };
// v1.0.0
this.props.onUploadStart = (fileId, { progress, status }) => { ... };

General

  • added more unit test coverage, some are still missing in UploadManager
  • updated basic example to cope with the breaking changes