vue-laravel-crud 2.0.0 → 2.0.1
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/dist/vue-laravel-crud.esm.js +134 -46
- package/dist/vue-laravel-crud.min.js +3 -3
- package/dist/vue-laravel-crud.ssr.js +148 -56
- package/package.json +4 -2
- package/src/components/CrudCards.vue +6 -3
- package/src/components/CrudCustom.vue +2 -2
- package/src/components/CrudHeader.vue +15 -2
- package/src/components/CrudKanban.vue +1 -1
- package/src/components/CrudPagination.vue +75 -15
- package/src/components/CrudTable.vue +2 -2
- package/src/components/table/TableHeader.vue +39 -7
- package/src/components/table/TableRow.vue +5 -1
- package/src/vue-laravel-crud.vue +33 -0
|
@@ -20,19 +20,35 @@
|
|
|
20
20
|
</infinite-loading>
|
|
21
21
|
|
|
22
22
|
<!-- Paginador -->
|
|
23
|
-
<div class="paginator-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
<div class="paginator-container" v-if="!infiniteScroll">
|
|
24
|
+
<div class="paginator-data">
|
|
25
|
+
<span class="paginator-badge">
|
|
26
|
+
<span class="paginator-label">Filas:</span>
|
|
27
|
+
<span class="paginator-value">{{ pagination.total }}</span>
|
|
28
|
+
</span>
|
|
29
|
+
<span class="paginator-badge">
|
|
30
|
+
<span class="paginator-label">xPág:</span>
|
|
31
|
+
<span class="paginator-value">{{ pagination.per_page }}</span>
|
|
32
|
+
</span>
|
|
33
|
+
<span class="paginator-badge">
|
|
34
|
+
<span class="paginator-label">Pág:</span>
|
|
35
|
+
<span class="paginator-value">{{ pagination.current_page }}</span>
|
|
36
|
+
</span>
|
|
37
|
+
<span class="paginator-badge" v-if="selectedItems.length > 0">
|
|
38
|
+
<span class="paginator-label">Seleccionados:</span>
|
|
39
|
+
<span class="paginator-value">{{ selectedItems.length }}</span>
|
|
40
|
+
</span>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div class="crud-paginator">
|
|
44
|
+
<b-pagination
|
|
45
|
+
v-if="showPaginator"
|
|
46
|
+
v-model="pagination.current_page"
|
|
47
|
+
:total-rows="pagination.total"
|
|
48
|
+
:per-page="pagination.per_page"
|
|
49
|
+
@change="onPaginationChange($event)"
|
|
50
|
+
></b-pagination>
|
|
51
|
+
</div>
|
|
36
52
|
</div>
|
|
37
53
|
</div>
|
|
38
54
|
</template>
|
|
@@ -63,11 +79,55 @@ export default {
|
|
|
63
79
|
</script>
|
|
64
80
|
|
|
65
81
|
<style scoped>
|
|
66
|
-
.
|
|
82
|
+
.paginator-container {
|
|
67
83
|
display: flex;
|
|
84
|
+
flex-direction: column;
|
|
68
85
|
align-items: center;
|
|
69
86
|
width: 100%;
|
|
70
|
-
justify-content: center;
|
|
71
87
|
margin-top: 1rem;
|
|
88
|
+
gap: 0.75rem;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.paginator-data {
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-wrap: wrap;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
align-items: center;
|
|
96
|
+
gap: 0.5rem;
|
|
97
|
+
font-size: 0.875rem;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.paginator-badge {
|
|
101
|
+
display: inline-flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
gap: 0.25rem;
|
|
104
|
+
padding: 0.375rem 0.625rem;
|
|
105
|
+
background-color: #f8f9fa;
|
|
106
|
+
border: 1px solid #dee2e6;
|
|
107
|
+
border-radius: 0.375rem;
|
|
108
|
+
color: #495057;
|
|
109
|
+
transition: all 0.2s ease;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.paginator-badge:hover {
|
|
113
|
+
background-color: #e9ecef;
|
|
114
|
+
border-color: #ced4da;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.paginator-label {
|
|
118
|
+
font-weight: 500;
|
|
119
|
+
color: #6c757d;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.paginator-value {
|
|
123
|
+
font-weight: 600;
|
|
124
|
+
color: #212529;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.crud-paginator {
|
|
128
|
+
display: flex;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
align-items: center;
|
|
131
|
+
width: 100%;
|
|
72
132
|
}
|
|
73
133
|
</style>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<TableHeader />
|
|
5
5
|
|
|
6
6
|
<draggable
|
|
7
|
-
|
|
7
|
+
:list="items"
|
|
8
8
|
:group="draggableGroup"
|
|
9
9
|
tag="tbody"
|
|
10
10
|
:draggable="orderable ? '.item' : '.none'"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
</draggable>
|
|
26
26
|
</table>
|
|
27
27
|
|
|
28
|
-
<p v-if="!loading &&
|
|
28
|
+
<p v-if="!loading && itemsList && itemsList.length == 0 && !infiniteScroll" class="p-3">
|
|
29
29
|
{{ messageEmptyResults }}
|
|
30
30
|
</p>
|
|
31
31
|
</div>
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
<tr>
|
|
4
4
|
<slot name="rowHead">
|
|
5
5
|
<th v-for="(column, indexc) in columns" :key="indexc"
|
|
6
|
-
:style="{ width: column.width ? column.width : 'inherit' }" scope="col"
|
|
6
|
+
:style="{ width: column.width ? column.width : 'inherit' }" scope="col"
|
|
7
|
+
@mouseenter="hoveredColumn = column.prop"
|
|
8
|
+
@mouseleave="hoveredColumn = null">
|
|
7
9
|
<slot :name="'filter-' + column.prop" v-bind:column="column" v-bind:filter="filter"
|
|
8
10
|
v-bind:internalFilterByProp="internalFilterByProp" v-if="enableFilters &&
|
|
9
11
|
filtersVisible &&
|
|
@@ -81,12 +83,12 @@
|
|
|
81
83
|
<span v-else>{{ column.label }}</span>
|
|
82
84
|
|
|
83
85
|
<span
|
|
84
|
-
v-if="
|
|
85
|
-
class="sort-filter" @click="toggleSortFilter(column)"
|
|
86
|
-
|
|
87
|
-
v-if="
|
|
86
|
+
v-if="isSortableColumn(column) && shouldShowSortIcon(column)"
|
|
87
|
+
class="sort-filter" @click="toggleSortFilter(column)">
|
|
88
|
+
<b-icon-sort-up
|
|
89
|
+
v-if="getSortIconDirection(column) === 'up'"></b-icon-sort-up>
|
|
88
90
|
<b-icon-sort-down
|
|
89
|
-
v-if="
|
|
91
|
+
v-if="getSortIconDirection(column) === 'down'"></b-icon-sort-down>
|
|
90
92
|
</span>
|
|
91
93
|
</th>
|
|
92
94
|
</slot>
|
|
@@ -108,6 +110,36 @@ export default {
|
|
|
108
110
|
'toggleSortFilter',
|
|
109
111
|
'sortable',
|
|
110
112
|
'optionsLoaded'
|
|
111
|
-
]
|
|
113
|
+
],
|
|
114
|
+
data() {
|
|
115
|
+
return {
|
|
116
|
+
hoveredColumn: null
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
methods: {
|
|
120
|
+
isSortableColumn(column) {
|
|
121
|
+
return this.sortable &&
|
|
122
|
+
column.type != 'select' &&
|
|
123
|
+
column.type != 'checkbox' &&
|
|
124
|
+
this.internalFilterByProp(column.prop + '_sort');
|
|
125
|
+
},
|
|
126
|
+
shouldShowSortIcon(column) {
|
|
127
|
+
const sortFilter = this.internalFilterByProp(column.prop + '_sort');
|
|
128
|
+
return this.hoveredColumn === column.prop || sortFilter.value;
|
|
129
|
+
},
|
|
130
|
+
getSortIconDirection(column) {
|
|
131
|
+
const sortFilter = this.internalFilterByProp(column.prop + '_sort');
|
|
132
|
+
const sortValue = sortFilter.value;
|
|
133
|
+
|
|
134
|
+
if (sortValue === 'DESC') {
|
|
135
|
+
return 'down';
|
|
136
|
+
} else if (sortValue === 'ASC') {
|
|
137
|
+
return 'up';
|
|
138
|
+
} else if (this.hoveredColumn === column.prop) {
|
|
139
|
+
return 'up';
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
112
144
|
};
|
|
113
145
|
</script>
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<tr
|
|
2
|
+
<tr
|
|
3
|
+
@mouseover="onRowHover(item, index)"
|
|
4
|
+
@click="onRowClick(item, index)"
|
|
5
|
+
:class="['item', { 'selected': item.selected }]"
|
|
6
|
+
>
|
|
3
7
|
<th :colspan="columns.length" v-if="grouped && item.crudgroup">
|
|
4
8
|
<span>{{ item.crudgrouplabel }}</span>
|
|
5
9
|
</th>
|
package/src/vue-laravel-crud.vue
CHANGED
|
@@ -106,6 +106,7 @@ export default /*#__PURE__*/ {
|
|
|
106
106
|
bulkDelete: this.bulkDelete,
|
|
107
107
|
showImport: this.showImport,
|
|
108
108
|
showExport: this.showExport,
|
|
109
|
+
fileImport: this.fileImport,
|
|
109
110
|
markDirty: this.markDirty,
|
|
110
111
|
|
|
111
112
|
// Data from mixins
|
|
@@ -545,6 +546,38 @@ tr td:first-child {
|
|
|
545
546
|
white-space: nowrap;
|
|
546
547
|
}
|
|
547
548
|
|
|
549
|
+
tbody tr.selected {
|
|
550
|
+
background-color: #e3f2fd !important;
|
|
551
|
+
|
|
552
|
+
td {
|
|
553
|
+
background-color: transparent !important;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
&:hover {
|
|
557
|
+
background-color: #bbdefb !important;
|
|
558
|
+
|
|
559
|
+
td {
|
|
560
|
+
background-color: transparent !important;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
.table-striped tbody tr.selected:nth-of-type(odd) {
|
|
566
|
+
background-color: #e3f2fd !important;
|
|
567
|
+
|
|
568
|
+
td {
|
|
569
|
+
background-color: transparent !important;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
.table-striped tbody tr.selected:nth-of-type(even) {
|
|
574
|
+
background-color: #e3f2fd !important;
|
|
575
|
+
|
|
576
|
+
td {
|
|
577
|
+
background-color: transparent !important;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
548
581
|
.crud-pagination {
|
|
549
582
|
display: flex;
|
|
550
583
|
align-items: center;
|