Skip to content

Releases: lionng429/react-file-uploader

v1.0.0

29 Mar 01:01
Compare
Choose a tag to compare

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

v0.4.1

27 Mar 13:27
4c7cbf2
Compare
Choose a tag to compare

Changelog

Receiver

  • moved wrapper element existence check from constructor to componentDidMount to fix issue #17

v0.4.0

26 Mar 00:20
825e1dc
Compare
Choose a tag to compare

Changelog

Dependencies

  • updated React peer dependency to ^15.0.0 || ^16.0.0
  • added back react into dependencies
  • moved prop-types from devDependencies to dependencies

Features

Receiver.js

  • added file type checking in onDragEnter

UploadManager.js

  • added reqConfigs as a prop which accepts accept, method, timeout and withCredentials properties
  • added formDataParser as a prop which allows custom fields to be sent through in the request (#5)
  • these changes refer to #9, thanks for the contribution from @digital-flowers

Bug Fixes

  • fixed missing DragEvent on Safari (#7)
  • fixed unnecessary key props in UploadHandler (#8)
  • refactored basic example

ESLint

  • removed airbnb and related dependencies
  • fixed eslint errors

0.3.7

23 Mar 04:52
Compare
Choose a tag to compare
  • added prepublish script in package.json
  • replaced React.PropTypes with prop-types
  • fixed missing react dependency

0.3.1

23 Aug 15:59
Compare
Choose a tag to compare

Changes

General:

0.3.0

10 Jun 15:36
Compare
Choose a tag to compare

v0.3.0

Changes

General:

  • added eslint and fix all eslint warnings and errors
  • added test cases with jest (incomplete)
  • added debug messages with prefx react-file-uploader: with debug
  • removed invalid use of peerDependencies
  • updated basic example to adpoted changes in v0.3.0
  • updated ReadMe

Receiver:

  • will throw invariant error if browser does not support DragEvent or DataTransfer
  • onFileDrop will apply e rather than e.target at the first argument

UploadManager:

  • accepts component props in string to customize wrapper element
  • accepts uploadErrorHandler props function to customize the error & result for superagent.end method
  • accepts uploadHeader props which will be set as superagent request header
  • uses lodash.assign instead of lodash.merge for better performance

UploadHandler:

  • accepts component props in string to customize wrapper element
  • no longer provides default template if no children is provided