@steroidsjs/core 2.2.3 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/hoc/file.d.ts CHANGED
@@ -12,6 +12,10 @@ export interface IFileHocInput {
12
12
  imagesProcessor?: any;
13
13
  imagesExactSize?: any;
14
14
  initialFiles?: any;
15
+ uploaderConfig?: {
16
+ useFormData?: boolean;
17
+ fileFieldName?: string;
18
+ };
15
19
  }
16
20
  export interface IFileHocOutput {
17
21
  uploader?: any;
package/hooks/useFile.js CHANGED
@@ -39,7 +39,7 @@ function generateBackendUrl(props) {
39
39
  });
40
40
  }
41
41
  function useFile(props) {
42
- var uploader = useInitial_1["default"](function () { return new fileup_core_1["default"](__assign(__assign({ dropArea: {}, backendUrl: generateBackendUrl(props) }, props.uploader), { form: __assign(__assign({}, (props.uploader && props.uploader.form)), { multiple: props.multiple }) })); });
42
+ var uploader = useInitial_1["default"](function () { return new fileup_core_1["default"](__assign(__assign({ dropArea: {}, backendUrl: generateBackendUrl(props), uploaderConfig: __assign({}, props.uploaderConfig) }, props.uploader), { form: __assign(__assign({}, (props.uploader && props.uploader.form)), { multiple: props.multiple }) })); });
43
43
  /**
44
44
  * Force component update when file status or progress changes
45
45
  * @private
@@ -156,7 +156,7 @@ function useFile(props) {
156
156
  var prevInputValue = react_use_1.usePrevious(props.input.value);
157
157
  //todo refactoring
158
158
  react_1.useEffect(function () {
159
- if (!isEqual_1["default"](prevInputValue !== props.input.value)) {
159
+ if (prevInputValue && !isEqual_1["default"](prevInputValue !== props.input.value)) {
160
160
  var toRemove_1 = difference_1["default"]([].concat(props.input.value || []), [].concat(prevInputValue || []));
161
161
  if (toRemove_1.length > 0) {
162
162
  uploader.queue.remove(uploader.queue.getFiles().filter(function (file) { return (toRemove_1.indexOf(get_1["default"](file.getResultHttpMessage(), 'id')) !== -1); }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/core",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "",
5
5
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
6
6
  "repository": {