@koumoul/vjsf 3.8.0 → 3.9.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 +1 -1
- package/src/components/fragments/select-item-icon.vue +6 -1
- package/src/components/fragments/select-item.vue +5 -0
- package/src/components/fragments/select-selection.vue +5 -0
- package/src/components/nodes/autocomplete.vue +3 -1
- package/src/components/nodes/select.vue +4 -3
- package/src/composables/use-select-node.js +6 -3
- package/types/components/fragments/select-item.vue.d.ts +2 -0
- package/types/components/fragments/select-selection.vue.d.ts +2 -0
- package/types/composables/use-select-node.d.ts +2 -1
- package/types/composables/use-select-node.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -3,12 +3,17 @@
|
|
|
3
3
|
|
|
4
4
|
import { defineComponent, h, computed } from 'vue'
|
|
5
5
|
import { VIcon } from 'vuetify/components/VIcon'
|
|
6
|
+
import { VAvatar, VImg } from 'vuetify/components'
|
|
6
7
|
|
|
7
8
|
export default defineComponent({
|
|
8
9
|
props: {
|
|
9
10
|
icon: {
|
|
10
11
|
type: String,
|
|
11
12
|
required: true
|
|
13
|
+
},
|
|
14
|
+
avatarProps: {
|
|
15
|
+
type: Object,
|
|
16
|
+
required: true
|
|
12
17
|
}
|
|
13
18
|
},
|
|
14
19
|
setup (props) {
|
|
@@ -16,7 +21,7 @@ export default defineComponent({
|
|
|
16
21
|
const isSVG = computed(() => props.icon.startsWith('<?xml') || props.icon.startsWith('<svg'))
|
|
17
22
|
return () => {
|
|
18
23
|
if (isUrl.value) {
|
|
19
|
-
return h(
|
|
24
|
+
return h(VAvatar, props.avatarProps, () => h(VImg, { src: props.icon }))
|
|
20
25
|
} else if (isSVG.value) {
|
|
21
26
|
return h('div', { innerHTML: props.icon.replace('<svg ', '<svg class="v-icon__svg" '), class: 'v-icon' })
|
|
22
27
|
} else {
|
|
@@ -18,6 +18,10 @@ defineProps({
|
|
|
18
18
|
/** @type import('vue').PropType<import('@json-layout/vocabulary').SelectItem> */
|
|
19
19
|
type: Object,
|
|
20
20
|
required: true
|
|
21
|
+
},
|
|
22
|
+
avatarProps: {
|
|
23
|
+
type: Object,
|
|
24
|
+
required: true
|
|
21
25
|
}
|
|
22
26
|
})
|
|
23
27
|
</script>
|
|
@@ -38,6 +42,7 @@ defineProps({
|
|
|
38
42
|
<v-select-item-icon
|
|
39
43
|
v-if="item.icon"
|
|
40
44
|
:icon="item.icon"
|
|
45
|
+
:avatar-props="avatarProps"
|
|
41
46
|
/>
|
|
42
47
|
</template>
|
|
43
48
|
</v-list-item>
|
|
@@ -16,6 +16,10 @@ defineProps({
|
|
|
16
16
|
/** @type import('vue').PropType<import('@json-layout/vocabulary').SelectItem> */
|
|
17
17
|
type: Object,
|
|
18
18
|
required: true
|
|
19
|
+
},
|
|
20
|
+
avatarProps: {
|
|
21
|
+
type: Object,
|
|
22
|
+
required: true
|
|
19
23
|
}
|
|
20
24
|
})
|
|
21
25
|
|
|
@@ -26,6 +30,7 @@ defineProps({
|
|
|
26
30
|
<v-select-item-icon
|
|
27
31
|
v-if="item.icon"
|
|
28
32
|
:icon="item.icon"
|
|
33
|
+
:avatar-props="avatarProps"
|
|
29
34
|
/>
|
|
30
35
|
{{ item.title ?? item.key ?? item.value }}
|
|
31
36
|
<span
|
|
@@ -3,6 +3,7 @@ import { VAutocomplete } from 'vuetify/components/VAutocomplete'
|
|
|
3
3
|
import { useDefaults } from 'vuetify'
|
|
4
4
|
import { defineComponent, computed, h, toRef } from 'vue'
|
|
5
5
|
import useSelectNode from '../../composables/use-select-node.js'
|
|
6
|
+
import useCompDefaults from '../../composables/use-comp-defaults.js'
|
|
6
7
|
|
|
7
8
|
export default defineComponent({
|
|
8
9
|
props: {
|
|
@@ -19,8 +20,9 @@ export default defineComponent({
|
|
|
19
20
|
},
|
|
20
21
|
setup (props) {
|
|
21
22
|
useDefaults({}, 'VjsfAutocomplete')
|
|
23
|
+
const avatarProps = useCompDefaults('VjsfSelectItem-VAvatar', { rounded: false, size: 'small' })
|
|
22
24
|
|
|
23
|
-
const { getItems, selectProps, selectSlots, localData } = useSelectNode(toRef(props, 'modelValue'), props.statefulLayout)
|
|
25
|
+
const { getItems, selectProps, selectSlots, localData } = useSelectNode(toRef(props, 'modelValue'), props.statefulLayout, avatarProps.value)
|
|
24
26
|
|
|
25
27
|
const fieldProps = computed(() => {
|
|
26
28
|
const fieldProps = { ...selectProps.value }
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { VSelect } from 'vuetify/components/VSelect'
|
|
3
3
|
import { defineComponent, h, computed, toRef } from 'vue'
|
|
4
|
-
import useSelectNode from '../../composables/use-select-node.js'
|
|
5
|
-
|
|
6
4
|
import { useDefaults } from 'vuetify'
|
|
5
|
+
import useSelectNode from '../../composables/use-select-node.js'
|
|
6
|
+
import useCompDefaults from '../../composables/use-comp-defaults.js'
|
|
7
7
|
|
|
8
8
|
export default defineComponent({
|
|
9
9
|
props: {
|
|
@@ -20,8 +20,9 @@ export default defineComponent({
|
|
|
20
20
|
},
|
|
21
21
|
setup (props) {
|
|
22
22
|
useDefaults({}, 'VjsfSelect')
|
|
23
|
+
const avatarProps = useCompDefaults('VjsfSelectItem-VAvatar', { rounded: false, size: 'small' })
|
|
23
24
|
|
|
24
|
-
const { getItems, selectProps, selectSlots, localData } = useSelectNode(toRef(props, 'modelValue'), props.statefulLayout)
|
|
25
|
+
const { getItems, selectProps, selectSlots, localData } = useSelectNode(toRef(props, 'modelValue'), props.statefulLayout, avatarProps.value)
|
|
25
26
|
|
|
26
27
|
const fieldProps = computed(() => {
|
|
27
28
|
const fieldProps = { ...selectProps.value }
|
|
@@ -8,8 +8,9 @@ import SelectSelection from '../components/fragments/select-selection.vue'
|
|
|
8
8
|
* specialized use of useFieldProps shared between select and autocomplete components
|
|
9
9
|
* @param {import('vue').Ref<import('../types.js').VjsfSelectNode>} nodeRef
|
|
10
10
|
* @param {import('../types.js').VjsfStatefulLayout} statefulLayout
|
|
11
|
+
* @param {any} avatarProps
|
|
11
12
|
*/
|
|
12
|
-
export default function (nodeRef, statefulLayout) {
|
|
13
|
+
export default function (nodeRef, statefulLayout, avatarProps) {
|
|
13
14
|
const layout = computed(() => nodeRef.value.layout)
|
|
14
15
|
|
|
15
16
|
const { inputProps, options, skeleton, localData, compSlots } = useField(nodeRef, statefulLayout, { layoutPropsMap: ['multiple'], bindData: false })
|
|
@@ -55,14 +56,16 @@ export default function (nodeRef, statefulLayout) {
|
|
|
55
56
|
slots.item = (/** @type {any} */ context) => h(SelectItem, {
|
|
56
57
|
multiple: layout.value.multiple,
|
|
57
58
|
itemProps: context.props,
|
|
58
|
-
item: context.item.raw
|
|
59
|
+
item: context.item.raw,
|
|
60
|
+
avatarProps
|
|
59
61
|
})
|
|
60
62
|
}
|
|
61
63
|
if (!slots.selection) {
|
|
62
64
|
slots.selection = (/** @type {any} */ context) => h(SelectSelection, {
|
|
63
65
|
multiple: layout.value.multiple,
|
|
64
66
|
last: layout.value.multiple && context.index === nodeRef.value.data.length - 1,
|
|
65
|
-
item: getItems.prepareSelectedItem(context.item.raw, context.item.value)
|
|
67
|
+
item: getItems.prepareSelectedItem(context.item.raw, context.item.value),
|
|
68
|
+
avatarProps
|
|
66
69
|
})
|
|
67
70
|
}
|
|
68
71
|
return slots
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<any, {
|
|
2
2
|
multiple: boolean;
|
|
3
3
|
item: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
|
|
4
|
+
avatarProps: Record<string, any>;
|
|
4
5
|
itemProps: Record<string, any>;
|
|
5
6
|
$props: {
|
|
6
7
|
readonly multiple?: boolean | undefined;
|
|
7
8
|
readonly item?: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
|
|
9
|
+
readonly avatarProps?: Record<string, any> | undefined;
|
|
8
10
|
readonly itemProps?: Record<string, any> | undefined;
|
|
9
11
|
};
|
|
10
12
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<any> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<any, {
|
|
2
2
|
multiple: boolean;
|
|
3
3
|
item: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
|
|
4
|
+
avatarProps: Record<string, any>;
|
|
4
5
|
last: boolean;
|
|
5
6
|
$props: {
|
|
6
7
|
readonly multiple?: boolean | undefined;
|
|
7
8
|
readonly item?: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
|
|
9
|
+
readonly avatarProps?: Record<string, any> | undefined;
|
|
8
10
|
readonly last?: boolean | undefined;
|
|
9
11
|
};
|
|
10
12
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<any> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* specialized use of useFieldProps shared between select and autocomplete components
|
|
3
3
|
* @param {import('vue').Ref<import('../types.js').VjsfSelectNode>} nodeRef
|
|
4
4
|
* @param {import('../types.js').VjsfStatefulLayout} statefulLayout
|
|
5
|
+
* @param {any} avatarProps
|
|
5
6
|
*/
|
|
6
|
-
export default function _default(nodeRef: import('vue').Ref<import('../types.js').VjsfSelectNode>, statefulLayout: import('../types.js').VjsfStatefulLayout): {
|
|
7
|
+
export default function _default(nodeRef: import('vue').Ref<import('../types.js').VjsfSelectNode>, statefulLayout: import('../types.js').VjsfStatefulLayout, avatarProps: any): {
|
|
7
8
|
localData: import("vue").Ref<any, any>;
|
|
8
9
|
inputProps: import("vue").ComputedRef<Record<string, any> & {
|
|
9
10
|
class: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-select-node.d.ts","sourceRoot":"","sources":["../../src/composables/use-select-node.js"],"names":[],"mappings":"AAMA
|
|
1
|
+
{"version":3,"file":"use-select-node.d.ts","sourceRoot":"","sources":["../../src/composables/use-select-node.js"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,0CAJW,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,cAAc,CAAC,kBACvD,OAAO,aAAa,EAAE,kBAAkB,eACxC,GAAG;;;;;;;;;;;;;;;;;;;;EAgEb"}
|