vue-laravel-crud 2.0.5 → 2.0.6
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 +1359 -228
- package/dist/vue-laravel-crud.min.js +3 -3
- package/dist/vue-laravel-crud.ssr.js +1378 -241
- package/package.json +1 -1
- package/src/ItemCard.vue +45 -4
- package/src/components/CrudCards.vue +19 -3
- package/src/components/CrudCustom.vue +14 -2
- package/src/components/CrudFilters.vue +152 -0
- package/src/components/CrudHeader.vue +12 -2
- package/src/components/CrudKanban.vue +19 -3
- package/src/components/CrudModals.vue +49 -21
- package/src/components/CrudTable.vue +18 -2
- package/src/components/kanban/KanbanBoard.vue +5 -1
- package/src/components/kanban/KanbanCard.vue +45 -4
- package/src/components/kanban/KanbanColumn.vue +6 -2
- package/src/components/table/TableCell.vue +66 -20
- package/src/components/table/TableHeader.vue +21 -6
- package/src/components/table/TableRow.vue +5 -1
- package/src/vue-laravel-crud.vue +25 -4
|
@@ -54,6 +54,12 @@
|
|
|
54
54
|
)
|
|
55
55
|
}}
|
|
56
56
|
</span>
|
|
57
|
+
<span v-else-if="column.type == 'money' || column.type == 'price'">
|
|
58
|
+
{{ formatMoney(itemValue(column, item), column) }}
|
|
59
|
+
</span>
|
|
60
|
+
<span v-else-if="column.type == 'number' && (column.thousandsSeparator || column.decimalSeparator || column.decimals !== undefined)">
|
|
61
|
+
{{ formatNumber(itemValue(column, item), column) }}
|
|
62
|
+
</span>
|
|
57
63
|
<span v-else>
|
|
58
64
|
|
|
59
65
|
{{ itemValue(column, item) }}
|
|
@@ -68,33 +74,39 @@
|
|
|
68
74
|
<template #button-content>
|
|
69
75
|
<b-icon-list></b-icon-list>
|
|
70
76
|
</template>
|
|
71
|
-
<slot name="
|
|
77
|
+
<slot name="rowActions" v-bind:item="item" v-bind:index="index" v-bind:showItem="showItem"
|
|
72
78
|
v-bind:updateItem="updateItem" v-bind:removeItem="removeItem">
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
<slot name="rowAction" v-bind:item="item" v-bind:index="index" v-bind:showItem="showItem"
|
|
80
|
+
v-bind:updateItem="updateItem" v-bind:removeItem="removeItem">
|
|
81
|
+
<b-dropdown-item @click="showItem(item.id, index)">
|
|
82
|
+
<b-icon-eye></b-icon-eye> Ver
|
|
83
|
+
</b-dropdown-item>
|
|
84
|
+
<b-dropdown-item @click="updateItem(item.id, index)">
|
|
85
|
+
<b-icon-pencil></b-icon-pencil> Editar
|
|
86
|
+
</b-dropdown-item>
|
|
87
|
+
<b-dropdown-item @click="removeItem(item.id, index)" class="text-danger">
|
|
88
|
+
<b-icon-trash></b-icon-trash> Eliminar
|
|
89
|
+
</b-dropdown-item>
|
|
90
|
+
</slot>
|
|
82
91
|
</slot>
|
|
83
92
|
</b-dropdown>
|
|
84
93
|
|
|
85
94
|
<!-- Modo botones normal (comportamiento original) -->
|
|
86
95
|
<b-button-group v-else-if="column.type == 'actions'" class="actions-button-group">
|
|
87
|
-
<slot name="
|
|
96
|
+
<slot name="rowActions" v-bind:item="item" v-bind:index="index" v-bind:showItem="showItem"
|
|
88
97
|
v-bind:updateItem="updateItem" v-bind:removeItem="removeItem">
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
<slot name="rowAction" v-bind:item="item" v-bind:index="index" v-bind:showItem="showItem"
|
|
99
|
+
v-bind:updateItem="updateItem" v-bind:removeItem="removeItem">
|
|
100
|
+
<b-button variant="primary" @click="showItem(item.id, index)">
|
|
101
|
+
<b-icon-eye></b-icon-eye>
|
|
102
|
+
</b-button>
|
|
103
|
+
<b-button variant="secondary" @click="updateItem(item.id, index)">
|
|
104
|
+
<b-icon-pencil></b-icon-pencil>
|
|
105
|
+
</b-button>
|
|
106
|
+
<b-button variant="danger" @click="removeItem(item.id, index)">
|
|
107
|
+
<b-icon-trash></b-icon-trash>
|
|
108
|
+
</b-button>
|
|
109
|
+
</slot>
|
|
98
110
|
</slot>
|
|
99
111
|
</b-button-group>
|
|
100
112
|
</td>
|
|
@@ -139,6 +151,40 @@ export default {
|
|
|
139
151
|
}
|
|
140
152
|
return [];
|
|
141
153
|
}
|
|
154
|
+
},
|
|
155
|
+
methods: {
|
|
156
|
+
formatNumber(value, column) {
|
|
157
|
+
if (value === null || value === undefined || value === '') {
|
|
158
|
+
return '';
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const numValue = parseFloat(value);
|
|
162
|
+
if (isNaN(numValue)) {
|
|
163
|
+
return value;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const thousandsSep = column.thousandsSeparator || '.';
|
|
167
|
+
const decimalSep = column.decimalSeparator || ',';
|
|
168
|
+
const decimals = column.decimals !== undefined ? column.decimals : (numValue % 1 === 0 ? 0 : 2);
|
|
169
|
+
|
|
170
|
+
// Formatear número con separadores
|
|
171
|
+
const parts = numValue.toFixed(decimals).split('.');
|
|
172
|
+
const integerPart = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, thousandsSep);
|
|
173
|
+
const decimalPart = parts[1] || '';
|
|
174
|
+
|
|
175
|
+
if (decimals > 0 && decimalPart) {
|
|
176
|
+
return `${integerPart}${decimalSep}${decimalPart}`;
|
|
177
|
+
}
|
|
178
|
+
return integerPart;
|
|
179
|
+
},
|
|
180
|
+
formatMoney(value, column) {
|
|
181
|
+
const formatted = this.formatNumber(value, column);
|
|
182
|
+
if (formatted === '') {
|
|
183
|
+
return '';
|
|
184
|
+
}
|
|
185
|
+
const symbol = column.symbol || '$';
|
|
186
|
+
return `${symbol}${formatted}`;
|
|
187
|
+
}
|
|
142
188
|
}
|
|
143
189
|
};
|
|
144
190
|
</script>
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
</div>
|
|
37
37
|
</div>
|
|
38
38
|
|
|
39
|
-
<div class="row" v-else-if="column.type == 'number' || column.type == 'money'">
|
|
39
|
+
<div class="row" v-else-if="column.type == 'number' || column.type == 'money' || column.type == 'price'">
|
|
40
40
|
<div class="col-6">
|
|
41
41
|
<input
|
|
42
42
|
type="number"
|
|
43
43
|
class="form-control form-control-md p-2"
|
|
44
44
|
v-model.number="internalFilterByProp(column.prop + '_from').value"
|
|
45
|
-
:step="column.type == 'money' ? '0.01' : '1'"
|
|
45
|
+
:step="column.type == 'money' || column.type == 'price' ? '0.01' : '1'"
|
|
46
46
|
@change="onChangeFilter($event)"
|
|
47
47
|
placeholder="Desde" />
|
|
48
48
|
</div>
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
type="number"
|
|
52
52
|
class="form-control form-control-md p-2"
|
|
53
53
|
v-model.number="internalFilterByProp(column.prop + '_to').value"
|
|
54
|
-
:step="column.type == 'money' ? '0.01' : '1'"
|
|
54
|
+
:step="column.type == 'money' || column.type == 'price' ? '0.01' : '1'"
|
|
55
55
|
@change="onChangeFilter($event)"
|
|
56
56
|
placeholder="Hasta" />
|
|
57
57
|
</div>
|
|
@@ -104,12 +104,17 @@
|
|
|
104
104
|
<span v-else>{{ column.label }}</span>
|
|
105
105
|
|
|
106
106
|
<span
|
|
107
|
-
v-if="isSortableColumn(column)
|
|
108
|
-
class="sort-filter
|
|
107
|
+
v-if="isSortableColumn(column)"
|
|
108
|
+
class="sort-filter ml-1"
|
|
109
|
+
:class="{ 'sort-filter-visible': shouldShowSortIcon(column) }"
|
|
110
|
+
@click="toggleSortFilter(column)">
|
|
109
111
|
<b-icon-sort-up
|
|
110
112
|
v-if="getSortIconDirection(column) === 'up'"></b-icon-sort-up>
|
|
111
113
|
<b-icon-sort-down
|
|
112
|
-
v-if="getSortIconDirection(column) === 'down'"></b-icon-sort-down>
|
|
114
|
+
v-else-if="getSortIconDirection(column) === 'down'"></b-icon-sort-down>
|
|
115
|
+
<b-icon-sort-up
|
|
116
|
+
v-else
|
|
117
|
+
style="visibility: hidden;"></b-icon-sort-up>
|
|
113
118
|
</span>
|
|
114
119
|
</th>
|
|
115
120
|
</slot>
|
|
@@ -172,4 +177,14 @@ export default {
|
|
|
172
177
|
width: 1%;
|
|
173
178
|
white-space: nowrap;
|
|
174
179
|
}
|
|
180
|
+
|
|
181
|
+
.sort-filter {
|
|
182
|
+
cursor: pointer;
|
|
183
|
+
visibility: hidden;
|
|
184
|
+
display: inline-block;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.sort-filter-visible {
|
|
188
|
+
visibility: visible;
|
|
189
|
+
}
|
|
175
190
|
</style>
|
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
:item="item"
|
|
17
17
|
:index="index"
|
|
18
18
|
:columnIndex="indexc"
|
|
19
|
-
|
|
19
|
+
>
|
|
20
|
+
<template v-for="(slot, name) in $scopedSlots" v-slot:[name]="slotProps">
|
|
21
|
+
<slot :name="name" v-bind="slotProps" />
|
|
22
|
+
</template>
|
|
23
|
+
</TableCell>
|
|
20
24
|
</slot>
|
|
21
25
|
</tr>
|
|
22
26
|
</template>
|
package/src/vue-laravel-crud.vue
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import Vue from 'vue';
|
|
2
3
|
import CrudHeader from "./components/CrudHeader.vue";
|
|
3
4
|
import CrudTable from "./components/CrudTable.vue";
|
|
4
5
|
import CrudCards from "./components/CrudCards.vue";
|
|
@@ -45,6 +46,7 @@ export default /*#__PURE__*/ {
|
|
|
45
46
|
vuexLocalforage: this.vuexLocalforage,
|
|
46
47
|
columns: this.columns,
|
|
47
48
|
filter: this.filter,
|
|
49
|
+
customFilters: this.customFilters,
|
|
48
50
|
enableFilters: this.enableFilters,
|
|
49
51
|
infiniteScroll: this.infiniteScroll,
|
|
50
52
|
sortable: this.sortable,
|
|
@@ -65,7 +67,7 @@ export default /*#__PURE__*/ {
|
|
|
65
67
|
showHeader: this.showHeader,
|
|
66
68
|
showTitle: this.showTitle,
|
|
67
69
|
limit: this.limit,
|
|
68
|
-
displayMode: this.
|
|
70
|
+
displayMode: this.displayModeReactive,
|
|
69
71
|
displayModeToggler: this.displayModeToggler,
|
|
70
72
|
colXs: this.colXs,
|
|
71
73
|
colSm: this.colSm,
|
|
@@ -114,6 +116,8 @@ export default /*#__PURE__*/ {
|
|
|
114
116
|
moment: this.moment,
|
|
115
117
|
loading: this.loading,
|
|
116
118
|
firstLoad: this.firstLoad,
|
|
119
|
+
// Proporcionar item como función getter para reactividad
|
|
120
|
+
getItem: () => this.item,
|
|
117
121
|
item: this.item,
|
|
118
122
|
items: this.items,
|
|
119
123
|
selectedItems: this.selectedItems,
|
|
@@ -180,6 +184,7 @@ export default /*#__PURE__*/ {
|
|
|
180
184
|
toggleFilters: this.toggleFilters,
|
|
181
185
|
resetFilters: this.resetFilters,
|
|
182
186
|
isColumnHasFilter: this.isColumnHasFilter,
|
|
187
|
+
isCustomFilterEnabled: this.isCustomFilterEnabled,
|
|
183
188
|
setFilter: this.setFilter,
|
|
184
189
|
onChangeFilter: this.onChangeFilter,
|
|
185
190
|
togglePrincipalSort: this.togglePrincipalSort,
|
|
@@ -256,6 +261,10 @@ export default /*#__PURE__*/ {
|
|
|
256
261
|
type: Array,
|
|
257
262
|
default: () => [],
|
|
258
263
|
},
|
|
264
|
+
customFilters: {
|
|
265
|
+
type: Array,
|
|
266
|
+
default: () => [],
|
|
267
|
+
},
|
|
259
268
|
enableFilters: {
|
|
260
269
|
type: Boolean,
|
|
261
270
|
default: false,
|
|
@@ -532,9 +541,21 @@ export default /*#__PURE__*/ {
|
|
|
532
541
|
<div class="crud">
|
|
533
542
|
<CrudHeader />
|
|
534
543
|
|
|
535
|
-
<CrudTable
|
|
536
|
-
|
|
537
|
-
|
|
544
|
+
<CrudTable>
|
|
545
|
+
<template v-for="(slot, name) in $scopedSlots" v-slot:[name]="slotProps">
|
|
546
|
+
<slot :name="name" v-bind="slotProps" />
|
|
547
|
+
</template>
|
|
548
|
+
</CrudTable>
|
|
549
|
+
<CrudCards>
|
|
550
|
+
<template v-for="(slot, name) in $scopedSlots" v-slot:[name]="slotProps">
|
|
551
|
+
<slot :name="name" v-bind="slotProps" />
|
|
552
|
+
</template>
|
|
553
|
+
</CrudCards>
|
|
554
|
+
<CrudKanban>
|
|
555
|
+
<template v-for="(slot, name) in $scopedSlots" v-slot:[name]="slotProps">
|
|
556
|
+
<slot :name="name" v-bind="slotProps" />
|
|
557
|
+
</template>
|
|
558
|
+
</CrudKanban>
|
|
538
559
|
<CrudCustom />
|
|
539
560
|
|
|
540
561
|
<b-overlay :show="loading" rounded="sm"></b-overlay>
|