@drax/crud-vue 0.15.6 → 0.15.7
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.15.
|
|
6
|
+
"version": "0.15.7",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"module": "./src/index.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@drax/common-front": "^0.15.0",
|
|
28
28
|
"@drax/crud-front": "^0.15.0",
|
|
29
|
-
"@drax/crud-share": "^0.15.
|
|
29
|
+
"@drax/crud-share": "^0.15.7",
|
|
30
30
|
"@drax/media-vue": "^0.15.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"vue-tsc": "^2.1.10",
|
|
65
65
|
"vuetify": "^3.8.2"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "a028ac1c1aa875880e6b7de4f9fbacdc9f0e54ea"
|
|
68
68
|
}
|
|
@@ -27,7 +27,7 @@ const store = useCrudStore()
|
|
|
27
27
|
const formRef = ref()
|
|
28
28
|
|
|
29
29
|
const tabSelected = ref()
|
|
30
|
-
const menuSelected = ref(
|
|
30
|
+
const menuSelected = ref<string>()
|
|
31
31
|
|
|
32
32
|
const fields = computed(() => {
|
|
33
33
|
if (operation.value === 'create') {
|
|
@@ -48,15 +48,15 @@ const aFields = computed(() => {
|
|
|
48
48
|
})
|
|
49
49
|
|
|
50
50
|
const generalFields = computed(() => {
|
|
51
|
-
return aFields.value.filter((field: IEntityCrudField) => !field.
|
|
51
|
+
return aFields.value.filter((field: IEntityCrudField) => !field.groupTab && !field.groupMenu)
|
|
52
52
|
})
|
|
53
53
|
|
|
54
54
|
const tabFields = computed(() => {
|
|
55
|
-
return (tab: string): IEntityCrudField[] => aFields.value.filter((field: IEntityCrudField) => field.
|
|
55
|
+
return (tab: string): IEntityCrudField[] => aFields.value.filter((field: IEntityCrudField) => field.groupTab === tab)
|
|
56
56
|
})
|
|
57
57
|
|
|
58
58
|
const menuFields = computed(() => {
|
|
59
|
-
return (menu: string | null): IEntityCrudField[] => aFields.value.filter((field: IEntityCrudField) => field.
|
|
59
|
+
return (menu: string | null): IEntityCrudField[] => aFields.value.filter((field: IEntityCrudField) => field.groupMenu === menu)
|
|
60
60
|
})
|
|
61
61
|
|
|
62
62
|
const menuMaxHeight = computed(() => {
|
|
@@ -102,6 +102,20 @@ const {
|
|
|
102
102
|
variant, submitColor
|
|
103
103
|
} = useFormUtils(operation.value)
|
|
104
104
|
|
|
105
|
+
const tabInputErrors = computed(() => {
|
|
106
|
+
return (tab:string) => {
|
|
107
|
+
return tabFields.value(tab).some((field: IEntityCrudField) => store.getFieldInputErrors(field.name).length > 0)
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
const menuInputErrors = computed(() => {
|
|
113
|
+
return (tab:string) => {
|
|
114
|
+
return menuFields.value(tab).some((field: IEntityCrudField) => store.getFieldInputErrors(field.name).length > 0)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
|
|
105
119
|
|
|
106
120
|
</script>
|
|
107
121
|
|
|
@@ -151,7 +165,9 @@ const {
|
|
|
151
165
|
|
|
152
166
|
<v-tabs v-model="tabSelected">
|
|
153
167
|
<v-tab v-for="tab in entity.tabs" :value="tab" :key="tab">
|
|
168
|
+
<span :class="tabInputErrors(tab) ? 'text-red' : ''">
|
|
154
169
|
{{ te(tab) ? t(tab) : tab }}
|
|
170
|
+
</span>
|
|
155
171
|
</v-tab>
|
|
156
172
|
</v-tabs>
|
|
157
173
|
<v-card-text>
|
|
@@ -197,7 +213,10 @@ const {
|
|
|
197
213
|
<v-list v-model="menuSelected">
|
|
198
214
|
<v-list-item v-for="menu in entity.menus" rounded="shaped" :value="menu" @click="menuSelected = menu">
|
|
199
215
|
<v-list-item-title>
|
|
200
|
-
|
|
216
|
+
<span :class="menuInputErrors(menu) ? 'text-red' : ''">
|
|
217
|
+
{{ te(menu) ? t(menu) : menu }}
|
|
218
|
+
</span>
|
|
219
|
+
|
|
201
220
|
</v-list-item-title>
|
|
202
221
|
</v-list-item>
|
|
203
222
|
</v-list>
|
|
@@ -205,7 +224,7 @@ const {
|
|
|
205
224
|
</v-card>
|
|
206
225
|
</v-col>
|
|
207
226
|
<v-col cols="12" sm="8" md="9">
|
|
208
|
-
<v-card variant="outlined">
|
|
227
|
+
<v-card v-if="menuSelected" variant="outlined">
|
|
209
228
|
<v-card-text>
|
|
210
229
|
<v-row>
|
|
211
230
|
<v-col
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {computed, type PropType} from "vue";
|
|
2
|
+
import {computed, type PropType, ref} from "vue";
|
|
3
3
|
import CrudFormField from "./CrudFormField.vue";
|
|
4
4
|
import type {IEntityCrud, IEntityCrudField} from "@drax/crud-share";
|
|
5
5
|
import {useI18n} from "vue-i18n";
|
|
6
6
|
import {useCrudStore} from "../stores/UseCrudStore";
|
|
7
|
+
import {useDisplay} from "vuetify"
|
|
7
8
|
|
|
8
9
|
const store = useCrudStore()
|
|
9
10
|
const {t, te} = useI18n()
|
|
@@ -59,15 +60,30 @@ const hasError = computed(() => {
|
|
|
59
60
|
|
|
60
61
|
})
|
|
61
62
|
|
|
63
|
+
const itemSelected = ref()
|
|
64
|
+
const indexSelected = ref()
|
|
65
|
+
|
|
66
|
+
function menuSelect(item: any, index: number) {
|
|
67
|
+
itemSelected.value = item
|
|
68
|
+
indexSelected.value = index
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const menuMaxHeight = computed(() => {
|
|
72
|
+
return field.menuMaxHeight || '300px'
|
|
73
|
+
})
|
|
74
|
+
|
|
62
75
|
defineEmits(['updateValue'])
|
|
63
76
|
|
|
77
|
+
const {xs} = useDisplay()
|
|
78
|
+
|
|
64
79
|
</script>
|
|
65
80
|
|
|
66
81
|
<template>
|
|
67
82
|
<v-card class="mt-3" variant="flat" border>
|
|
68
83
|
|
|
69
84
|
<v-card-title class="text-h5">{{ label }}</v-card-title>
|
|
70
|
-
|
|
85
|
+
|
|
86
|
+
<v-card-text v-if="field.arrayObjectUI === 'accordion' || xs">
|
|
71
87
|
<v-expansion-panels>
|
|
72
88
|
<v-expansion-panel v-for="(item,index) in valueModel" :key="index">
|
|
73
89
|
|
|
@@ -115,6 +131,62 @@ defineEmits(['updateValue'])
|
|
|
115
131
|
</v-expansion-panels>
|
|
116
132
|
</v-card-text>
|
|
117
133
|
|
|
134
|
+
<v-card-text v-else>
|
|
135
|
+
<v-row>
|
|
136
|
+
<v-col cols="12" sm="4" md="3">
|
|
137
|
+
<v-card variant="outlined">
|
|
138
|
+
<v-card-text >
|
|
139
|
+
<v-list v-model="itemSelected" :style="{ maxHeight: menuMaxHeight, overflowY: 'auto' }">
|
|
140
|
+
<v-list-item v-for="(item,index) in valueModel" :key="index" rounded="shaped"
|
|
141
|
+
:value="item" @click="menuSelect(item, index)"
|
|
142
|
+
>
|
|
143
|
+
<template v-slot:append>
|
|
144
|
+
<v-btn size="x-small" variant="text" color="red" icon="mdi-delete"
|
|
145
|
+
@click="removeItem(index)"
|
|
146
|
+
|
|
147
|
+
/>
|
|
148
|
+
</template>
|
|
149
|
+
<v-list-item-title>
|
|
150
|
+
<v-chip class="mr-2" :color="hasError(index) ? 'red':'teal'">{{ index }}</v-chip>
|
|
151
|
+
{{//@ts-ignore
|
|
152
|
+
valueModel[index][Object.keys(valueModel[index] as any)[0]]
|
|
153
|
+
}}
|
|
154
|
+
</v-list-item-title>
|
|
155
|
+
</v-list-item>
|
|
156
|
+
|
|
157
|
+
</v-list>
|
|
158
|
+
|
|
159
|
+
<v-btn variant="text" @click="addItem" class="text-blue text--darken-3 float-right my-2">
|
|
160
|
+
<v-icon>mdi-plus</v-icon>
|
|
161
|
+
</v-btn>
|
|
162
|
+
</v-card-text>
|
|
163
|
+
</v-card>
|
|
164
|
+
</v-col>
|
|
165
|
+
<v-col cols="12" sm="8" md="9">
|
|
166
|
+
<v-card v-if="itemSelected" variant="outlined">
|
|
167
|
+
<v-card-text >
|
|
168
|
+
<template v-for="key in Object.keys(itemSelected as Record<string, any>)" :key="key">
|
|
169
|
+
<crud-form-field
|
|
170
|
+
v-if="hasField(key)"
|
|
171
|
+
:entity="entity"
|
|
172
|
+
:field="getField(key)"
|
|
173
|
+
v-model="(itemSelected as any)[key]"
|
|
174
|
+
:readonly="readonly"
|
|
175
|
+
:parentField="field.name"
|
|
176
|
+
:index="indexSelected"
|
|
177
|
+
:density="density"
|
|
178
|
+
:variant="variant"
|
|
179
|
+
:clearable="clearable"
|
|
180
|
+
:hide-details="hideDetails"
|
|
181
|
+
:single-line="singleLine"
|
|
182
|
+
@updateValue="$emit('updateValue')"
|
|
183
|
+
/>
|
|
184
|
+
</template>
|
|
185
|
+
</v-card-text>
|
|
186
|
+
</v-card>
|
|
187
|
+
</v-col>
|
|
188
|
+
</v-row>
|
|
189
|
+
</v-card-text>
|
|
118
190
|
|
|
119
191
|
</v-card>
|
|
120
192
|
|