flamerest 1.0.44 → 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.
- package/REST.js +23 -18
- package/package.json +1 -1
package/REST.js
CHANGED
|
@@ -484,31 +484,36 @@ class FLAMEREST {
|
|
|
484
484
|
for (let val in values) {
|
|
485
485
|
|
|
486
486
|
// Преобразуем
|
|
487
|
-
|
|
488
|
-
|
|
487
|
+
let value = values[val];
|
|
488
|
+
let isRef = false;
|
|
489
|
+
if (value instanceof Object
|
|
490
|
+
&& value.hasOwnProperty('_value')
|
|
489
491
|
&& (
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
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
|
|
495
497
|
)
|
|
496
|
-
)
|
|
498
|
+
) {value = value.value; isRef = true}
|
|
497
499
|
|
|
498
|
-
if (
|
|
499
|
-
if (
|
|
500
|
-
if (
|
|
501
|
-
if (
|
|
502
|
-
if (
|
|
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) {
|
|
503
505
|
let newValues = [];
|
|
504
|
-
|
|
505
|
-
for (let file in
|
|
506
|
+
value = Array.from(value);
|
|
507
|
+
for (let file in value) {
|
|
506
508
|
newValues.push({
|
|
507
|
-
'name':
|
|
508
|
-
'data': await this.readFileAsync(
|
|
509
|
+
'name': value[file].name,
|
|
510
|
+
'data': await this.readFileAsync(value[file])
|
|
509
511
|
});
|
|
510
512
|
}
|
|
511
|
-
|
|
513
|
+
if (isRef)
|
|
514
|
+
values[val].value = newValues;
|
|
515
|
+
else
|
|
516
|
+
values[val] = newValues;
|
|
512
517
|
}
|
|
513
518
|
}
|
|
514
519
|
|