@drax/crud-vue 2.6.0 → 2.8.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 +4 -4
- package/src/EntityCrud.ts +15 -6
- package/src/components/Crud.vue +28 -4
- package/src/components/CrudActiveFilters.vue +2 -2
- package/src/components/CrudAutocomplete.vue +4 -4
- package/src/components/CrudFilters.vue +7 -15
- package/src/components/CrudFiltersAction.vue +37 -0
- package/src/components/CrudFiltersDynamic.vue +204 -0
- package/src/components/CrudForm.vue +11 -3
- package/src/components/CrudFormField.vue +51 -36
- package/src/components/CrudList.vue +40 -18
- package/src/components/CrudListGallery.vue +300 -0
- package/src/components/CrudListTable.vue +222 -0
- package/src/components/CrudSearch.vue +1 -1
- package/src/components/buttons/CrudCreateOnTheFlyButton.vue +1 -1
- package/src/composables/UseCrud.ts +61 -4
- package/src/index.ts +2 -0
- package/src/stores/UseCrudStore.ts +16 -0
- /package/src/composables/{useFilterIcon.ts → UseFilterIcon.ts} +0 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type {PropType} from 'vue'
|
|
3
|
+
import {useAuth} from '@drax/identity-vue'
|
|
4
|
+
import CrudSearch from "./CrudSearch.vue";
|
|
5
|
+
import {useCrud} from "../composables/UseCrud";
|
|
6
|
+
import CrudExportButton from "./buttons/CrudExportButton.vue";
|
|
7
|
+
import CrudImportButton from "./buttons/CrudImportButton.vue";
|
|
8
|
+
import CrudCreateButton from "./buttons/CrudCreateButton.vue";
|
|
9
|
+
import CrudUpdateButton from "./buttons/CrudUpdateButton.vue";
|
|
10
|
+
import CrudDeleteButton from "./buttons/CrudDeleteButton.vue";
|
|
11
|
+
import CrudViewButton from "./buttons/CrudViewButton.vue";
|
|
12
|
+
import CrudGroupByButton from "./buttons/CrudGroupByButton.vue";
|
|
13
|
+
import CrudColumnsButton from "./buttons/CrudColumnsButton.vue";
|
|
14
|
+
import CrudExportList from "./CrudExportList.vue";
|
|
15
|
+
import type {IEntityCrud} from "@drax/crud-share";
|
|
16
|
+
import {useI18n} from "vue-i18n";
|
|
17
|
+
import CrudFilters from "./CrudFilters.vue";
|
|
18
|
+
import { useCrudColumns } from "../composables/UseCrudColumns";
|
|
19
|
+
import CrudFiltersDynamic from "./CrudFiltersDynamic.vue";
|
|
20
|
+
import CrudFiltersAction from "./CrudFiltersAction.vue";
|
|
21
|
+
|
|
22
|
+
const {t, te} = useI18n()
|
|
23
|
+
const {hasPermission} = useAuth()
|
|
24
|
+
|
|
25
|
+
const {entity} = defineProps({
|
|
26
|
+
entity: {type: Object as PropType<IEntityCrud>, required: true},
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const {
|
|
30
|
+
loading, itemsPerPage, page, sortBy, search, totalItems, items,
|
|
31
|
+
doPaginate, filters, applyFilters, clearFilters, paginationError
|
|
32
|
+
} = useCrud(entity)
|
|
33
|
+
|
|
34
|
+
// Usar el composable de columnas
|
|
35
|
+
const { filteredHeaders } = useCrudColumns(entity)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
defineExpose({
|
|
39
|
+
doPaginate
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
|
|
43
|
+
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<template>
|
|
47
|
+
<v-data-table-server
|
|
48
|
+
:density="entity.tableDensity"
|
|
49
|
+
:striped="entity.tableStriped"
|
|
50
|
+
:header-props="entity.headerProps"
|
|
51
|
+
v-if="hasPermission(entity.permissions.view)"
|
|
52
|
+
v-model:items-per-page="itemsPerPage"
|
|
53
|
+
:items-per-page-options="[5, 10, 20, 50]"
|
|
54
|
+
v-model:page="page"
|
|
55
|
+
v-model:sort-by="sortBy"
|
|
56
|
+
:headers="filteredHeaders"
|
|
57
|
+
:items="items"
|
|
58
|
+
:items-length="totalItems"
|
|
59
|
+
:loading="loading"
|
|
60
|
+
:search="search"
|
|
61
|
+
:multi-sort="false"
|
|
62
|
+
item-value="name"
|
|
63
|
+
@update:options="doPaginate"
|
|
64
|
+
>
|
|
65
|
+
|
|
66
|
+
<template v-slot:no-data>
|
|
67
|
+
<v-alert
|
|
68
|
+
v-if="paginationError"
|
|
69
|
+
variant="tonal"
|
|
70
|
+
class="w-100 ma-2"
|
|
71
|
+
style="width: 100%; min-width: 100%"
|
|
72
|
+
prominent
|
|
73
|
+
type="error"
|
|
74
|
+
:text="te(paginationError) ? t(paginationError) : paginationError"
|
|
75
|
+
/>
|
|
76
|
+
<v-alert v-else variant="tonal" class="w-100 ma-2 " type="info" :text="te('crud.noData') ? t('crud.noData') : 'No data' " />
|
|
77
|
+
</template>
|
|
78
|
+
|
|
79
|
+
<template v-slot:bottom>
|
|
80
|
+
<v-data-table-footer :class="entity.footerClass"
|
|
81
|
+
:items-per-page-options="[5, 10, 20, 50]"
|
|
82
|
+
></v-data-table-footer>
|
|
83
|
+
</template>
|
|
84
|
+
|
|
85
|
+
<template v-slot:top>
|
|
86
|
+
<v-toolbar :class="entity.toolbarClass" :density="entity.toolbarDensity">
|
|
87
|
+
<v-toolbar-title>
|
|
88
|
+
{{ te(`${entity.name.toLowerCase()}.crud`) ? t(`${entity.name.toLowerCase()}.crud`) : entity.name }}
|
|
89
|
+
</v-toolbar-title>
|
|
90
|
+
<v-spacer></v-spacer>
|
|
91
|
+
|
|
92
|
+
<slot name="toolbar">
|
|
93
|
+
|
|
94
|
+
</slot>
|
|
95
|
+
|
|
96
|
+
<crud-import-button
|
|
97
|
+
:entity="entity"
|
|
98
|
+
@import="(v:any) => $emit('import', v)"
|
|
99
|
+
/>
|
|
100
|
+
|
|
101
|
+
<crud-export-button
|
|
102
|
+
:entity="entity"
|
|
103
|
+
@export="(v:any) => $emit('export',v)"
|
|
104
|
+
/>
|
|
105
|
+
|
|
106
|
+
<crud-group-by-button
|
|
107
|
+
v-if="entity.isGroupable"
|
|
108
|
+
:entity="entity"
|
|
109
|
+
/>
|
|
110
|
+
|
|
111
|
+
<crud-columns-button
|
|
112
|
+
v-if="entity.isColumnSelectable"
|
|
113
|
+
:entity="entity"
|
|
114
|
+
/>
|
|
115
|
+
|
|
116
|
+
<crud-create-button
|
|
117
|
+
v-if="entity.isCreatable"
|
|
118
|
+
:entity="entity"
|
|
119
|
+
@click="$emit('create')"
|
|
120
|
+
/>
|
|
121
|
+
|
|
122
|
+
</v-toolbar>
|
|
123
|
+
|
|
124
|
+
<crud-export-list
|
|
125
|
+
:entity="entity"
|
|
126
|
+
/>
|
|
127
|
+
|
|
128
|
+
<v-card variant="flat">
|
|
129
|
+
<v-card-text v-if="entity.searchEnable">
|
|
130
|
+
<crud-search
|
|
131
|
+
v-model="search"
|
|
132
|
+
/>
|
|
133
|
+
</v-card-text>
|
|
134
|
+
|
|
135
|
+
<v-card-text class="pt-0">
|
|
136
|
+
<slot name="filters" v-bind="{filters}"></slot>
|
|
137
|
+
|
|
138
|
+
<v-card variant="flat" v-if="!$slots.filters">
|
|
139
|
+
|
|
140
|
+
<crud-filters
|
|
141
|
+
v-if="entity.filtersEnable"
|
|
142
|
+
:entity="entity"
|
|
143
|
+
v-model="filters"
|
|
144
|
+
:auto-filter="!entity.filterButtons"
|
|
145
|
+
@clearFilter="clearFilters()"
|
|
146
|
+
@applyFilter="applyFilters()"
|
|
147
|
+
>
|
|
148
|
+
|
|
149
|
+
<template v-for="iFilter in entity.filters"
|
|
150
|
+
:key="iFilter.name"
|
|
151
|
+
v-slot:[`filter.${iFilter.name}`]="{filter, filterIndex}"
|
|
152
|
+
>
|
|
153
|
+
<slot v-if="$slots[`filter.${iFilter.name}`]"
|
|
154
|
+
:name="`filter.${iFilter.name}`"
|
|
155
|
+
v-bind="{filter, filterIndex}"
|
|
156
|
+
/>
|
|
157
|
+
</template>
|
|
158
|
+
</crud-filters>
|
|
159
|
+
|
|
160
|
+
<crud-filters-dynamic
|
|
161
|
+
v-if="entity.dynamicFiltersEnable"
|
|
162
|
+
:entity="entity"
|
|
163
|
+
v-model="filters"
|
|
164
|
+
:auto-filter="!entity.filterButtons"
|
|
165
|
+
@clearFilter="clearFilters()"
|
|
166
|
+
@applyFilter="applyFilters()"
|
|
167
|
+
>
|
|
168
|
+
</crud-filters-dynamic>
|
|
169
|
+
|
|
170
|
+
<crud-filters-action v-if="entity.filterButtons"
|
|
171
|
+
:entity="entity"
|
|
172
|
+
@clearFilter="clearFilters()"
|
|
173
|
+
@applyFilter="applyFilters()"
|
|
174
|
+
></crud-filters-action>
|
|
175
|
+
</v-card>
|
|
176
|
+
|
|
177
|
+
</v-card-text>
|
|
178
|
+
|
|
179
|
+
</v-card>
|
|
180
|
+
|
|
181
|
+
<v-divider></v-divider>
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
</template>
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
<template v-for="header in entity.headers" :key="header.key" v-slot:[`item.${header.key}`]="{item, value}">
|
|
189
|
+
<slot v-if="$slots[`item.${header.key}`]" :name="`item.${header.key}`" v-bind="{item, value}">
|
|
190
|
+
{{ value }}
|
|
191
|
+
</slot>
|
|
192
|
+
</template>
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
<template v-slot:item.actions="{item}">
|
|
196
|
+
|
|
197
|
+
<slot name="item.actions" v-bind="{item}">
|
|
198
|
+
</slot>
|
|
199
|
+
|
|
200
|
+
<crud-view-button
|
|
201
|
+
v-if="entity.isViewable && hasPermission(entity.permissions.view)"
|
|
202
|
+
@click="$emit('view', item)"
|
|
203
|
+
/>
|
|
204
|
+
|
|
205
|
+
<crud-update-button
|
|
206
|
+
v-if="entity.isEditable && entity.isItemEditable(item) && hasPermission(entity.permissions?.update)"
|
|
207
|
+
@click="$emit('edit', item)"
|
|
208
|
+
/>
|
|
209
|
+
|
|
210
|
+
<crud-delete-button
|
|
211
|
+
v-if="entity.isDeletable && hasPermission(entity.permissions?.delete)"
|
|
212
|
+
@click="$emit('delete', item)"
|
|
213
|
+
/>
|
|
214
|
+
|
|
215
|
+
</template>
|
|
216
|
+
|
|
217
|
+
</v-data-table-server>
|
|
218
|
+
</template>
|
|
219
|
+
|
|
220
|
+
<style scoped>
|
|
221
|
+
|
|
222
|
+
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import {useI18n} from "vue-i18n";
|
|
3
|
-
import {
|
|
3
|
+
import { type PropType, ref} from "vue";
|
|
4
4
|
import type {IEntityCrud} from "@drax/crud-share";
|
|
5
5
|
import CrudForm from "../CrudForm.vue";
|
|
6
6
|
import CrudDialog from "../CrudDialog.vue";
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
IDraxFieldFilter,
|
|
3
|
+
IDraxPaginateResult,
|
|
4
|
+
IEntityCrud,
|
|
5
|
+
IEntityCrudFilter,
|
|
6
|
+
} from "@drax/crud-share";
|
|
2
7
|
import {useCrudStore} from "../stores/UseCrudStore";
|
|
3
8
|
import {computed, nextTick, toRaw} from "vue";
|
|
4
9
|
import getItemId from "../helpers/getItemId";
|
|
5
10
|
import {useI18n} from "vue-i18n";
|
|
11
|
+
import {useRouter} from "vue-router";
|
|
12
|
+
import type {IEntityCrudFilterDynamic} from "@drax/crud-share/types/interfaces/IEntityCrudFilterDynamic";
|
|
6
13
|
|
|
7
14
|
export function useCrud(entity: IEntityCrud) {
|
|
8
15
|
|
|
9
16
|
const store = useCrudStore(entity?.name)
|
|
10
17
|
|
|
18
|
+
const router = useRouter();
|
|
19
|
+
|
|
11
20
|
const {t: $t, te: $te} = useI18n()
|
|
12
21
|
|
|
13
22
|
const exportError = computed({
|
|
@@ -33,6 +42,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
33
42
|
store.setDialog(value)
|
|
34
43
|
}
|
|
35
44
|
})
|
|
45
|
+
|
|
36
46
|
const operation = computed({
|
|
37
47
|
get() {
|
|
38
48
|
return store.operation
|
|
@@ -40,6 +50,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
40
50
|
store.setOperation(value)
|
|
41
51
|
}
|
|
42
52
|
})
|
|
53
|
+
|
|
43
54
|
const form = computed({
|
|
44
55
|
get() {
|
|
45
56
|
return store.form
|
|
@@ -47,6 +58,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
47
58
|
store.setForm(value)
|
|
48
59
|
}
|
|
49
60
|
})
|
|
61
|
+
|
|
50
62
|
const formValid = computed({
|
|
51
63
|
get() {
|
|
52
64
|
return store.formValid
|
|
@@ -54,6 +66,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
54
66
|
store.setFormValid(value)
|
|
55
67
|
}
|
|
56
68
|
})
|
|
69
|
+
|
|
57
70
|
const notify = computed({
|
|
58
71
|
get() {
|
|
59
72
|
return store.notify
|
|
@@ -61,6 +74,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
61
74
|
store.setNotify(value)
|
|
62
75
|
}
|
|
63
76
|
})
|
|
77
|
+
|
|
64
78
|
const error = computed({
|
|
65
79
|
get() {
|
|
66
80
|
return store.error
|
|
@@ -68,6 +82,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
68
82
|
store.setError(value)
|
|
69
83
|
}
|
|
70
84
|
})
|
|
85
|
+
|
|
71
86
|
const message = computed({
|
|
72
87
|
get() {
|
|
73
88
|
return store.message
|
|
@@ -75,6 +90,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
75
90
|
store.setMessage(value)
|
|
76
91
|
}
|
|
77
92
|
})
|
|
93
|
+
|
|
78
94
|
const loading = computed({
|
|
79
95
|
get() {
|
|
80
96
|
return store.loading
|
|
@@ -82,6 +98,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
82
98
|
store.setLoading(value)
|
|
83
99
|
}
|
|
84
100
|
})
|
|
101
|
+
|
|
85
102
|
const itemsPerPage = computed({
|
|
86
103
|
get() {
|
|
87
104
|
return store.itemsPerPage
|
|
@@ -89,6 +106,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
89
106
|
store.setItemsPerPage(value)
|
|
90
107
|
}
|
|
91
108
|
})
|
|
109
|
+
|
|
92
110
|
const page = computed({
|
|
93
111
|
get() {
|
|
94
112
|
return store.page
|
|
@@ -96,6 +114,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
96
114
|
store.setPage(value)
|
|
97
115
|
}
|
|
98
116
|
})
|
|
117
|
+
|
|
99
118
|
const sortBy = computed({
|
|
100
119
|
get() {
|
|
101
120
|
return store.sortBy
|
|
@@ -103,6 +122,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
103
122
|
store.setSortBy(value)
|
|
104
123
|
}
|
|
105
124
|
})
|
|
125
|
+
|
|
106
126
|
const search = computed({
|
|
107
127
|
get() {
|
|
108
128
|
return store.search
|
|
@@ -110,6 +130,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
110
130
|
store.setSearch(value)
|
|
111
131
|
}
|
|
112
132
|
})
|
|
133
|
+
|
|
113
134
|
const totalItems = computed({
|
|
114
135
|
get() {
|
|
115
136
|
return store.totalItems
|
|
@@ -117,6 +138,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
117
138
|
store.setTotalItems(value)
|
|
118
139
|
}
|
|
119
140
|
})
|
|
141
|
+
|
|
120
142
|
const items = computed({
|
|
121
143
|
get() {
|
|
122
144
|
return store.items
|
|
@@ -124,6 +146,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
124
146
|
store.setItems(value)
|
|
125
147
|
}
|
|
126
148
|
})
|
|
149
|
+
|
|
127
150
|
const exportFiles = computed({
|
|
128
151
|
get() {
|
|
129
152
|
return store.exportFiles
|
|
@@ -131,6 +154,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
131
154
|
store.setExportFiles(value)
|
|
132
155
|
}
|
|
133
156
|
})
|
|
157
|
+
|
|
134
158
|
const exportLoading = computed({
|
|
135
159
|
get() {
|
|
136
160
|
return store.exportLoading
|
|
@@ -138,6 +162,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
138
162
|
store.setExportLoading(value)
|
|
139
163
|
}
|
|
140
164
|
})
|
|
165
|
+
|
|
141
166
|
const exportListVisible = computed({
|
|
142
167
|
get() {
|
|
143
168
|
return store.exportListVisible
|
|
@@ -145,6 +170,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
145
170
|
store.setExportListVisible(value)
|
|
146
171
|
}
|
|
147
172
|
})
|
|
173
|
+
|
|
148
174
|
const filters = computed({
|
|
149
175
|
get() {
|
|
150
176
|
return store.filters
|
|
@@ -153,6 +179,24 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
153
179
|
}
|
|
154
180
|
})
|
|
155
181
|
|
|
182
|
+
const prepareDynamicFilters = computed(() => {
|
|
183
|
+
return store.dynamicFilters.map((filter: IEntityCrudFilterDynamic) => {
|
|
184
|
+
return {
|
|
185
|
+
field: filter.name,
|
|
186
|
+
operator: filter.operator,
|
|
187
|
+
value: filter.value
|
|
188
|
+
}
|
|
189
|
+
}) as IDraxFieldFilter[]
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
const getAllFilters = computed(() =>{
|
|
194
|
+
return [
|
|
195
|
+
...store.filters,
|
|
196
|
+
...prepareDynamicFilters.value
|
|
197
|
+
] as IDraxFieldFilter[]
|
|
198
|
+
})
|
|
199
|
+
|
|
156
200
|
|
|
157
201
|
async function doPaginate() {
|
|
158
202
|
store.setLoading(true)
|
|
@@ -165,7 +209,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
165
209
|
orderBy: store.sortBy[0]?.key,
|
|
166
210
|
order: store.sortBy[0]?.order,
|
|
167
211
|
search: store.search,
|
|
168
|
-
filters:
|
|
212
|
+
filters: getAllFilters.value
|
|
169
213
|
})
|
|
170
214
|
store.setItems(r.items)
|
|
171
215
|
store.setTotalItems(r.total)
|
|
@@ -204,7 +248,7 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
204
248
|
orderBy: store.sortBy[0]?.key,
|
|
205
249
|
order: store.sortBy[0]?.order,
|
|
206
250
|
search: store.search,
|
|
207
|
-
filters:
|
|
251
|
+
filters: getAllFilters.value
|
|
208
252
|
})
|
|
209
253
|
|
|
210
254
|
if (r && r.url) {
|
|
@@ -325,6 +369,9 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
325
369
|
await doPaginate()
|
|
326
370
|
closeDialog()
|
|
327
371
|
store.showMessage("Entity created successfully!")
|
|
372
|
+
if(entity.redirectOnCreate){
|
|
373
|
+
router.push(entity.redirectOnCreate(item))
|
|
374
|
+
}
|
|
328
375
|
return {status: 'created', item: item}
|
|
329
376
|
}
|
|
330
377
|
throw new Error("provider.create not implemented")
|
|
@@ -395,7 +442,17 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
395
442
|
}
|
|
396
443
|
|
|
397
444
|
function prepareFilters() {
|
|
398
|
-
|
|
445
|
+
|
|
446
|
+
const staticFilters : IDraxFieldFilter[] = entity.filters.map(
|
|
447
|
+
(filter: IEntityCrudFilter) =>
|
|
448
|
+
({
|
|
449
|
+
field: filter.name,
|
|
450
|
+
value: filter.default ? filter.default : null,
|
|
451
|
+
operator: (filter.operator ? filter.operator : 'eq')
|
|
452
|
+
})
|
|
453
|
+
) as IDraxFieldFilter[]
|
|
454
|
+
|
|
455
|
+
store.setFilters(staticFilters)
|
|
399
456
|
}
|
|
400
457
|
|
|
401
458
|
async function clearFilters() {
|
package/src/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ import EntityCombobox from "./components/combobox/EntityCombobox.vue";
|
|
|
12
12
|
import {useCrudStore} from "./stores/UseCrudStore";
|
|
13
13
|
import {useEntityStore} from "./stores/UseEntityStore";
|
|
14
14
|
import {useCrud} from "./composables/UseCrud";
|
|
15
|
+
import {useFilterIcon} from "./composables/UseFilterIcon";
|
|
15
16
|
import {useFormUtils} from "./composables/UseFormUtils";
|
|
16
17
|
import {useInputErrorI18n} from "./composables/UseInputErrorI18n";
|
|
17
18
|
import {EntityCrud} from "./EntityCrud";
|
|
@@ -32,6 +33,7 @@ export {
|
|
|
32
33
|
useFormUtils,
|
|
33
34
|
useCrudStore,
|
|
34
35
|
useInputErrorI18n,
|
|
36
|
+
useFilterIcon,
|
|
35
37
|
EntityCrud,
|
|
36
38
|
useEntityStore,
|
|
37
39
|
EntityCombobox
|
|
@@ -13,6 +13,7 @@ export const useCrudStore = (id: string = 'entity') => defineStore('CrudStore'+i
|
|
|
13
13
|
error: '' as string,
|
|
14
14
|
paginationError: '' as string,
|
|
15
15
|
filters: [] as IDraxFieldFilter[],
|
|
16
|
+
dynamicFilters: [] as IDraxFieldFilter[],
|
|
16
17
|
items: [] as any[],
|
|
17
18
|
totalItems: 0 as number,
|
|
18
19
|
itemsPerPage: 10 as number,
|
|
@@ -134,6 +135,21 @@ export const useCrudStore = (id: string = 'entity') => defineStore('CrudStore'+i
|
|
|
134
135
|
this.filters[index].value = value
|
|
135
136
|
}
|
|
136
137
|
},
|
|
138
|
+
addDynamicFilter(filter: IDraxFieldFilter) {
|
|
139
|
+
this.dynamicFilters.push(filter)
|
|
140
|
+
},
|
|
141
|
+
removeDynamicFilter(index: number) {
|
|
142
|
+
this.dynamicFilters.splice(index, 1)
|
|
143
|
+
},
|
|
144
|
+
setDynamicFilters(filters: IDraxFieldFilter[]) {
|
|
145
|
+
this.dynamicFilters = filters
|
|
146
|
+
},
|
|
147
|
+
setDynamicFilterValue(name:string, value:any) {
|
|
148
|
+
const index = this.getFilterIndex(name)
|
|
149
|
+
if (index >= 0) {
|
|
150
|
+
this.dynamicFilters[index].value = value
|
|
151
|
+
}
|
|
152
|
+
},
|
|
137
153
|
setVisibleColumns(columns: string[]) {
|
|
138
154
|
this.visibleColumns = columns
|
|
139
155
|
},
|
|
File without changes
|