@koumoul/vjsf 3.20.8 → 3.21.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koumoul/vjsf",
3
- "version": "3.20.8",
3
+ "version": "3.21.0",
4
4
  "description": "Generate forms for the vuetify UI library (vuejs) based on annotated JSON schemas.",
5
5
  "scripts": {
6
6
  "test-tz1": "TZ=Europe/Paris vitest run",
@@ -72,8 +72,8 @@
72
72
  "vuetify": "^3.8.12"
73
73
  },
74
74
  "dependencies": {
75
- "@json-layout/core": "~2.0.0",
76
- "@json-layout/vocabulary": "~2.8.0",
75
+ "@json-layout/core": "~2.1.0",
76
+ "@json-layout/vocabulary": "~2.9.0",
77
77
  "@vueuse/core": "^12.5.0",
78
78
  "debug": "^4.3.4"
79
79
  },
@@ -0,0 +1,28 @@
1
+ <script setup>
2
+
3
+ import { VListSubheader } from 'vuetify/components/VList'
4
+ import VSelectItemIcon from './select-item-icon.vue'
5
+
6
+ defineProps({
7
+ item: {
8
+ /** @type import('vue').PropType<import('@json-layout/vocabulary').SelectItemHeader> */
9
+ type: Object,
10
+ required: true
11
+ },
12
+ avatarProps: {
13
+ type: Object,
14
+ required: true
15
+ }
16
+ })
17
+ </script>
18
+
19
+ <template>
20
+ <v-list-subheader>
21
+ <v-select-item-icon
22
+ v-if="typeof item.icon === 'string'"
23
+ :icon="item.icon"
24
+ :avatar-props="avatarProps"
25
+ />
26
+ {{ item.title }}
27
+ </v-list-subheader>
28
+ </template>
@@ -56,7 +56,7 @@ export default defineComponent({
56
56
  } else {
57
57
  modelValue = localData.value === item.value
58
58
  }
59
- checkboxes.push(h(props.type === 'switch' ? VSwitch : VCheckbox, {
59
+ checkboxes.push(h(/** @type {import('vue').Component} */(props.type === 'switch' ? VSwitch : VCheckbox), {
60
60
  label: item.title,
61
61
  hideDetails: true,
62
62
  key: item.key,
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import { VSelect } from 'vuetify/components/VSelect'
3
- import { defineComponent, h, computed, toRef } from 'vue'
3
+ import { defineComponent, h, computed, toRef, watch } from 'vue'
4
4
  import { useDefaults } from 'vuetify'
5
5
  import useSelectNode from '../../composables/use-select-node.js'
6
6
  import useCompDefaults from '../../composables/use-comp-defaults.js'
@@ -32,6 +32,8 @@ export default defineComponent({
32
32
  return fieldProps
33
33
  })
34
34
 
35
+ watch(() => fieldProps.value.items, () => console.log(fieldProps.value.items))
36
+
35
37
  // @ts-ignore
36
38
  return () => h(VSelect, fieldProps.value, selectSlots.value)
37
39
  }
@@ -2,6 +2,7 @@ import { computed, h } from 'vue'
2
2
  import useField from './use-node.js'
3
3
  import useGetItems from './use-get-items.js'
4
4
  import SelectItem from '../components/fragments/select-item.vue'
5
+ import SelectItemHeader from '../components/fragments/select-item-header.vue'
5
6
  import SelectSelection from '../components/fragments/select-selection.vue'
6
7
  import useZIndexStack from './use-z-index-stack.js'
7
8
 
@@ -55,12 +56,21 @@ export default function (nodeRef, statefulLayout, avatarProps, cssPrefix) {
55
56
  const selectSlots = computed(() => {
56
57
  const slots = { ...compSlots.value }
57
58
  if (!slots.item) {
58
- slots.item = (/** @type {any} */ context) => h(SelectItem, {
59
- multiple: layout.value.multiple,
60
- itemProps: context.props,
61
- item: context.item.raw,
62
- avatarProps
63
- })
59
+ slots.item = (/** @type {any} */ context) => {
60
+ if (context.item.raw.header) {
61
+ return h(SelectItemHeader, {
62
+ item: context.item.raw,
63
+ avatarProps
64
+ })
65
+ } else {
66
+ return h(SelectItem, {
67
+ multiple: layout.value.multiple,
68
+ itemProps: context.props,
69
+ item: context.item.raw,
70
+ avatarProps
71
+ })
72
+ }
73
+ }
64
74
  }
65
75
  if (!slots.selection) {
66
76
  slots.selection = (/** @type {any} */ context) => h(SelectSelection, {
@@ -0,0 +1,14 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ multiple: boolean;
3
+ itemProps: Record<string, any>;
4
+ item: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
5
+ avatarProps: Record<string, any>;
6
+ $props: {
7
+ readonly multiple?: boolean | undefined;
8
+ readonly itemProps?: Record<string, any> | undefined;
9
+ readonly item?: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
10
+ readonly avatarProps?: Record<string, any> | undefined;
11
+ };
12
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
13
+ export default _default;
14
+ //# sourceMappingURL=select-item%20copy.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-item copy.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/select-item copy.vue.js"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ item: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItemHeader;
3
+ avatarProps: Record<string, any>;
4
+ $props: {
5
+ readonly item?: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItemHeader | undefined;
6
+ readonly avatarProps?: Record<string, any> | undefined;
7
+ };
8
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
9
+ export default _default;
10
+ //# sourceMappingURL=select-item-header.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-item-header.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/select-item-header.vue.js"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"use-select-node.d.ts","sourceRoot":"","sources":["../../src/composables/use-select-node.js"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,0CALW,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,cAAc,CAAC,kBACvD,OAAO,aAAa,EAAE,kBAAkB,eACxC,GAAG,aACH,gBAAgB,GAAG,UAAU;;;;;;;;;;;;;;;;;;;;EAiEvC"}
1
+ {"version":3,"file":"use-select-node.d.ts","sourceRoot":"","sources":["../../src/composables/use-select-node.js"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,0CALW,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,cAAc,CAAC,kBACvD,OAAO,aAAa,EAAE,kBAAkB,eACxC,GAAG,aACH,gBAAgB,GAAG,UAAU;;;;;;;;;;;;;;;;;;;;EA0EvC"}