flameresttable 1.0.85 → 1.0.86
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
|
@@ -217,6 +217,10 @@ export default class FlameTable<T> {
|
|
|
217
217
|
// Дополняем загрузочные параметры фильтрами
|
|
218
218
|
const filters = merge(this.applyFiltersParams(), CustomLoadParams);
|
|
219
219
|
|
|
220
|
+
// Операции перед обновлением
|
|
221
|
+
const isNeedUpdate = this.opts.onBeforeUpdate(filters, exportFilename !== null);
|
|
222
|
+
if (!isNeedUpdate) return;
|
|
223
|
+
|
|
220
224
|
const rows: Rows<T> = await (this.model as any).constructor.all(merge({}, this.opts.LoadParams, filters, { page: this.Pager.page, perPage: this.Pager.perPage }));
|
|
221
225
|
|
|
222
226
|
if (exportFilename === null) {
|
package/src/Table/TableOpts.ts
CHANGED
|
@@ -48,6 +48,12 @@ export default class TableOpts {
|
|
|
48
48
|
*/
|
|
49
49
|
public customDownloadHandler: null | ((data: Blob, filename: string, mime: string) => void) = null;
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Функция, выполняемая перед обновлением данных и при возврате false - запрещающая обновление
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
55
|
+
public onBeforeUpdate: ((filters: object, isExport: boolean) => boolean) = () => true;
|
|
56
|
+
|
|
51
57
|
/**
|
|
52
58
|
* Добавить виртуальный столбец (не будет учтён в запросах, но будет передан на бек для кастомизации фильтров)
|
|
53
59
|
* @param ColumnName
|