@drax/crud-vue 0.7.5 → 0.7.9
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": "0.7.
|
|
6
|
+
"version": "0.7.9",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"module": "./src/index.ts",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"vue-tsc": "^2.0.11",
|
|
65
65
|
"vuetify": "^3.7.1"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "5bd2bed4505a337ecd69918593ba8d43327ed290"
|
|
68
68
|
}
|
package/src/components/Crud.vue
CHANGED
|
@@ -36,6 +36,12 @@ onBeforeMount(() => {
|
|
|
36
36
|
@export="doExport"
|
|
37
37
|
@view="onView"
|
|
38
38
|
>
|
|
39
|
+
|
|
40
|
+
<template v-slot:toolbar>
|
|
41
|
+
<slot name="toolbar">
|
|
42
|
+
</slot>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
39
45
|
<template v-for="header in entity.headers" :key="header.key" v-slot:[`item.${header.key}`]="{item, value}">
|
|
40
46
|
<slot :name="`item.${header.key}`" v-bind="{item, value}">
|
|
41
47
|
{{ (Array.isArray(value) && value.length > 0) || !Array.isArray(value) ? value : '' }}
|
|
@@ -24,7 +24,6 @@ const emit = defineEmits(['submit', 'cancel'])
|
|
|
24
24
|
|
|
25
25
|
const store = useCrudStore()
|
|
26
26
|
|
|
27
|
-
const valid = ref()
|
|
28
27
|
const formRef = ref()
|
|
29
28
|
|
|
30
29
|
const fields = computed(() => {
|
|
@@ -53,11 +52,12 @@ async function submit() {
|
|
|
53
52
|
return
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
await formRef.value.validate()
|
|
57
|
-
|
|
55
|
+
const {valid, errors} = await formRef.value.validate()
|
|
56
|
+
|
|
57
|
+
if(valid) {
|
|
58
58
|
emit('submit',valueModel.value)
|
|
59
59
|
}else{
|
|
60
|
-
console.log('Invalid form')
|
|
60
|
+
console.log('Invalid form', errors)
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -73,7 +73,7 @@ const {
|
|
|
73
73
|
</script>
|
|
74
74
|
|
|
75
75
|
<template>
|
|
76
|
-
<v-form
|
|
76
|
+
<v-form ref="formRef" @submit.prevent >
|
|
77
77
|
<v-card flat>
|
|
78
78
|
|
|
79
79
|
<v-card-subtitle v-if="valueModel._id">ID: {{valueModel._id}}</v-card-subtitle>
|
|
@@ -43,7 +43,7 @@ if (!field) {
|
|
|
43
43
|
|
|
44
44
|
const show = ref(false)
|
|
45
45
|
|
|
46
|
-
const name = computed(() => index >= 0 ? `${field.name}_${index}` : field.name)
|
|
46
|
+
const name = computed(() => index >= 0 ? `${parentField ? parentField + "_" : ""}${field.name}_${index}` : `${parentField ? parentField + "_" : ""}${field.name}`)
|
|
47
47
|
|
|
48
48
|
const label = computed(() => {
|
|
49
49
|
const i18n = `${entity.name}.field.${field.name}`
|