@drax/crud-vue 3.0.0 → 3.2.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 +16 -1
- package/src/components/CrudForm.vue +9 -0
- package/src/components/CrudFormField.vue +6 -2
- package/src/components/CrudList.vue +6 -1
- package/src/components/CrudListGallery.vue +38 -26
- package/src/components/CrudListTable.vue +7 -2
- package/src/components/buttons/CrudFilterButton.vue +42 -0
- package/src/composables/UseCrud.ts +6 -1
- package/src/index.ts +4 -0
- package/src/stores/UseCrudStore.ts +22 -2
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "3.
|
|
6
|
+
"version": "3.2.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"module": "./src/index.ts",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@drax/common-front": "^3.0.0",
|
|
28
28
|
"@drax/crud-front": "^3.0.0",
|
|
29
|
-
"@drax/crud-share": "^3.
|
|
30
|
-
"@drax/media-vue": "^3.
|
|
29
|
+
"@drax/crud-share": "^3.2.0",
|
|
30
|
+
"@drax/media-vue": "^3.2.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"pinia": "^3.0.4",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"vue-tsc": "^3.2.4",
|
|
51
51
|
"vuetify": "^3.11.8"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "8446a621e05bc1f4fd080c814a3ebdd7ae8a626b"
|
|
54
54
|
}
|
package/src/EntityCrud.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
IEntityCrud, IEntityCrudForm, IEntityCrudHeader, IEntityCrudRefs,
|
|
3
3
|
IEntityCrudRules, IEntityCrudField, IEntityCrudPermissions,
|
|
4
|
-
IDraxCrudProvider, IEntityCrudFilter, IEntityCrudFieldVariant, IDraxFieldFilter
|
|
4
|
+
IDraxCrudProvider, IEntityCrudFilter, IEntityCrudFieldVariant, IDraxFieldFilter,
|
|
5
|
+
IEntityCrudOnInput
|
|
5
6
|
} from "@drax/crud-share";
|
|
6
7
|
|
|
7
8
|
|
|
@@ -149,10 +150,20 @@ class EntityCrud implements IEntityCrud {
|
|
|
149
150
|
return {}
|
|
150
151
|
}
|
|
151
152
|
|
|
153
|
+
|
|
154
|
+
|
|
152
155
|
getRule(field: string | undefined): Array<Function> | undefined {
|
|
153
156
|
return field && this.rules[field] && this.rules[field].length > 0 ? this.rules[field] : undefined
|
|
154
157
|
}
|
|
155
158
|
|
|
159
|
+
get onInputs(): IEntityCrudOnInput {
|
|
160
|
+
return {}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
getOnInput(field: string | undefined): Function | undefined {
|
|
164
|
+
return (field && this.onInputs[field] && typeof this.onInputs[field] === 'function') ? this.onInputs[field] : undefined
|
|
165
|
+
}
|
|
166
|
+
|
|
156
167
|
get isViewable() {
|
|
157
168
|
return true
|
|
158
169
|
}
|
|
@@ -209,6 +220,10 @@ class EntityCrud implements IEntityCrud {
|
|
|
209
220
|
return false
|
|
210
221
|
}
|
|
211
222
|
|
|
223
|
+
get isFilterable(){
|
|
224
|
+
return true
|
|
225
|
+
}
|
|
226
|
+
|
|
212
227
|
get dialogFullscreen() {
|
|
213
228
|
return false
|
|
214
229
|
}
|
|
@@ -132,6 +132,12 @@ const rules = computed(() => {
|
|
|
132
132
|
}
|
|
133
133
|
})
|
|
134
134
|
|
|
135
|
+
const onInput = computed(() => {
|
|
136
|
+
return (fieldName: string) => {
|
|
137
|
+
return entity?.getOnInput(fieldName) as Function || undefined
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
|
|
135
141
|
const onlyView = computed(()=> {
|
|
136
142
|
return ['delete','view'].includes(operation?.value)
|
|
137
143
|
})
|
|
@@ -177,6 +183,7 @@ const onlyView = computed(()=> {
|
|
|
177
183
|
:preview="field?.preview"
|
|
178
184
|
:previewHeight="field?.previewHeight"
|
|
179
185
|
:rules="rules(field.name)"
|
|
186
|
+
:on-input="onInput(field.name)"
|
|
180
187
|
:hint="field.hint"
|
|
181
188
|
:persistent-hint="field.persistentHint"
|
|
182
189
|
:placeholder="field.placeholder"
|
|
@@ -226,6 +233,7 @@ const onlyView = computed(()=> {
|
|
|
226
233
|
:append-icon="field?.appendIcon"
|
|
227
234
|
:append-inner-icon="field?.appendInnerIcon"
|
|
228
235
|
:rules="rules(field.name)"
|
|
236
|
+
:on-input="onInput(field.name)"
|
|
229
237
|
:hint="field.hint"
|
|
230
238
|
:persistent-hint="field.persistentHint"
|
|
231
239
|
:placeholder="field.placeholder"
|
|
@@ -284,6 +292,7 @@ const onlyView = computed(()=> {
|
|
|
284
292
|
:append-icon="field?.appendIcon"
|
|
285
293
|
:append-inner-icon="field?.appendInnerIcon"
|
|
286
294
|
:rules="rules(field.name)"
|
|
295
|
+
:on-input="onInput(field.name)"
|
|
287
296
|
:hint="field.hint"
|
|
288
297
|
:persistent-hint="field.persistentHint"
|
|
289
298
|
:placeholder="field.placeholder"
|
|
@@ -23,7 +23,7 @@ const {hasPermission} = useAuth()
|
|
|
23
23
|
|
|
24
24
|
const valueModel = defineModel<any>({type: [String, Number, Boolean, Object, Array], default: false})
|
|
25
25
|
|
|
26
|
-
const {index, entity, field, parentField, errorMessages, rules, readonly, hideDetails} = defineProps({
|
|
26
|
+
const {index, entity, field, parentField, errorMessages, rules, onInput, readonly, hideDetails} = defineProps({
|
|
27
27
|
entity: {type: Object as PropType<IEntityCrud>, required: true},
|
|
28
28
|
field: {type: Object as PropType<IEntityCrudField | IEntityCrudFilter | undefined>, required: true},
|
|
29
29
|
prependIcon: {type: String, default: ''},
|
|
@@ -43,6 +43,7 @@ const {index, entity, field, parentField, errorMessages, rules, readonly, hideDe
|
|
|
43
43
|
previewHeight: {type: String, default: '100px'},
|
|
44
44
|
parentField: {type: String, default: null, required: false},
|
|
45
45
|
errorMessages: {type: Array as PropType<string[]>, default: null, required: false},
|
|
46
|
+
onInput: {type: Function as PropType<Function>, required: false},
|
|
46
47
|
rules: {type: Array as PropType<ValidationRule[]>, required: false},
|
|
47
48
|
index: {type: Number, default: null, required: false},
|
|
48
49
|
density: {type: String as PropType<'comfortable' | 'compact' | 'default'>, default: 'default'},
|
|
@@ -120,6 +121,7 @@ const hasHideDetails = computed(()=>{
|
|
|
120
121
|
:append-icon="appendIcon"
|
|
121
122
|
:prepend-inner-icon="prependInnerIcon"
|
|
122
123
|
:append-inner-icon="appendInnerIcon"
|
|
124
|
+
@input="onInput"
|
|
123
125
|
@update:modelValue="$emit('updateValue')"
|
|
124
126
|
/>
|
|
125
127
|
|
|
@@ -146,6 +148,7 @@ const hasHideDetails = computed(()=>{
|
|
|
146
148
|
:append-icon="appendIcon"
|
|
147
149
|
:prepend-inner-icon="prependInnerIcon"
|
|
148
150
|
:append-inner-icon="appendInnerIcon"
|
|
151
|
+
@input="onInput"
|
|
149
152
|
@update:modelValue="$emit('updateValue')"
|
|
150
153
|
/>
|
|
151
154
|
|
|
@@ -169,10 +172,11 @@ const hasHideDetails = computed(()=>{
|
|
|
169
172
|
:prepend-icon="prependIcon"
|
|
170
173
|
:append-icon="appendIcon"
|
|
171
174
|
:prepend-inner-icon="prependInnerIcon"
|
|
172
|
-
@update:modelValue="$emit('updateValue')"
|
|
173
175
|
:type="show ? 'text' : 'password'"
|
|
174
176
|
:append-inner-icon="show ? 'mdi-eye' : 'mdi-eye-off'"
|
|
175
177
|
@click:append-inner="show = !show"
|
|
178
|
+
@input="onInput"
|
|
179
|
+
@update:modelValue="$emit('updateValue')"
|
|
176
180
|
/>
|
|
177
181
|
|
|
178
182
|
|
|
@@ -11,6 +11,7 @@ import CrudDeleteButton from "./buttons/CrudDeleteButton.vue";
|
|
|
11
11
|
import CrudViewButton from "./buttons/CrudViewButton.vue";
|
|
12
12
|
import CrudGroupByButton from "./buttons/CrudGroupByButton.vue";
|
|
13
13
|
import CrudColumnsButton from "./buttons/CrudColumnsButton.vue";
|
|
14
|
+
import CrudFilterButton from "./buttons/CrudFilterButton.vue";
|
|
14
15
|
import CrudExportList from "./CrudExportList.vue";
|
|
15
16
|
import type {IEntityCrud} from "@drax/crud-share";
|
|
16
17
|
import {useI18n} from "vue-i18n";
|
|
@@ -19,6 +20,7 @@ import { useCrudColumns } from "../composables/UseCrudColumns";
|
|
|
19
20
|
import CrudFiltersDynamic from "./CrudFiltersDynamic.vue";
|
|
20
21
|
import CrudFiltersAction from "./CrudFiltersAction.vue";
|
|
21
22
|
|
|
23
|
+
|
|
22
24
|
const {t, te} = useI18n()
|
|
23
25
|
const {hasPermission} = useAuth()
|
|
24
26
|
|
|
@@ -90,7 +92,6 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
|
|
|
90
92
|
<v-spacer></v-spacer>
|
|
91
93
|
|
|
92
94
|
<slot name="toolbar">
|
|
93
|
-
|
|
94
95
|
</slot>
|
|
95
96
|
|
|
96
97
|
<crud-import-button
|
|
@@ -108,6 +109,10 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
|
|
|
108
109
|
:entity="entity"
|
|
109
110
|
/>
|
|
110
111
|
|
|
112
|
+
|
|
113
|
+
<crud-filter-button
|
|
114
|
+
:entity="entity" />
|
|
115
|
+
|
|
111
116
|
<crud-columns-button
|
|
112
117
|
v-if="entity.isColumnSelectable"
|
|
113
118
|
:entity="entity"
|
|
@@ -19,6 +19,7 @@ import CrudFilters from "./CrudFilters.vue";
|
|
|
19
19
|
import {useCrudColumns} from "../composables/UseCrudColumns";
|
|
20
20
|
import CrudFiltersDynamic from "./CrudFiltersDynamic.vue";
|
|
21
21
|
import CrudFiltersAction from "./CrudFiltersAction.vue";
|
|
22
|
+
import CrudFilterButton from "./buttons/CrudFilterButton.vue";
|
|
22
23
|
|
|
23
24
|
const {t, te} = useI18n()
|
|
24
25
|
const {hasPermission} = useAuth()
|
|
@@ -29,7 +30,8 @@ const {entity} = defineProps({
|
|
|
29
30
|
|
|
30
31
|
const {
|
|
31
32
|
loading, itemsPerPage, page, search, totalItems, items,
|
|
32
|
-
doPaginate, filters, applyFilters, clearFilters, paginationError
|
|
33
|
+
doPaginate, filters, applyFilters, clearFilters, paginationError,
|
|
34
|
+
isDynamicFiltersEnable
|
|
33
35
|
} = useCrud(entity)
|
|
34
36
|
|
|
35
37
|
// Usar el composable de columnas
|
|
@@ -51,40 +53,50 @@ onMounted(() => {
|
|
|
51
53
|
<template>
|
|
52
54
|
<div v-if="hasPermission(entity.permissions.view)" class="d-flex flex-column h-100 pb-4">
|
|
53
55
|
<!-- Toolbar -->
|
|
54
|
-
<v-toolbar :class="entity.toolbarClass" :density="entity.toolbarDensity">
|
|
56
|
+
<v-toolbar :class="entity.toolbarClass" :density="entity.toolbarDensity" extended>
|
|
55
57
|
<v-toolbar-title>
|
|
56
58
|
{{ te(`${entity.name.toLowerCase()}.crud`) ? t(`${entity.name.toLowerCase()}.crud`) : entity.name }}
|
|
57
59
|
</v-toolbar-title>
|
|
58
60
|
<v-spacer></v-spacer>
|
|
61
|
+
<template v-slot:extension>
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
<v-row justify="end" class="px-2 border-t-sm" >
|
|
64
|
+
<slot name="toolbar">
|
|
65
|
+
</slot>
|
|
62
66
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
<crud-import-button
|
|
68
|
+
:entity="entity"
|
|
69
|
+
@import="(v:any) => $emit('import', v)"
|
|
70
|
+
/>
|
|
67
71
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
<crud-export-button
|
|
73
|
+
:entity="entity"
|
|
74
|
+
@export="(v:any) => $emit('export',v)"
|
|
75
|
+
/>
|
|
72
76
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
<crud-group-by-button
|
|
78
|
+
v-if="entity.isGroupable"
|
|
79
|
+
:entity="entity"
|
|
80
|
+
/>
|
|
81
|
+
|
|
82
|
+
<crud-filter-button
|
|
83
|
+
:entity="entity" />
|
|
84
|
+
|
|
85
|
+
<crud-columns-button
|
|
86
|
+
v-if="entity.isColumnSelectable"
|
|
87
|
+
:entity="entity"
|
|
88
|
+
/>
|
|
89
|
+
|
|
90
|
+
<crud-create-button
|
|
91
|
+
v-if="entity.isCreatable"
|
|
92
|
+
:entity="entity"
|
|
93
|
+
@click="$emit('create')"
|
|
94
|
+
/>
|
|
95
|
+
</v-row>
|
|
96
|
+
|
|
97
|
+
</template>
|
|
77
98
|
|
|
78
|
-
<crud-columns-button
|
|
79
|
-
v-if="entity.isColumnSelectable"
|
|
80
|
-
:entity="entity"
|
|
81
|
-
/>
|
|
82
99
|
|
|
83
|
-
<crud-create-button
|
|
84
|
-
v-if="entity.isCreatable"
|
|
85
|
-
:entity="entity"
|
|
86
|
-
@click="$emit('create')"
|
|
87
|
-
/>
|
|
88
100
|
</v-toolbar>
|
|
89
101
|
|
|
90
102
|
<crud-export-list
|
|
@@ -124,7 +136,7 @@ onMounted(() => {
|
|
|
124
136
|
</crud-filters>
|
|
125
137
|
|
|
126
138
|
<crud-filters-dynamic
|
|
127
|
-
v-if="
|
|
139
|
+
v-if="isDynamicFiltersEnable"
|
|
128
140
|
:entity="entity"
|
|
129
141
|
v-model="filters"
|
|
130
142
|
:auto-filter="!entity.filterButtons"
|
|
@@ -18,6 +18,7 @@ import CrudFilters from "./CrudFilters.vue";
|
|
|
18
18
|
import { useCrudColumns } from "../composables/UseCrudColumns";
|
|
19
19
|
import CrudFiltersDynamic from "./CrudFiltersDynamic.vue";
|
|
20
20
|
import CrudFiltersAction from "./CrudFiltersAction.vue";
|
|
21
|
+
import CrudFilterButton from "./buttons/CrudFilterButton.vue";
|
|
21
22
|
|
|
22
23
|
const {t, te} = useI18n()
|
|
23
24
|
const {hasPermission} = useAuth()
|
|
@@ -28,7 +29,8 @@ const {entity} = defineProps({
|
|
|
28
29
|
|
|
29
30
|
const {
|
|
30
31
|
loading, itemsPerPage, page, sortBy, search, totalItems, items,
|
|
31
|
-
doPaginate, filters, applyFilters, clearFilters, paginationError
|
|
32
|
+
doPaginate, filters, applyFilters, clearFilters, paginationError,
|
|
33
|
+
isDynamicFiltersEnable
|
|
32
34
|
} = useCrud(entity)
|
|
33
35
|
|
|
34
36
|
// Usar el composable de columnas
|
|
@@ -108,6 +110,9 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
|
|
|
108
110
|
:entity="entity"
|
|
109
111
|
/>
|
|
110
112
|
|
|
113
|
+
<crud-filter-button
|
|
114
|
+
:entity="entity" />
|
|
115
|
+
|
|
111
116
|
<crud-columns-button
|
|
112
117
|
v-if="entity.isColumnSelectable"
|
|
113
118
|
:entity="entity"
|
|
@@ -158,7 +163,7 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
|
|
|
158
163
|
</crud-filters>
|
|
159
164
|
|
|
160
165
|
<crud-filters-dynamic
|
|
161
|
-
v-if="
|
|
166
|
+
v-if="isDynamicFiltersEnable"
|
|
162
167
|
:entity="entity"
|
|
163
168
|
v-model="filters"
|
|
164
169
|
:auto-filter="!entity.filterButtons"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {useI18n} from "vue-i18n";
|
|
3
|
+
import {computed} from "vue";
|
|
4
|
+
import type {PropType} from "vue";
|
|
5
|
+
import type {IEntityCrud} from "@drax/crud-share";
|
|
6
|
+
import {useCrudStore} from "../../stores/UseCrudStore";
|
|
7
|
+
|
|
8
|
+
const {entity} = defineProps({
|
|
9
|
+
entity: {type: Object as PropType<IEntityCrud>, required: true},
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
const store = useCrudStore(entity?.name)
|
|
13
|
+
|
|
14
|
+
let dynamicFiltersEnable = computed({
|
|
15
|
+
get: () => store.dynamicFiltersEnable,
|
|
16
|
+
set: (value: boolean) => store.setDynamicFiltersEnable(value)
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const {t} = useI18n()
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<div v-if="entity.isFilterable">
|
|
24
|
+
<v-tooltip location="top">
|
|
25
|
+
<template v-slot:activator="{ props }">
|
|
26
|
+
<v-btn
|
|
27
|
+
v-bind="{ ...$attrs, ...props }"
|
|
28
|
+
:icon="dynamicFiltersEnable ? 'mdi-filter-off' : 'mdi-filter' "
|
|
29
|
+
class="mr-1"
|
|
30
|
+
variant="text"
|
|
31
|
+
@click="dynamicFiltersEnable = !dynamicFiltersEnable"
|
|
32
|
+
>
|
|
33
|
+
</v-btn>
|
|
34
|
+
</template>
|
|
35
|
+
{{ t('action.filters') }}
|
|
36
|
+
</v-tooltip>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<style scoped>
|
|
41
|
+
|
|
42
|
+
</style>
|
|
@@ -19,6 +19,10 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
19
19
|
|
|
20
20
|
const {t: $t, te: $te} = useI18n()
|
|
21
21
|
|
|
22
|
+
const isDynamicFiltersEnable = computed(() => {
|
|
23
|
+
return entity.dynamicFiltersEnable && store.dynamicFiltersEnable
|
|
24
|
+
})
|
|
25
|
+
|
|
22
26
|
const exportError = computed({
|
|
23
27
|
get() {
|
|
24
28
|
return store.exportError
|
|
@@ -477,7 +481,8 @@ export function useCrud(entity: IEntityCrud) {
|
|
|
477
481
|
loading, itemsPerPage, page, sortBy, search, totalItems, items,
|
|
478
482
|
prepareFilters, filters, clearFilters, applyFilters,
|
|
479
483
|
exportFiles, exportLoading, exportListVisible, exportError,
|
|
480
|
-
cloneItem, cast, prepareEdit
|
|
484
|
+
cloneItem, cast, prepareEdit,
|
|
485
|
+
isDynamicFiltersEnable
|
|
481
486
|
}
|
|
482
487
|
|
|
483
488
|
}
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,8 @@ import CrudForm from "./components/CrudForm.vue";
|
|
|
4
4
|
import CrudFormField from "./components/CrudFormField.vue";
|
|
5
5
|
import CrudFormList from "./components/CrudFormList.vue";
|
|
6
6
|
import CrudList from "./components/CrudList.vue";
|
|
7
|
+
import CrudListTable from "./components/CrudListTable.vue";
|
|
8
|
+
import CrudListGallery from "./components/CrudListGallery.vue";
|
|
7
9
|
import CrudFilters from "./components/CrudFilters.vue";
|
|
8
10
|
import CrudNotify from "./components/CrudNotify.vue";
|
|
9
11
|
import CrudSearch from "./components/CrudSearch.vue";
|
|
@@ -25,6 +27,8 @@ export {
|
|
|
25
27
|
CrudFormField,
|
|
26
28
|
CrudFormList,
|
|
27
29
|
CrudList,
|
|
30
|
+
CrudListTable,
|
|
31
|
+
CrudListGallery,
|
|
28
32
|
CrudNotify,
|
|
29
33
|
CrudSearch,
|
|
30
34
|
CrudAutocomplete,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {defineStore} from "pinia";
|
|
2
|
-
import type {IEntityCrudOperation, IDraxFieldFilter} from "@drax/crud-share";
|
|
2
|
+
import type {IEntityCrudOperation, IDraxFieldFilter, IEntityCrudFilter} from "@drax/crud-share";
|
|
3
3
|
|
|
4
4
|
export const useCrudStore = (id: string = 'entity') => defineStore('CrudStore'+id, {
|
|
5
5
|
state: () => (
|
|
@@ -13,7 +13,16 @@ 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: [
|
|
16
|
+
dynamicFilters: [{
|
|
17
|
+
default: undefined,
|
|
18
|
+
label: "",
|
|
19
|
+
name: "",
|
|
20
|
+
operator: "eq",
|
|
21
|
+
type: "string",
|
|
22
|
+
permission: "",
|
|
23
|
+
value: ""
|
|
24
|
+
}] as IEntityCrudFilter[],
|
|
25
|
+
dynamicFiltersEnable: false as boolean,
|
|
17
26
|
items: [] as any[],
|
|
18
27
|
totalItems: 0 as number,
|
|
19
28
|
itemsPerPage: 10 as number,
|
|
@@ -30,6 +39,14 @@ export const useCrudStore = (id: string = 'entity') => defineStore('CrudStore'+i
|
|
|
30
39
|
}
|
|
31
40
|
),
|
|
32
41
|
getters: {
|
|
42
|
+
getFieldValue(state: any) {
|
|
43
|
+
return (fieldName: string) => {
|
|
44
|
+
if (fieldName && state.form[fieldName]) {
|
|
45
|
+
return state.form[fieldName]
|
|
46
|
+
}
|
|
47
|
+
return undefined
|
|
48
|
+
}
|
|
49
|
+
},
|
|
33
50
|
getFieldInputErrors(state: any) {
|
|
34
51
|
return (fieldName: string) => {
|
|
35
52
|
if (state.inputErrors && state.inputErrors[fieldName]) {
|
|
@@ -150,6 +167,9 @@ export const useCrudStore = (id: string = 'entity') => defineStore('CrudStore'+i
|
|
|
150
167
|
this.dynamicFilters[index].value = value
|
|
151
168
|
}
|
|
152
169
|
},
|
|
170
|
+
setDynamicFiltersEnable(enable: boolean) {
|
|
171
|
+
this.dynamicFiltersEnable = enable
|
|
172
|
+
},
|
|
153
173
|
setVisibleColumns(columns: string[]) {
|
|
154
174
|
this.visibleColumns = columns
|
|
155
175
|
},
|