flameresttable 1.0.99 → 1.0.101

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.99",
3
+ "version": "1.0.101",
4
4
  "main": "./src/plugin.ts",
5
5
  "repository": {
6
6
  "type": "git",
@@ -184,6 +184,9 @@ export class Column implements IColumn {
184
184
  // Тут привязка к реальным данным
185
185
  model: "",
186
186
 
187
+ // Тут модель для файлов
188
+ fileModel: null as any,
189
+
187
190
  // Заголовок поля в попапе
188
191
  title: "",
189
192
 
@@ -419,6 +422,9 @@ export interface IColumn {
419
422
  // Тут привязка к реальным данным
420
423
  model?: any,
421
424
 
425
+ // Тут модель для файлов
426
+ fileModel?: any,
427
+
422
428
  // Заголовок поля в попапе
423
429
  title?: string,
424
430
 
@@ -401,7 +401,8 @@ export default class FlameTable<T> {
401
401
  // TODO: убрать пустой массив т.к. при добавлении он не нужен или прикрепить реактивную модель?
402
402
  if (await this.opts.Popup.beforeAdd({}, this) === false) { return null; }
403
403
 
404
- const res: SavedObject<T> = await Object.getPrototypeOf(this.model).constructor.create(this.getColumnsForUpdate('add'));
404
+ const cols = await (window as any).REST.prepare(this.getColumnsForUpdate('add'), true);
405
+ const res: SavedObject<T> = await Object.getPrototypeOf(this.model).constructor.create(cols);
405
406
 
406
407
  if (!res.ok || !res.data) {
407
408
  throw res;
@@ -422,8 +423,11 @@ export default class FlameTable<T> {
422
423
  // Сперва предобработка
423
424
  if (await this.opts.Popup.beforeEdit(columns, this) === false) { return null; }
424
425
 
426
+ // Подготовка к загрузке
427
+ const preparedCols = await (window as any).REST.prepare(columns, true);
428
+
425
429
  // Сохраняем
426
- const res: SavedObject<T> = await tClass.edit(columns[indexKey], columns);
430
+ const res: SavedObject<T> = await tClass.edit(columns[indexKey], preparedCols);
427
431
 
428
432
  if (!res.ok) {
429
433
  throw res;
@@ -461,7 +465,12 @@ export default class FlameTable<T> {
461
465
  if (mode === 'add' && !this.columns[key].Popup.isSendFromAdd) continue;
462
466
  if (mode === 'edit' && !this.columns[key].Popup.isSendFromEdit) continue;
463
467
  // TODO: здесь может быть полезно сохранять пустую строку
464
- if (this.columns[key].Popup.model !== '') { res[key] = this.columns[key].Popup.model }
468
+ if (this.columns[key].Popup.model !== '') {
469
+ if (this.columns[key].Popup.fileModel !== null)
470
+ res[key] = this.columns[key].Popup.fileModel
471
+ else
472
+ res[key] = this.columns[key].Popup.model
473
+ }
465
474
  }
466
475
  return res;
467
476
  }
@@ -327,6 +327,7 @@ export default defineComponent({
327
327
  Table.columns[column].Popup.model = ev;
328
328
  const prepared = (await REST.prepare({ myParam: ev })).myParam;
329
329
  Table.columns[column].Popup.model = prepared
330
+ Table.columns[column].Popup.fileModel = { myParam: ev }
330
331
  }
331
332
 
332
333
  /*
@@ -11,14 +11,14 @@
11
11
  <!-- ТЕКСТ -->
12
12
  <div class="mobile:w-full"
13
13
  v-if="col.Filter.type === 'text' || col.Filter.type === 'fixed' || col.Filter.type === 'fulltext'">
14
- <input class="mobile:w-full outline-none border border-slate-500 px-2 py-1" :placeholder="col.title ?? col.name"
15
- type="text" @keyup="update()" v-model="col.Filter.valueString" />
14
+ <input class="mobile:w-full outline-none border border-slate-500 px-2 py-1"
15
+ :placeholder="col.title ?? col.name" type="text" @keyup="update()" v-model="col.Filter.valueString" />
16
16
  </div>
17
17
 
18
18
  <!-- ЦИФРЫ -->
19
19
  <div class="fc mobile:w-full px-2" v-if="col.Filter.type === 'number'">
20
20
  <input class="max-w-[100px] flex-1 outline-none border border-slate-500 px-2 py-1"
21
- :placeholder="'From ' + col.title ?? col.name" type="text" @keyup="update()"
21
+ :placeholder="'From ' + (col.title ?? col.name)" type="text" @keyup="update()"
22
22
  v-model="col.Filter.valueRangeNumbers.from" />
23
23
  <span class="mx-2"> - </span>
24
24
  <input class="max-w-[100px] flex-1 outline-none border border-slate-500 px-2 py-1"
@@ -49,7 +49,8 @@
49
49
  <Datepicker class="mobile:w-full" v-if="col.Filter.type === 'date'" v-model="col.Filter.valueString"
50
50
  :auto-apply="true" :enable-time-picker="false" @update:model-value="update()" :teleport="true"></Datepicker>
51
51
  <Datepicker class="mobile:w-full" v-if="col.Filter.type === 'daterange'" v-model="col.Filter.valueRange"
52
- :range="true" :enable-time-picker="false" :auto-apply="true" @update:model-value="update()" :teleport="true">
52
+ :range="true" :enable-time-picker="false" :auto-apply="true" @update:model-value="update()"
53
+ :teleport="true">
53
54
  </Datepicker>
54
55
  </div>
55
56
  </div>