flameresttable 1.0.44 → 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/package.json
CHANGED
package/src/Table/FlameTable.ts
CHANGED
|
@@ -205,15 +205,16 @@ export default class FlameTable<T> {
|
|
|
205
205
|
/**
|
|
206
206
|
* Обновить результаты от RESTа
|
|
207
207
|
* @param CustomLoadParams Применить кастомные параметры загрузки
|
|
208
|
+
* @param exportFilename имя файла для экспорта, если указано, данные будут выгружены
|
|
208
209
|
*/
|
|
209
|
-
public async update(CustomLoadParams: ITableLoadParams = {},
|
|
210
|
+
public async update(CustomLoadParams: ITableLoadParams = {}, exportFilename: string | null = null) {
|
|
210
211
|
|
|
211
212
|
// Дополняем загрузочные параметры фильтрами
|
|
212
213
|
const filters = merge(this.applyFiltersParams(), CustomLoadParams);
|
|
213
214
|
|
|
214
215
|
const rows: Rows<T> = await (this.model as any).constructor.all(merge({}, this.opts.LoadParams, filters, { page: this.Pager.page, perPage: this.Pager.perPage }));
|
|
215
216
|
|
|
216
|
-
if (
|
|
217
|
+
if (exportFilename === null)
|
|
217
218
|
|
|
218
219
|
// Строки: загружаем
|
|
219
220
|
this.load(rows);
|
|
@@ -223,7 +224,7 @@ export default class FlameTable<T> {
|
|
|
223
224
|
const url = window.URL.createObjectURL((rows as any).data);
|
|
224
225
|
const a = document.createElement('a');
|
|
225
226
|
a.href = url;
|
|
226
|
-
a.download =
|
|
227
|
+
a.download = exportFilename;
|
|
227
228
|
document.body.appendChild(a);
|
|
228
229
|
a.click();
|
|
229
230
|
window.URL.revokeObjectURL(url);
|
|
@@ -415,7 +416,13 @@ export default class FlameTable<T> {
|
|
|
415
416
|
* @returns
|
|
416
417
|
*/
|
|
417
418
|
public getSelectedRows() {
|
|
418
|
-
|
|
419
|
+
const res = [];
|
|
420
|
+
for (const key in this.RowsParams) {
|
|
421
|
+
const el = this.RowsParams[key];
|
|
422
|
+
if (el.selected)
|
|
423
|
+
res.push(el.item)
|
|
424
|
+
}
|
|
425
|
+
return res;
|
|
419
426
|
}
|
|
420
427
|
|
|
421
428
|
/**
|
|
@@ -490,7 +497,7 @@ export default class FlameTable<T> {
|
|
|
490
497
|
}
|
|
491
498
|
|
|
492
499
|
// Делаем запрос на отдачу
|
|
493
|
-
this.update(customFilter,
|
|
500
|
+
this.update(customFilter, customFilter.export.filename ?? null);
|
|
494
501
|
|
|
495
502
|
}
|
|
496
503
|
|