flameresttable 1.0.67 → 1.0.69

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flameresttable",
3
- "version": "1.0.67",
3
+ "version": "1.0.69",
4
4
  "main": "./src/plugin.ts",
5
5
  "repository": {
6
6
  "type": "git",
@@ -220,15 +220,23 @@ export default class FlameTable<T> {
220
220
  this.load(rows);
221
221
 
222
222
  else {
223
+
223
224
  // Файл: скачиваем
224
- const url = window.URL.createObjectURL((rows as any).data);
225
- const a = document.createElement('a');
226
- a.href = url;
227
- a.download = exportFilename;
228
- document.body.appendChild(a);
229
- a.click();
230
- window.URL.revokeObjectURL(url);
231
- document.body.removeChild(a);
225
+ if (typeof this.opts.customDownloadHandler === 'function') {
226
+ // Кастомный загрузчик
227
+ this.opts.customDownloadHandler((rows as any).data)
228
+ }
229
+ else {
230
+ // Нативный загрузчик через браузер
231
+ const url = window.URL.createObjectURL((rows as any).data);
232
+ const a = document.createElement('a');
233
+ a.href = url;
234
+ a.download = exportFilename;
235
+ document.body.appendChild(a);
236
+ a.click();
237
+ window.URL.revokeObjectURL(url);
238
+ document.body.removeChild(a);
239
+ }
232
240
  }
233
241
 
234
242
  }
@@ -29,7 +29,7 @@ export default class TableOpts {
29
29
  /**
30
30
  * Открывать субслот в таблице при клике
31
31
  */
32
- public onRowClickOpenSlot: 'popup' | 'rowspace' | 'none' = 'none';
32
+ public onRowClickOpenSlot: 'popup' | 'rowspace' | 'none' = 'rowspace';
33
33
 
34
34
  /**
35
35
  * Клик по строке
@@ -43,6 +43,11 @@ export default class TableOpts {
43
43
  */
44
44
  public lang: 'ru' | 'en' = "ru";
45
45
 
46
+ /**
47
+ * Кастомный загрузчик файлов
48
+ */
49
+ public customDownloadHandler: null | ((data: string) => void) = null;
50
+
46
51
  /**
47
52
  * Добавить виртуальный столбец (не будет учтён в запросах, но будет передан на бек для кастомизации фильтров)
48
53
  * @param ColumnName