@drax/crud-vue 2.0.7 → 2.1.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.0
|
|
6
|
+
"version": "2.1.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"module": "./src/index.ts",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"vue-tsc": "^3.2.4",
|
|
51
51
|
"vuetify": "^3.11.8"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "44c490f35d122a1d2f8533f5de0e17dbb4fbaacb"
|
|
54
54
|
}
|
|
@@ -8,6 +8,7 @@ import type {PropType} from "vue";
|
|
|
8
8
|
import {useCrudStore} from "../stores/UseCrudStore";
|
|
9
9
|
import {useCrud} from "../composables/UseCrud";
|
|
10
10
|
import {useAuth} from '@drax/identity-vue'
|
|
11
|
+
import type {ValidationRule} from "vuetify";
|
|
11
12
|
|
|
12
13
|
const {hasPermission} = useAuth()
|
|
13
14
|
const {t, te} = useI18n()
|
|
@@ -125,6 +126,11 @@ const menuInputErrors = computed(() => {
|
|
|
125
126
|
}
|
|
126
127
|
)
|
|
127
128
|
|
|
129
|
+
const rules = computed(() => {
|
|
130
|
+
return (fieldName: string) => {
|
|
131
|
+
return entity.getRule(fieldName) as ValidationRule[] || undefined
|
|
132
|
+
}
|
|
133
|
+
})
|
|
128
134
|
|
|
129
135
|
</script>
|
|
130
136
|
|
|
@@ -165,6 +171,7 @@ const menuInputErrors = computed(() => {
|
|
|
165
171
|
:append-inner-icon="field?.appendInnerIcon"
|
|
166
172
|
:preview="field?.preview"
|
|
167
173
|
:previewHeight="field?.previewHeight"
|
|
174
|
+
:rules="rules(field.name)"
|
|
168
175
|
/>
|
|
169
176
|
</slot>
|
|
170
177
|
|
|
@@ -206,6 +213,7 @@ const menuInputErrors = computed(() => {
|
|
|
206
213
|
:prepend-icon="field?.prependIcon"
|
|
207
214
|
:append-icon="field?.appendIcon"
|
|
208
215
|
:append-inner-icon="field?.appendInnerIcon"
|
|
216
|
+
:rules="rules(field.name)"
|
|
209
217
|
/>
|
|
210
218
|
</slot>
|
|
211
219
|
|
|
@@ -259,6 +267,7 @@ const menuInputErrors = computed(() => {
|
|
|
259
267
|
:prepend-icon="field?.prependIcon"
|
|
260
268
|
:append-icon="field?.appendIcon"
|
|
261
269
|
:append-inner-icon="field?.appendInnerIcon"
|
|
270
|
+
:rules="rules(field.name)"
|
|
262
271
|
/>
|
|
263
272
|
</slot>
|
|
264
273
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import {computed, ref} from "vue";
|
|
3
|
+
import type {ValidationRule} from "vuetify"
|
|
3
4
|
import type {PropType} from "vue";
|
|
4
5
|
import CrudFormList from "./CrudFormList.vue";
|
|
5
6
|
import CrudAutocomplete from "./CrudAutocomplete.vue";
|
|
@@ -15,11 +16,9 @@ const {t, te} = useI18n()
|
|
|
15
16
|
|
|
16
17
|
const {hasPermission} = useAuth()
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
19
|
const valueModel = defineModel<any>({type: [String, Number, Boolean, Object, Array], default: false})
|
|
21
20
|
|
|
22
|
-
const {index, entity, field, disableRules, parentField, errorMessages} = defineProps({
|
|
21
|
+
const {index, entity, field, disableRules, parentField, errorMessages, rules} = defineProps({
|
|
23
22
|
entity: {type: Object as PropType<IEntityCrud>, required: true},
|
|
24
23
|
field: {type: Object as PropType<IEntityCrudField | IEntityCrudFilter | undefined>, required: true},
|
|
25
24
|
prependIcon: {type: String, default: ''},
|
|
@@ -36,6 +35,7 @@ const {index, entity, field, disableRules, parentField, errorMessages} = defineP
|
|
|
36
35
|
previewHeight: {type: String, default: '100px'},
|
|
37
36
|
parentField: {type: String, default: null, required: false},
|
|
38
37
|
errorMessages: {type: Array as PropType<string[]>, default: null, required: false},
|
|
38
|
+
rules: {type: Array as PropType<ValidationRule[]>, required: false},
|
|
39
39
|
index: {type: Number, default: null, required: false},
|
|
40
40
|
density: {type: String as PropType<'comfortable' | 'compact' | 'default'>, default: 'default'},
|
|
41
41
|
variant: {
|
|
@@ -60,10 +60,7 @@ const label = computed(() => {
|
|
|
60
60
|
return te(i18n) ? t(i18n) : field.label
|
|
61
61
|
})
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
if (disableRules) return undefined
|
|
65
|
-
return entity.getRule(field.name) as any
|
|
66
|
-
})
|
|
63
|
+
|
|
67
64
|
|
|
68
65
|
const storeErrorMessages = computed(() => {
|
|
69
66
|
let sIndex = (index != null && index >= 0) ? `${index}.` : ''
|
|
@@ -78,6 +75,7 @@ const inputErrors = computed(() => {
|
|
|
78
75
|
|
|
79
76
|
defineEmits(['updateValue'])
|
|
80
77
|
|
|
78
|
+
|
|
81
79
|
</script>
|
|
82
80
|
|
|
83
81
|
<template>
|