@drax/crud-vue 2.4.0 → 2.6.0
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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.6.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"module": "./src/index.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"format": "prettier --write src/"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@drax/common-front": "^2.
|
|
27
|
+
"@drax/common-front": "^2.6.0",
|
|
28
28
|
"@drax/crud-front": "^2.0.0",
|
|
29
29
|
"@drax/crud-share": "^2.4.0",
|
|
30
30
|
"@drax/media-vue": "^2.2.1"
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"vue-tsc": "^3.2.4",
|
|
51
51
|
"vuetify": "^3.11.8"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "57830b50c2c9081b9d7e236d441ed9b2a3aca0ba"
|
|
54
54
|
}
|
|
@@ -26,7 +26,7 @@ const {entity} = defineProps({
|
|
|
26
26
|
|
|
27
27
|
const {
|
|
28
28
|
loading, itemsPerPage, page, sortBy, search, totalItems, items,
|
|
29
|
-
doPaginate, filters, applyFilters, clearFilters
|
|
29
|
+
doPaginate, filters, applyFilters, clearFilters, paginationError
|
|
30
30
|
} = useCrud(entity)
|
|
31
31
|
|
|
32
32
|
// Usar el composable de columnas
|
|
@@ -61,6 +61,19 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
|
|
|
61
61
|
@update:options="doPaginate"
|
|
62
62
|
>
|
|
63
63
|
|
|
64
|
+
<template v-slot:no-data>
|
|
65
|
+
<v-alert
|
|
66
|
+
v-if="paginationError"
|
|
67
|
+
variant="tonal"
|
|
68
|
+
class="w-100 ma-2"
|
|
69
|
+
style="width: 100%; min-width: 100%"
|
|
70
|
+
prominent
|
|
71
|
+
type="error"
|
|
72
|
+
:text="te(paginationError) ? t(paginationError) : paginationError"
|
|
73
|
+
/>
|
|
74
|
+
<v-alert v-else variant="tonal" class="w-100 ma-2 " type="info" :text="te('crud.noData') ? t('crud.noData') : 'No data' " />
|
|
75
|
+
</template>
|
|
76
|
+
|
|
64
77
|
<template v-slot:bottom>
|
|
65
78
|
<v-data-table-footer :class="entity.footerClass"
|
|
66
79
|
:items-per-page-options="[5, 10, 20, 50]"
|
|
@@ -80,12 +93,12 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
|
|
|
80
93
|
|
|
81
94
|
<crud-import-button
|
|
82
95
|
:entity="entity"
|
|
83
|
-
@import="v => $emit('import', v)"
|
|
96
|
+
@import="(v:any) => $emit('import', v)"
|
|
84
97
|
/>
|
|
85
98
|
|
|
86
99
|
<crud-export-button
|
|
87
100
|
:entity="entity"
|
|
88
|
-
@export="v => $emit('export',v)"
|
|
101
|
+
@export="(v:any) => $emit('export',v)"
|
|
89
102
|
/>
|
|
90
103
|
|
|
91
104
|
<crud-group-by-button
|
|
@@ -18,6 +18,14 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
18
18
|
}
|
|
19
19
|
})
|
|
20
20
|
|
|
21
|
+
const paginationError = computed({
|
|
22
|
+
get() {
|
|
23
|
+
return store.paginationError
|
|
24
|
+
}, set(value) {
|
|
25
|
+
store.setPaginationError(value)
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
|
|
21
29
|
const dialog = computed({
|
|
22
30
|
get() {
|
|
23
31
|
return store.dialog
|
|
@@ -148,6 +156,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
148
156
|
|
|
149
157
|
async function doPaginate() {
|
|
150
158
|
store.setLoading(true)
|
|
159
|
+
store.setPaginationError("")
|
|
151
160
|
try {
|
|
152
161
|
|
|
153
162
|
const r: IDraxPaginateResult<any> = await entity?.provider.paginate({
|
|
@@ -160,7 +169,13 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
160
169
|
})
|
|
161
170
|
store.setItems(r.items)
|
|
162
171
|
store.setTotalItems(r.total)
|
|
163
|
-
} catch (e) {
|
|
172
|
+
} catch (e: any) {
|
|
173
|
+
store.setItems([])
|
|
174
|
+
store.setTotalItems(0)
|
|
175
|
+
if(e && e.message){
|
|
176
|
+
store.setPaginationError(e.message)
|
|
177
|
+
|
|
178
|
+
}
|
|
164
179
|
console.error("Error paginating", e)
|
|
165
180
|
} finally {
|
|
166
181
|
store.setLoading(false)
|
|
@@ -401,7 +416,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
401
416
|
return {
|
|
402
417
|
doPaginate, doExport, doUpdate, doCreate, doDelete,
|
|
403
418
|
onView, onCreate, onEdit, onDelete, onCancel, onSubmit, resetCrudStore,
|
|
404
|
-
operation, dialog, form, notify, error, message, formValid,
|
|
419
|
+
operation, dialog, form, notify, error, paginationError, message, formValid,
|
|
405
420
|
loading, itemsPerPage, page, sortBy, search, totalItems, items,
|
|
406
421
|
prepareFilters, filters, clearFilters, applyFilters,
|
|
407
422
|
exportFiles, exportLoading, exportListVisible, exportError,
|
|
@@ -11,6 +11,7 @@ export const useCrudStore = (id: string = 'entity') => defineStore('CrudStore'+i
|
|
|
11
11
|
notify: false as boolean,
|
|
12
12
|
message: '' as string,
|
|
13
13
|
error: '' as string,
|
|
14
|
+
paginationError: '' as string,
|
|
14
15
|
filters: [] as IDraxFieldFilter[],
|
|
15
16
|
items: [] as any[],
|
|
16
17
|
totalItems: 0 as number,
|
|
@@ -139,6 +140,9 @@ export const useCrudStore = (id: string = 'entity') => defineStore('CrudStore'+i
|
|
|
139
140
|
|
|
140
141
|
clearVisibleColumns() {
|
|
141
142
|
this.visibleColumns = []
|
|
143
|
+
},
|
|
144
|
+
setPaginationError(val: string){
|
|
145
|
+
this.paginationError = val
|
|
142
146
|
}
|
|
143
147
|
}
|
|
144
148
|
|