flameresttable 1.0.45 → 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 +1 -1
- package/src/Table/FlameTable.ts +5 -4
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);
|
|
@@ -496,7 +497,7 @@ export default class FlameTable<T> {
|
|
|
496
497
|
}
|
|
497
498
|
|
|
498
499
|
// Делаем запрос на отдачу
|
|
499
|
-
this.update(customFilter,
|
|
500
|
+
this.update(customFilter, customFilter.export.filename ?? null);
|
|
500
501
|
|
|
501
502
|
}
|
|
502
503
|
|