@drax/crud-vue 0.39.0 → 0.42.2
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.
|
|
6
|
+
"version": "0.42.2",
|
|
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": "^0.
|
|
28
|
-
"@drax/crud-front": "^0.
|
|
29
|
-
"@drax/crud-share": "^0.
|
|
30
|
-
"@drax/media-vue": "^0.
|
|
27
|
+
"@drax/common-front": "^0.42.2",
|
|
28
|
+
"@drax/crud-front": "^0.42.2",
|
|
29
|
+
"@drax/crud-share": "^0.42.2",
|
|
30
|
+
"@drax/media-vue": "^0.42.2"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"pinia": "^2.2.2",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"vue-tsc": "^2.1.10",
|
|
65
65
|
"vuetify": "^3.8.2"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "6b4f9f50a8e3f0fbdaff7ec913356834a4e2c0b5"
|
|
68
68
|
}
|
|
@@ -123,7 +123,28 @@ defineEmits(['updateValue'])
|
|
|
123
123
|
:append-icon="appendIcon"
|
|
124
124
|
:prepend-inner-icon="prependInnerIcon"
|
|
125
125
|
:append-inner-icon="appendInnerIcon"
|
|
126
|
-
|
|
126
|
+
>
|
|
127
|
+
<template v-slot:item="{ props: itemProps, item }">
|
|
128
|
+
<v-list-item
|
|
129
|
+
v-bind="itemProps"
|
|
130
|
+
density="compact"
|
|
131
|
+
:title="item.raw[itemTitle]"
|
|
132
|
+
:color="item.raw?.color"
|
|
133
|
+
:base-color="item.raw?.color"
|
|
134
|
+
:prepend-icon="item.raw?.icon"
|
|
135
|
+
/>
|
|
136
|
+
</template>
|
|
137
|
+
|
|
138
|
+
<template v-slot:selection="{item}">
|
|
139
|
+
<v-chip tile density="compact"
|
|
140
|
+
:color="item.raw?.color"
|
|
141
|
+
:prepend-icon="item.raw?.icon"
|
|
142
|
+
>
|
|
143
|
+
{{ item.raw[itemTitle] }}
|
|
144
|
+
</v-chip>
|
|
145
|
+
</template>
|
|
146
|
+
|
|
147
|
+
</v-select>
|
|
127
148
|
|
|
128
149
|
|
|
129
150
|
<v-autocomplete
|
|
@@ -154,7 +175,28 @@ defineEmits(['updateValue'])
|
|
|
154
175
|
:append-icon="appendIcon"
|
|
155
176
|
:prepend-inner-icon="prependInnerIcon"
|
|
156
177
|
:append-inner-icon="appendInnerIcon"
|
|
157
|
-
|
|
178
|
+
>
|
|
179
|
+
<template v-slot:item="{ props: itemProps, item }">
|
|
180
|
+
<v-list-item
|
|
181
|
+
v-bind="itemProps"
|
|
182
|
+
density="compact"
|
|
183
|
+
:title="item.raw[itemTitle]"
|
|
184
|
+
:color="item.raw?.color"
|
|
185
|
+
:base-color="item.raw?.color"
|
|
186
|
+
:prepend-icon="item.raw?.icon"
|
|
187
|
+
/>
|
|
188
|
+
</template>
|
|
189
|
+
|
|
190
|
+
<template v-slot:selection="{item}">
|
|
191
|
+
<v-chip tile density="compact"
|
|
192
|
+
:color="item.raw?.color"
|
|
193
|
+
:prepend-icon="item.raw?.icon"
|
|
194
|
+
>
|
|
195
|
+
{{ item.raw[itemTitle] }}
|
|
196
|
+
</v-chip>
|
|
197
|
+
</template>
|
|
198
|
+
|
|
199
|
+
</v-autocomplete>
|
|
158
200
|
|
|
159
201
|
|
|
160
202
|
</template>
|
|
@@ -170,6 +170,47 @@ defineEmits(['updateValue'])
|
|
|
170
170
|
>
|
|
171
171
|
</v-combobox>
|
|
172
172
|
|
|
173
|
+
<v-select
|
|
174
|
+
v-if="field.type === 'select'"
|
|
175
|
+
:name="name"
|
|
176
|
+
:label="label"
|
|
177
|
+
:hint="field.hint"
|
|
178
|
+
:persistent-hint="field.persistentHint"
|
|
179
|
+
v-model="valueModel"
|
|
180
|
+
:items="field.items"
|
|
181
|
+
item-title="title"
|
|
182
|
+
item-value="value"
|
|
183
|
+
:readonly="readonly"
|
|
184
|
+
:error-messages="inputErrors"
|
|
185
|
+
:density="density"
|
|
186
|
+
:variant="variant"
|
|
187
|
+
:clearable="clearable"
|
|
188
|
+
:hide-details="hideDetails"
|
|
189
|
+
:single-line="singleLine"
|
|
190
|
+
:rules="rules"
|
|
191
|
+
@update:modelValue="$emit('updateValue')"
|
|
192
|
+
:prepend-icon="prependIcon"
|
|
193
|
+
:append-icon="appendIcon"
|
|
194
|
+
:prepend-inner-icon="prependInnerIcon"
|
|
195
|
+
:append-inner-icon="appendInnerIcon"
|
|
196
|
+
|
|
197
|
+
>
|
|
198
|
+
<template v-slot:item="{ props: itemProps, item }">
|
|
199
|
+
<v-list-item
|
|
200
|
+
v-bind="itemProps"
|
|
201
|
+
density="compact"
|
|
202
|
+
:title="item.raw.title"
|
|
203
|
+
:color="item.raw.color"
|
|
204
|
+
:base-color="item.raw.color"
|
|
205
|
+
:prepend-icon="item.raw.icon"
|
|
206
|
+
/>
|
|
207
|
+
</template>
|
|
208
|
+
|
|
209
|
+
<template v-slot:selection="{item}">
|
|
210
|
+
<v-chip tile density="compact" :color="item.raw.color" :prepend-icon="item.raw.icon">{{ item.raw.title }}</v-chip>
|
|
211
|
+
</template>
|
|
212
|
+
</v-select>
|
|
213
|
+
|
|
173
214
|
|
|
174
215
|
<v-select
|
|
175
216
|
v-if="field.type === 'enum' && field.noFilter"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {useEntityStore} from '../../stores/UseEntityStore'
|
|
3
|
+
import {useI18n} from 'vue-i18n'
|
|
4
|
+
import type {IEntityCrud} from "@drax/crud-share"
|
|
5
|
+
|
|
6
|
+
const valueModel = defineModel()
|
|
7
|
+
const entityStore = useEntityStore()
|
|
8
|
+
const {t,te} = useI18n()
|
|
9
|
+
|
|
10
|
+
const getEntityLabel = (entity: IEntityCrud) => {
|
|
11
|
+
const key = entity?.name?.toLowerCase() + '.entity'
|
|
12
|
+
return te(key) ? t(key) : entity?.name
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
|
|
19
|
+
<v-select
|
|
20
|
+
:items="entityStore.entities"
|
|
21
|
+
item-value="name"
|
|
22
|
+
v-model="valueModel"
|
|
23
|
+
:label="t('crud.entity')"
|
|
24
|
+
v-bind="$attrs"
|
|
25
|
+
|
|
26
|
+
>
|
|
27
|
+
|
|
28
|
+
<template v-slot:item="{ props: itemProps, item }">
|
|
29
|
+
<v-list-item
|
|
30
|
+
v-bind="itemProps"
|
|
31
|
+
density="compact"
|
|
32
|
+
:title="getEntityLabel(item.raw as IEntityCrud)"
|
|
33
|
+
|
|
34
|
+
/>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<template v-slot:selection="{item}">
|
|
38
|
+
{{ getEntityLabel(item.raw as IEntityCrud) }}
|
|
39
|
+
</template>
|
|
40
|
+
</v-select>
|
|
41
|
+
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<style scoped>
|
|
45
|
+
|
|
46
|
+
</style>
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,9 @@ import CrudFilters from "./components/CrudFilters.vue";
|
|
|
8
8
|
import CrudNotify from "./components/CrudNotify.vue";
|
|
9
9
|
import CrudSearch from "./components/CrudSearch.vue";
|
|
10
10
|
import CrudAutocomplete from "./components/CrudAutocomplete.vue";
|
|
11
|
+
import EntityCombobox from "./components/combobox/EntityCombobox.vue";
|
|
11
12
|
import {useCrudStore} from "./stores/UseCrudStore";
|
|
13
|
+
import {useEntityStore} from "./stores/UseEntityStore";
|
|
12
14
|
import {useCrud} from "./composables/UseCrud";
|
|
13
15
|
import {useFormUtils} from "./composables/UseFormUtils";
|
|
14
16
|
import {useInputErrorI18n} from "./composables/UseInputErrorI18n";
|
|
@@ -30,6 +32,8 @@ export {
|
|
|
30
32
|
useFormUtils,
|
|
31
33
|
useCrudStore,
|
|
32
34
|
useInputErrorI18n,
|
|
33
|
-
EntityCrud
|
|
35
|
+
EntityCrud,
|
|
36
|
+
useEntityStore,
|
|
37
|
+
EntityCombobox
|
|
34
38
|
|
|
35
39
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {defineStore} from "pinia";
|
|
2
|
+
import type { IEntityCrud} from "@drax/crud-share";
|
|
3
|
+
|
|
4
|
+
export const useEntityStore = defineStore('EntityStore', {
|
|
5
|
+
state: () => (
|
|
6
|
+
{
|
|
7
|
+
entities: [] as IEntityCrud[],
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
),
|
|
11
|
+
getters: {
|
|
12
|
+
getEntities(state: any) {
|
|
13
|
+
return state.entities
|
|
14
|
+
},
|
|
15
|
+
hasEntity(state: any) {
|
|
16
|
+
return (name: string) => state.entities.some((entity: IEntityCrud) => entity.name === name)
|
|
17
|
+
},
|
|
18
|
+
getEntity(state: any) {
|
|
19
|
+
return (name: string) => state.entities.find((entity: IEntityCrud) => entity.name === name)
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
actions: {
|
|
23
|
+
setEntities(entities: IEntityCrud[]) {
|
|
24
|
+
this.entities = entities
|
|
25
|
+
},
|
|
26
|
+
addEntity(entity: IEntityCrud) {
|
|
27
|
+
this.entities.push(entity)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
})
|