flameresttable 1.0.66 → 1.0.68
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/App.vue +1 -1
- package/src/Table/Table.vue +71 -118
- package/src/Table/TableOpts.ts +8 -1
package/package.json
CHANGED
package/src/App.vue
CHANGED
package/src/Table/Table.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="mt-0
|
|
2
|
+
<div class="mt-0 overflow-x-scroll">
|
|
3
3
|
|
|
4
4
|
<!-- ФИЛЬТРЫ -->
|
|
5
5
|
<TableFilters :columns="Table.columns" :table="Table"></TableFilters>
|
|
@@ -18,98 +18,83 @@
|
|
|
18
18
|
</TableTasksPanel>
|
|
19
19
|
|
|
20
20
|
<!-- ТАБЛИЦА-->
|
|
21
|
-
<div class="mt-2
|
|
21
|
+
<div class="mt-2 table table-fixed w-full ">
|
|
22
22
|
|
|
23
23
|
<!-- ЗАГОЛОВКИ СТОЛБЦОВ-->
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
<div class="table-header-group">
|
|
25
|
+
|
|
26
|
+
<!-- ЧЕКБОКСЫ -->
|
|
27
|
+
<div class="table-cell w-[21px] align-middle">
|
|
28
|
+
<label class="checkbox" v-if="Table.opts.rowSelectors">
|
|
29
|
+
<input type='checkbox' @change="CheckboxSelectionChanged($event, true)">
|
|
30
|
+
<span class='indicator'></span>
|
|
31
|
+
</label>
|
|
32
|
+
</div>
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
<div v-if="column.Table.isShow" :key="'cheader_' + column.name"
|
|
34
|
+
<div v-for="column in Table.columns" v-show="column.Table.isShow" :key="'cheader_' + column.name"
|
|
37
35
|
:class="' defaultHeader ' + column.Table.classesHeader"
|
|
38
|
-
class="
|
|
36
|
+
class=" table-cell align-middle border-r border-r-slate-100 px-2">
|
|
39
37
|
<span>{{ column.Table.titleCustom !== null ? (column as any).Table.titleCustom(column) : column.Table.title !==
|
|
40
38
|
'' ?
|
|
41
39
|
column.Table.title : column.title !== '' ? column.title :
|
|
42
40
|
column.name }}</span>
|
|
43
41
|
</div>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
</button>
|
|
42
|
+
<div v-if="opts.Edit.can" class="table-cell border-r border-r-slate-100 px-2">
|
|
43
|
+
<button class="bg-green-600 invisible">
|
|
44
|
+
Изменить
|
|
45
|
+
</button>
|
|
46
|
+
</div>
|
|
47
|
+
<div v-if="opts.Remove.can" class="table-cell border-r border-r-slate-100 px-2">
|
|
48
|
+
<button class="bg-green-600 invisible">
|
|
49
|
+
Удалить
|
|
50
|
+
</button>
|
|
51
|
+
</div>
|
|
56
52
|
</div>
|
|
57
|
-
<!--</div>-->
|
|
58
53
|
|
|
59
54
|
<!-- СТРОКИ-->
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
55
|
+
<div class="table-row-group text-left">
|
|
56
|
+
|
|
57
|
+
<template v-for="(row) in (Table.Rows.rows)">
|
|
58
|
+
<div :key="'row_' + (row as any).id" class="defaultRow table-row cursor-pointer hover:bg-slate-100" v-if="true">
|
|
59
|
+
|
|
60
|
+
<!-- ЧЕКБОКСЫ -->
|
|
61
|
+
<div class="table-cell align-middle w-[21px]">
|
|
62
|
+
<label class="checkbox" v-if="Table.opts.rowSelectors">
|
|
63
|
+
<input type='checkbox' v-model="Table.RowsParams[(row as any)[primaryKey]].selected"
|
|
64
|
+
@change="CheckboxSelectionChanged($event, false)">
|
|
65
|
+
<span class='indicator'></span>
|
|
66
|
+
</label>
|
|
67
|
+
</div>
|
|
73
68
|
|
|
74
|
-
|
|
75
|
-
<div v-if="column.Table.isShow" :key="'tc_' + column.name + '_row_' + (row as any).id"
|
|
69
|
+
<div v-for="column in Table.columns" v-show="column.Table.isShow" :key="'tc_' + column.name"
|
|
76
70
|
:class="' defaultCell ' + column.Table.classes"
|
|
77
|
-
class="
|
|
71
|
+
class="table-cell align-middle border-r border-r-slate-100 px-2 last:border-r-0 last:pr-0"
|
|
78
72
|
@click="columnClick(row, column)"
|
|
79
|
-
:style="
|
|
73
|
+
:style="(column.Table.width === null ? '' : 'width:' + column.Table.width + 'px')">
|
|
80
74
|
|
|
81
75
|
<span v-if="!column.Table.isRawValue">{{
|
|
82
76
|
column.Table.value(row, column) }}</span>
|
|
83
77
|
<span v-else v-html="column.Table.value(row, column)"></span>
|
|
84
78
|
</div>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
79
|
+
<div v-if="opts.Edit.can" class="table-cell border-r border-r-slate-100 px-2 text-center">
|
|
80
|
+
<button class="px-2 py-1 bg-green-600 text-white my-1" @click="edit(row)">
|
|
81
|
+
Изменить
|
|
82
|
+
</button>
|
|
83
|
+
</div>
|
|
84
|
+
<div v-if="opts.Remove.can" class="table-cell border-r border-r-slate-100 px-2 text-center">
|
|
85
|
+
<button class="px-2 py-1 bg-gray-600 opacity-30 text-white my-1" @click="deleteRow(row)">
|
|
86
|
+
Удалить
|
|
87
|
+
</button>
|
|
88
|
+
</div>
|
|
94
89
|
</div>
|
|
95
|
-
<div
|
|
96
|
-
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
</
|
|
100
|
-
<button class="desktop:hidden px-2 py-1 bg-gray-600 opacity-30 text-white my-1" @click="deleteRow(row)">
|
|
101
|
-
<img src="/src/assets/icons/remove.svg" class="w-4 h-4 fill-white" />
|
|
102
|
-
</button>
|
|
90
|
+
<div class="table-cell text-center relative" :key="'row_slot_' + (row as any).id"
|
|
91
|
+
v-if="opts.onRowClickOpenSlot && !isRowCollapsed(row)">
|
|
92
|
+
<div class=" mx-auto no-wrap-cell mobile:w-full text-center">
|
|
93
|
+
<slot name="RowSubSlot" :row="row" />
|
|
94
|
+
</div>
|
|
103
95
|
</div>
|
|
104
96
|
</template>
|
|
105
|
-
|
|
106
|
-
:key="'row_slot_' + (row as any).id" v-if="opts.onRowClickOpenSlot && !isRowCollapsed(row)">
|
|
107
|
-
<div class=" mx-auto no-wrap-cell mobile:w-full text-center">
|
|
108
|
-
<slot name="RowSubSlot" :row="row" />
|
|
109
|
-
</div>
|
|
110
|
-
</div>
|
|
111
|
-
</template>
|
|
112
|
-
|
|
97
|
+
</div>
|
|
113
98
|
|
|
114
99
|
</div>
|
|
115
100
|
</div>
|
|
@@ -126,7 +111,7 @@
|
|
|
126
111
|
<slot name="header" />
|
|
127
112
|
|
|
128
113
|
<!-- КОЛОНКИ ТАБЛИЦЫ-->
|
|
129
|
-
<label v-for="
|
|
114
|
+
<label v-for="column in ColumnNames" v-show="Table.columns[column].Popup.isShow" :key="'c' + column"
|
|
130
115
|
class="flex items-stretch justify-center w-full my-1 ml-2">
|
|
131
116
|
|
|
132
117
|
<!-- Заголовок -->
|
|
@@ -153,7 +138,7 @@
|
|
|
153
138
|
<div v-if="Table.columns[column].Popup.popupType === 'selector'"
|
|
154
139
|
class="flex-1 mr-5 w-full flex flex-col self-stretch"><select v-model="Table.columns[column].Popup.model"
|
|
155
140
|
class="h-full self-stretch py-1 px-2 w-full outline-none border border-slate-100">
|
|
156
|
-
<option v-for="(
|
|
141
|
+
<option v-for="(selectorVal, selectorKey) in Table.columns[column].Popup.Selector.values"
|
|
157
142
|
:key="'sel_' + selectorKey"
|
|
158
143
|
:value="getSelector(Table.columns[column].Popup.Selector.values, selectorKey, selectorVal)[1]">{{
|
|
159
144
|
getSelector(Table.columns[column].Popup.Selector.values, selectorKey, selectorVal)[0] }}</option>
|
|
@@ -366,27 +351,24 @@ export default defineComponent({
|
|
|
366
351
|
const primaryKey = (Table.model as any).constructor.primaryKeys[0];
|
|
367
352
|
|
|
368
353
|
const columnClick = (row: any, column: Column) => {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
354
|
+
switch (Table.opts.onRowClickOpenSlot) {
|
|
355
|
+
case 'rowspace':
|
|
356
|
+
Table.RowsParams[row[primaryKey]].collapsed = !Table.RowsParams[row[primaryKey]].collapsed
|
|
357
|
+
break;
|
|
358
|
+
case 'popup':
|
|
359
|
+
Table.RowsParams[row[primaryKey]].collapsed = !Table.RowsParams[row[primaryKey]].collapsed
|
|
360
|
+
break;
|
|
361
|
+
default:
|
|
362
|
+
if (column?.Table?.click !== undefined)
|
|
363
|
+
column.Table.click(row, column);
|
|
364
|
+
break;
|
|
375
365
|
}
|
|
366
|
+
|
|
376
367
|
}
|
|
377
368
|
const isRowCollapsed = (row: any) => {
|
|
378
369
|
return Table.RowsParams[row[primaryKey]].collapsed
|
|
379
370
|
}
|
|
380
371
|
|
|
381
|
-
const columnCount = (): number => {
|
|
382
|
-
let cnt = Object.keys(Table.columns).filter(r => Table.columns[r].Table.isShow).length;
|
|
383
|
-
// Добавляем одно поле для чекбоксов
|
|
384
|
-
cnt++;
|
|
385
|
-
// Добавляем поля изменения и удаления
|
|
386
|
-
if (Table.opts.Add.can) cnt++;
|
|
387
|
-
if (Table.opts.Edit.can) cnt++;
|
|
388
|
-
return cnt;
|
|
389
|
-
}
|
|
390
372
|
|
|
391
373
|
return {
|
|
392
374
|
Table,
|
|
@@ -400,20 +382,10 @@ export default defineComponent({
|
|
|
400
382
|
getSelector,
|
|
401
383
|
primaryKey,
|
|
402
384
|
columnClick,
|
|
403
|
-
isRowCollapsed
|
|
404
|
-
columnCount
|
|
385
|
+
isRowCollapsed
|
|
405
386
|
}
|
|
406
387
|
|
|
407
388
|
},
|
|
408
|
-
|
|
409
|
-
computed: {
|
|
410
|
-
|
|
411
|
-
columnsArray: function () {
|
|
412
|
-
return Object.keys(this.Table.columns).filter(r => this.Table.columns[r].Table.isShow).map(key => this.Table.columns[key])
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
},
|
|
416
|
-
|
|
417
389
|
methods: {
|
|
418
390
|
fileGetData(thisArr: any, getSource: boolean = true) {
|
|
419
391
|
|
|
@@ -455,32 +427,18 @@ export default defineComponent({
|
|
|
455
427
|
for (const key in this.Table.RowsParams) {
|
|
456
428
|
this.Table.RowsParams[key].selected = event.target.checked
|
|
457
429
|
}
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
|
|
430
|
+
}
|
|
461
431
|
},
|
|
462
432
|
|
|
463
433
|
})
|
|
464
434
|
|
|
465
|
-
|
|
466
|
-
|
|
467
435
|
</script>
|
|
468
436
|
|
|
469
437
|
<style scoped lang="scss">
|
|
470
|
-
.grid-container {
|
|
471
|
-
display: grid;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
438
|
.no-wrap-cell {
|
|
475
439
|
white-space: nowrap !important;
|
|
476
440
|
}
|
|
477
441
|
|
|
478
|
-
.defaultTable {
|
|
479
|
-
font-family: "Roboto", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
|
|
480
|
-
font-size: 14px;
|
|
481
|
-
text-align: left;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
442
|
.defaultHeader {
|
|
485
443
|
color: rgba(55, 53, 47, 0.65);
|
|
486
444
|
font-size: 14px;
|
|
@@ -496,11 +454,6 @@ export default defineComponent({
|
|
|
496
454
|
border: 1px solid rgb(233, 233, 231);
|
|
497
455
|
}
|
|
498
456
|
|
|
499
|
-
.defaultRow:hover {
|
|
500
|
-
cursor: pointer;
|
|
501
|
-
@apply bg-slate-100;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
457
|
// ЧЕКБОКСЫ
|
|
505
458
|
$black: #2D3137;
|
|
506
459
|
$blue: #3785BC;
|
package/src/Table/TableOpts.ts
CHANGED
|
@@ -29,7 +29,14 @@ export default class TableOpts {
|
|
|
29
29
|
/**
|
|
30
30
|
* Открывать субслот в таблице при клике
|
|
31
31
|
*/
|
|
32
|
-
public onRowClickOpenSlot:
|
|
32
|
+
public onRowClickOpenSlot: 'popup' | 'rowspace' | 'none' = 'rowspace';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Клик по строке
|
|
36
|
+
* @param row
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
public rowClick = (row: Array<{ [key: string]: IColumn }>) => null
|
|
33
40
|
|
|
34
41
|
/**
|
|
35
42
|
* Язык
|