vue-laravel-crud 2.0.5 → 2.0.7
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 +1572 -337
- package/dist/vue-laravel-crud.min.js +3 -3
- package/dist/vue-laravel-crud.ssr.js +1592 -356
- package/package.json +1 -1
- package/src/ItemCard.vue +45 -4
- package/src/components/CrudCards.vue +131 -98
- package/src/components/CrudCustom.vue +58 -29
- package/src/components/CrudFilters.vue +319 -167
- package/src/components/CrudHeader.vue +154 -142
- package/src/components/CrudKanban.vue +36 -20
- package/src/components/CrudModals.vue +132 -25
- package/src/components/CrudPagination.vue +207 -200
- package/src/components/CrudTable.vue +103 -70
- 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 +718 -697
|
@@ -30,8 +30,12 @@
|
|
|
30
30
|
:getArrayValue="getArrayValue"
|
|
31
31
|
:showItem="showItem"
|
|
32
32
|
:updateItem="updateItem"
|
|
33
|
-
:removeItem="removeItem"
|
|
34
|
-
|
|
33
|
+
:removeItem="removeItem"
|
|
34
|
+
>
|
|
35
|
+
<template v-for="(slot, name) in $scopedSlots" v-slot:[name]="slotProps">
|
|
36
|
+
<slot :name="name" v-bind="slotProps" />
|
|
37
|
+
</template>
|
|
38
|
+
</KanbanCard>
|
|
35
39
|
</slot>
|
|
36
40
|
</div>
|
|
37
41
|
</draggable>
|
|
@@ -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>
|