flamerest 1.0.43 → 1.0.46
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.d.ts +1 -1
- package/REST.js +27 -10
- package/package.json +1 -1
package/REST.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export function get<T>(table: string, where?: object | string | null, expand?: o
|
|
|
29
29
|
* @param {object} params
|
|
30
30
|
* @returns
|
|
31
31
|
*/
|
|
32
|
-
export function all<T>(table: string, params?: { where?: object, fields?: object | Array<string>, sort?: Array<string>, page?: number, perPage?: number }): Promise<Rows<T>>;
|
|
32
|
+
export function all<T>(table: string, params?: { where?: object, fields?: object | Array<string>, sort?: Array<string>, page?: number, perPage?: number, tree?: number }): Promise<Rows<T>>;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Стандартный ответ от Request с несколькими строками
|
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
|
-
|
|
487
|
-
|
|
488
|
-
if (
|
|
489
|
-
|
|
490
|
-
|
|
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
|
-
|
|
493
|
-
for (let file in
|
|
506
|
+
value = Array.from(value);
|
|
507
|
+
for (let file in value) {
|
|
494
508
|
newValues.push({
|
|
495
|
-
'name':
|
|
496
|
-
'data': await this.readFileAsync(
|
|
509
|
+
'name': value[file].name,
|
|
510
|
+
'data': await this.readFileAsync(value[file])
|
|
497
511
|
});
|
|
498
512
|
}
|
|
499
|
-
|
|
513
|
+
if (isRef)
|
|
514
|
+
values[val].value = newValues;
|
|
515
|
+
else
|
|
516
|
+
values[val] = newValues;
|
|
500
517
|
}
|
|
501
518
|
}
|
|
502
519
|
|