flamerest 1.0.42 → 1.0.45

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.
Files changed (2) hide show
  1. package/REST.js +27 -10
  2. package/package.json +1 -1
package/REST.js CHANGED
@@ -482,21 +482,38 @@ class FLAMEREST {
482
482
 
483
483
  // Если в один из параметров передан FileList или input[type=file], т.е. нужно загрузить файлы
484
484
  for (let val in values) {
485
+
485
486
  // Преобразуем
486
- if (values[val] instanceof Event && values[val].target instanceof HTMLInputElement) values[val] = values[val].target;
487
- if (values[val] instanceof HTMLInputElement && values[val].type === 'file') values[val] = values[val].files;
488
- if (values[val] instanceof ClipboardEvent) values[val] = values[val].clipboardData.files;
489
- if (values[val] instanceof DataTransfer) values[val] = values[val].files;
490
- if (values[val] instanceof FileList) {
487
+ let value = values[val];
488
+ let isRef = false;
489
+ if (value instanceof Object
490
+ && value.hasOwnProperty('_value')
491
+ && (
492
+ value._value instanceof Event ||
493
+ value._value instanceof HTMLInputElement ||
494
+ value._value instanceof ClipboardEvent ||
495
+ value._value instanceof DataTransfer ||
496
+ value._value instanceof FileList
497
+ )
498
+ ) {value = value.value; isRef = true}
499
+
500
+ if (value instanceof Event && value.target instanceof HTMLInputElement && value.target.type === 'file') value = value.target.files;
501
+ if (value instanceof HTMLInputElement && value.type === 'file') value = value.files;
502
+ if (value instanceof ClipboardEvent) value = value.clipboardData.files;
503
+ if (value instanceof DataTransfer) value = value.files;
504
+ if (value instanceof FileList) {
491
505
  let newValues = [];
492
- values[val] = Array.from(values[val]);
493
- for (let file in values[val]) {
506
+ value = Array.from(value);
507
+ for (let file in value) {
494
508
  newValues.push({
495
- 'name': values[val][file].name,
496
- 'data': await this.readFileAsync(values[val][file])
509
+ 'name': value[file].name,
510
+ 'data': await this.readFileAsync(value[file])
497
511
  });
498
512
  }
499
- values[val] = newValues;
513
+ if (isRef)
514
+ values[val].value = newValues;
515
+ else
516
+ values[val] = newValues;
500
517
  }
501
518
  }
502
519
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flamerest",
3
- "version": "1.0.42",
3
+ "version": "1.0.45",
4
4
  "description": "",
5
5
  "main": "REST.js",
6
6
  "typings": "./REST.d.ts",