flameresttable 1.0.84 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flameresttable",
3
- "version": "1.0.84",
3
+ "version": "1.0.86",
4
4
  "main": "./src/plugin.ts",
5
5
  "repository": {
6
6
  "type": "git",
@@ -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) {
@@ -40,12 +40,12 @@
40
40
  column.Table.title : column.title !== '' ? column.title :
41
41
  column.name }}</span>
42
42
  </div>
43
- <div v-if="opts.Edit.can" class="table-cell border-r border-r-slate-100 px-2">
43
+ <div v-if="opts.Edit.can" class="table-cell w-[93px] border-r border-r-slate-100 px-2">
44
44
  <button class="bg-green-600 invisible">
45
45
  Изменить
46
46
  </button>
47
47
  </div>
48
- <div v-if="opts.Remove.can" class="table-cell border-r border-r-slate-100 px-2">
48
+ <div v-if="opts.Remove.can" class="table-cell w-[93px] border-r border-r-slate-100 px-2">
49
49
  <button class="bg-green-600 invisible">
50
50
  Удалить
51
51
  </button>
@@ -77,12 +77,12 @@
77
77
  column.Table.value(row, column) }}</span>
78
78
  <span v-else v-html="column.Table.value(row, column)"></span>
79
79
  </div>
80
- <div v-if="opts.Edit.can" class="table-cell border-r border-r-slate-100 px-2 text-center">
80
+ <div v-if="opts.Edit.can" class="table-cell w-[93px] border-r border-r-slate-100 px-2 text-center">
81
81
  <button class="px-2 py-1 bg-green-600 text-white my-1" @click="edit(row)">
82
82
  Изменить
83
83
  </button>
84
84
  </div>
85
- <div v-if="opts.Remove.can" class="table-cell border-r border-r-slate-100 px-2 text-center">
85
+ <div v-if="opts.Remove.can" class="table-cell w-[93px] border-r border-r-slate-100 px-2 text-center">
86
86
  <button class="px-2 py-1 bg-gray-600 opacity-30 text-white my-1" @click="deleteRow(row)">
87
87
  Удалить
88
88
  </button>
@@ -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