@drax/crud-vue 2.11.0 → 3.0.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": "
|
|
6
|
+
"version": "3.0.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"module": "./src/index.ts",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"format": "prettier --write src/"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@drax/common-front": "^
|
|
28
|
-
"@drax/crud-front": "^
|
|
29
|
-
"@drax/crud-share": "^
|
|
30
|
-
"@drax/media-vue": "^
|
|
27
|
+
"@drax/common-front": "^3.0.0",
|
|
28
|
+
"@drax/crud-front": "^3.0.0",
|
|
29
|
+
"@drax/crud-share": "^3.0.0",
|
|
30
|
+
"@drax/media-vue": "^3.0.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": "63ae718b24ea25ae80b1a9a5dfb84a3abbb95199"
|
|
54
54
|
}
|
|
@@ -7,9 +7,9 @@ import {useAuth} from "@drax/identity-vue";
|
|
|
7
7
|
import {useFilterIcon} from "../composables/UseFilterIcon";
|
|
8
8
|
import {useCrudStore} from "../stores/UseCrudStore";
|
|
9
9
|
import {useEntityStore} from "../stores/UseEntityStore";
|
|
10
|
-
import {useDynamicFilters} from "../composables/UseDynamicFilters
|
|
10
|
+
import {useDynamicFilters} from "../composables/UseDynamicFilters";
|
|
11
11
|
|
|
12
|
-
const {t
|
|
12
|
+
const {t} = useI18n()
|
|
13
13
|
const valueModel = defineModel({type: [Object]})
|
|
14
14
|
const {hasPermission} = useAuth()
|
|
15
15
|
const {filterIcon} = useFilterIcon()
|
|
@@ -65,6 +65,30 @@ function onUpdateValue() {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
function numericIndex(index: string | number) {
|
|
69
|
+
return typeof index === 'number' ? index : Number(index)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function getDynamicFilter(index: string | number) {
|
|
73
|
+
return dynamicFilter.value(numericIndex(index))
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function updateDynamicField(index: string | number, resetOperator = false) {
|
|
77
|
+
onUpdateField(numericIndex(index), resetOperator)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function getDynamicOperations(index: string | number) {
|
|
81
|
+
return getOperations.value(numericIndex(index))
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function dynamicValueRequired(index: string | number) {
|
|
85
|
+
return isValueRequired.value(numericIndex(index))
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function deleteFilter(index: string | number) {
|
|
89
|
+
removeFilter(numericIndex(index))
|
|
90
|
+
}
|
|
91
|
+
|
|
68
92
|
|
|
69
93
|
|
|
70
94
|
const emit = defineEmits(['applyFilter', 'clearFilter'])
|
|
@@ -81,31 +105,31 @@ const emit = defineEmits(['applyFilter', 'clearFilter'])
|
|
|
81
105
|
<v-col cols="12" sm="4">
|
|
82
106
|
<v-select
|
|
83
107
|
:items="selectableFields"
|
|
84
|
-
v-model="
|
|
108
|
+
v-model="getDynamicFilter(index)!.name"
|
|
85
109
|
:label="t('crud.field')"
|
|
86
110
|
density="compact"
|
|
87
111
|
variant="outlined"
|
|
88
112
|
hide-details
|
|
89
|
-
@update:modelValue="(
|
|
113
|
+
@update:modelValue="(_v:string) => updateDynamicField(index, true)"
|
|
90
114
|
/>
|
|
91
115
|
</v-col>
|
|
92
116
|
<v-col cols="12" sm="3">
|
|
93
117
|
<v-select
|
|
94
|
-
:items="
|
|
95
|
-
v-model="
|
|
118
|
+
:items="getDynamicOperations(index)"
|
|
119
|
+
v-model="getDynamicFilter(index)!.operator"
|
|
96
120
|
:label="t('crud.operator')"
|
|
97
121
|
density="compact"
|
|
98
122
|
variant="outlined"
|
|
99
123
|
hide-details
|
|
100
|
-
@update:modelValue="(
|
|
124
|
+
@update:modelValue="(_v:string) => updateDynamicField(index)"
|
|
101
125
|
/>
|
|
102
126
|
</v-col>
|
|
103
127
|
<v-col cols="10" sm="4">
|
|
104
128
|
<crud-form-field
|
|
105
|
-
v-if="
|
|
129
|
+
v-if="dynamicValueRequired(index)"
|
|
106
130
|
:field="filter"
|
|
107
131
|
:entity="entity"
|
|
108
|
-
v-model="
|
|
132
|
+
v-model="getDynamicFilter(index)!.value"
|
|
109
133
|
:clearable="true"
|
|
110
134
|
density="compact"
|
|
111
135
|
variant="outlined"
|
|
@@ -115,7 +139,7 @@ const emit = defineEmits(['applyFilter', 'clearFilter'])
|
|
|
115
139
|
/>
|
|
116
140
|
</v-col>
|
|
117
141
|
<v-col cols="2" sm="1">
|
|
118
|
-
<v-btn @click="
|
|
142
|
+
<v-btn @click="deleteFilter(index)"
|
|
119
143
|
icon="mdi-delete"
|
|
120
144
|
class="mr-1"
|
|
121
145
|
variant="text"
|
|
@@ -9,9 +9,14 @@ import {useI18n} from "vue-i18n";
|
|
|
9
9
|
import {useCrudStore} from "../stores/UseCrudStore";
|
|
10
10
|
import {VDateInput} from 'vuetify/labs/VDateInput'
|
|
11
11
|
import type {IEntityCrud, IEntityCrudField, IEntityCrudFilter} from "@drax/crud-share";
|
|
12
|
-
import {MediaField, MediaFullField} from "@drax/media-vue";
|
|
13
12
|
import {useAuth} from "@drax/identity-vue";
|
|
14
13
|
|
|
14
|
+
//TODO: Ver si esto no puede traer problemas...
|
|
15
|
+
import MediaField from "@drax/media-vue/src/components/MediaField.vue";
|
|
16
|
+
import MediaFullField from "@drax/media-vue/src/components/MediaFullField.vue";
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
15
20
|
const {t, te} = useI18n()
|
|
16
21
|
|
|
17
22
|
const {hasPermission} = useAuth()
|