@koumoul/vjsf 4.1.5 → 4.3.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 +3 -3
- package/src/components/fragments/list-select-key.vue +1 -1
- package/src/components/fragments/select-item-icon.vue +1 -1
- package/src/components/nodes/autocomplete.vue +1 -1
- package/src/components/nodes/one-of-select.vue +8 -4
- package/src/components/nodes/select.vue +1 -1
- package/src/components/nodes/slider.vue +6 -0
- package/src/components/vjsf-webmcp.vue +5 -1
- package/src/composables/use-vjsf.js +3 -1
- package/types/components/nodes/one-of-select.vue.d.ts.map +1 -1
- package/types/components/nodes/slider.vue.d.ts.map +1 -1
- package/types/components/vjsf-webmcp.vue.d.ts +9 -0
- package/types/components/vjsf-webmcp.vue.d.ts.map +1 -1
- package/types/composables/use-vjsf.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koumoul/vjsf",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.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",
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"vuetify": "^4.0.0"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@json-layout/core": "~2.
|
|
82
|
-
"@json-layout/vocabulary": "~2.
|
|
81
|
+
"@json-layout/core": "~2.7.0",
|
|
82
|
+
"@json-layout/vocabulary": "~2.13.0",
|
|
83
83
|
"@vueuse/core": "^12.5.0",
|
|
84
84
|
"debug": "^4.3.4"
|
|
85
85
|
},
|
|
@@ -33,7 +33,7 @@ export default defineComponent({
|
|
|
33
33
|
setup (props, { emit }) {
|
|
34
34
|
useDefaults({}, 'VjsfListSelectKey')
|
|
35
35
|
const vSelectProps = useCompDefaults('VjsfIndexedList-VSelect', { variant: 'outlined', class: 'mt-2' })
|
|
36
|
-
const avatarProps = useCompDefaults('VjsfSelectItem-VAvatar', { rounded: false, size: 'small' })
|
|
36
|
+
const avatarProps = useCompDefaults('VjsfSelectItem-VAvatar', { rounded: false, size: 'small', color: 'transparent' })
|
|
37
37
|
|
|
38
38
|
// @ts-ignore
|
|
39
39
|
const { getItems, selectProps, selectSlots } = useSelectNode(toRef(props, 'listNode'), props.statefulLayout, avatarProps.value, 'v-select')
|
|
@@ -17,7 +17,7 @@ export default defineComponent({
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
setup (props) {
|
|
20
|
-
const isUrl = computed(() => props.icon.startsWith('http://') || props.icon.startsWith('https://'))
|
|
20
|
+
const isUrl = computed(() => props.icon.startsWith('http://') || props.icon.startsWith('https://') || props.icon.startsWith('/'))
|
|
21
21
|
const isSVG = computed(() => props.icon.startsWith('<?xml') || props.icon.startsWith('<svg'))
|
|
22
22
|
return () => {
|
|
23
23
|
if (isUrl.value) {
|
|
@@ -20,7 +20,7 @@ export default defineComponent({
|
|
|
20
20
|
},
|
|
21
21
|
setup (props) {
|
|
22
22
|
useDefaults({}, 'VjsfAutocomplete')
|
|
23
|
-
const avatarProps = useCompDefaults('VjsfSelectItem-VAvatar', { rounded: false, size: 'small' })
|
|
23
|
+
const avatarProps = useCompDefaults('VjsfSelectItem-VAvatar', { rounded: false, size: 'small', color: 'transparent' })
|
|
24
24
|
|
|
25
25
|
const { getItems, selectProps, selectSlots, localData } = useSelectNode(toRef(props, 'modelValue'), props.statefulLayout, avatarProps.value, 'v-autocomplete')
|
|
26
26
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { VRow, VCol } from 'vuetify/components/VGrid'
|
|
3
3
|
import { VSelect } from 'vuetify/components/VSelect'
|
|
4
|
+
import { VAutocomplete } from 'vuetify/components/VAutocomplete'
|
|
4
5
|
import { ref, watch, computed, toRef } from 'vue'
|
|
5
6
|
import { isSection } from '@json-layout/core/state'
|
|
6
7
|
import { isCompObject, isOneOfItemHeader, isOneOfItemChild } from '@json-layout/vocabulary'
|
|
@@ -32,6 +33,7 @@ const { inputProps, localData, skeleton, children } = useNode(
|
|
|
32
33
|
toRef(props, 'modelValue'), props.statefulLayout, { bindData: false }
|
|
33
34
|
)
|
|
34
35
|
const zIndex = useZIndexStack(props.modelValue.fullKey)
|
|
36
|
+
const isAutocomplete = computed(() => !!props.modelValue.layout.autocomplete)
|
|
35
37
|
|
|
36
38
|
/** @type import('vue').Ref<string | undefined> */
|
|
37
39
|
const activeChildTree = ref(undefined)
|
|
@@ -45,9 +47,10 @@ watch(() => children.value?.[0]?.key, () => {
|
|
|
45
47
|
}
|
|
46
48
|
}, { immediate: true })
|
|
47
49
|
|
|
48
|
-
const onChange = (/** @type {string} */childTree) => {
|
|
50
|
+
const onChange = (/** @type {string | null} */childTree) => {
|
|
49
51
|
if (!skeleton.value.childrenTrees) return
|
|
50
|
-
|
|
52
|
+
const index = childTree == null ? -1 : skeleton.value.childrenTrees.indexOf(childTree)
|
|
53
|
+
props.statefulLayout.activateItem(props.modelValue, index)
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
const fieldProps = computed(() => {
|
|
@@ -83,7 +86,8 @@ const fieldProps = computed(() => {
|
|
|
83
86
|
v-if="modelValue.skeleton.childrenTrees"
|
|
84
87
|
cols="12"
|
|
85
88
|
>
|
|
86
|
-
<
|
|
89
|
+
<component
|
|
90
|
+
:is="isAutocomplete ? VAutocomplete : VSelect"
|
|
87
91
|
v-bind="fieldProps"
|
|
88
92
|
:model-value="activeChildTree"
|
|
89
93
|
>
|
|
@@ -112,7 +116,7 @@ const fieldProps = computed(() => {
|
|
|
112
116
|
</template>
|
|
113
117
|
</v-list-item>
|
|
114
118
|
</template>
|
|
115
|
-
</
|
|
119
|
+
</component>
|
|
116
120
|
</v-col>
|
|
117
121
|
<template v-if="modelValue.children?.[0]">
|
|
118
122
|
<node
|
|
@@ -20,7 +20,7 @@ export default defineComponent({
|
|
|
20
20
|
},
|
|
21
21
|
setup (props) {
|
|
22
22
|
useDefaults({}, 'VjsfSelect')
|
|
23
|
-
const avatarProps = useCompDefaults('VjsfSelectItem-VAvatar', { rounded: false, size: 'small' })
|
|
23
|
+
const avatarProps = useCompDefaults('VjsfSelectItem-VAvatar', { rounded: false, size: 'small', color: 'transparent' })
|
|
24
24
|
|
|
25
25
|
const { getItems, selectProps, selectSlots, localData } = useSelectNode(toRef(props, 'modelValue'), props.statefulLayout, avatarProps.value, 'v-select')
|
|
26
26
|
|
|
@@ -34,6 +34,10 @@ const props = defineProps({
|
|
|
34
34
|
dataTitle: {
|
|
35
35
|
type: String,
|
|
36
36
|
default: null
|
|
37
|
+
},
|
|
38
|
+
subAgent: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false
|
|
37
41
|
}
|
|
38
42
|
})
|
|
39
43
|
|
|
@@ -57,7 +61,7 @@ watch(statefulLayout, () => {
|
|
|
57
61
|
if (statefulLayout.value) {
|
|
58
62
|
webMCP.value = new WebMCP(
|
|
59
63
|
/** @type {import('@json-layout/core').StatefulLayout} */(/** @type {unknown} */(statefulLayout.value)),
|
|
60
|
-
{ prefixName: props.prefixName, dataTitle: props.dataTitle, schema: props.schema }
|
|
64
|
+
{ prefixName: props.prefixName, dataTitle: props.dataTitle, schema: props.schema, includeSubAgent: props.subAgent }
|
|
61
65
|
)
|
|
62
66
|
webMCP.value.registerTools()
|
|
63
67
|
}
|
|
@@ -67,6 +67,7 @@ export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compi
|
|
|
67
67
|
// cf https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/composables/form.ts
|
|
68
68
|
/** @type {any | null} */
|
|
69
69
|
const form = inject(Symbol.for('vuetify:form'), null)
|
|
70
|
+
const parentVjsf = inject(Symbol.for('vjsf:form'), false)
|
|
70
71
|
const formMemberId = `vjsf-${Math.random().toString(36).substring(2, 9)}`
|
|
71
72
|
if (form) {
|
|
72
73
|
form.register({
|
|
@@ -79,7 +80,7 @@ export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compi
|
|
|
79
80
|
resetValidation: () => statefulLayout.value?.resetValidation(),
|
|
80
81
|
vm: getCurrentInstance()
|
|
81
82
|
})
|
|
82
|
-
} else {
|
|
83
|
+
} else if (!parentVjsf) {
|
|
83
84
|
console.warn('Vjsf should be wrapped in VForm')
|
|
84
85
|
}
|
|
85
86
|
|
|
@@ -88,6 +89,7 @@ export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compi
|
|
|
88
89
|
// registers as a single form member above. Without this, each VInput registers
|
|
89
90
|
// separately, causing VForm to cascade updates to all N fields on every keystroke.
|
|
90
91
|
provide(Symbol.for('vuetify:form'), null)
|
|
92
|
+
provide(Symbol.for('vjsf:form'), true)
|
|
91
93
|
|
|
92
94
|
const slots = useSlots()
|
|
93
95
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"one-of-select.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/one-of-select.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"one-of-select.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/one-of-select.vue"],"names":[],"mappings":"wBAkYqB,OAAO,YAAY;;AAdxC;;QAGI,iFAAiF;cAAvE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,mBAAmB,CAAC;;;;QAK9E,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;QAL7E,iFAAiF;cAAvE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,mBAAmB,CAAC;;;;QAK9E,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;6IAK9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/slider.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"slider.vue.d.ts","sourceRoot":"","sources":["../../../src/components/nodes/slider.vue"],"names":[],"mappings":"wBAwDqB,OAAO,YAAY;;AAQxC;;QAGM,4EAA4E;cAAlE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,cAAc,CAAC;;;;QAKzE,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;;;;;QAL7E,4EAA4E;cAAlE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,cAAc,CAAC;;;;QAKzE,gFAAgF;cAAtE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;;;6IA0BhF"}
|
|
@@ -27,6 +27,10 @@ declare const __VLS_export: import("vue", { with: { "resolution-mode": "import"
|
|
|
27
27
|
type: StringConstructor;
|
|
28
28
|
default: null;
|
|
29
29
|
};
|
|
30
|
+
subAgent: {
|
|
31
|
+
type: BooleanConstructor;
|
|
32
|
+
default: boolean;
|
|
33
|
+
};
|
|
30
34
|
}>, {}, {}, {}, {}, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, {
|
|
31
35
|
"update:state": (state: import("../types.js", { with: { "resolution-mode": "import" } }).VjsfStatefulLayout) => void;
|
|
32
36
|
"update:modelValue": (data: any) => void;
|
|
@@ -57,6 +61,10 @@ declare const __VLS_export: import("vue", { with: { "resolution-mode": "import"
|
|
|
57
61
|
type: StringConstructor;
|
|
58
62
|
default: null;
|
|
59
63
|
};
|
|
64
|
+
subAgent: {
|
|
65
|
+
type: BooleanConstructor;
|
|
66
|
+
default: boolean;
|
|
67
|
+
};
|
|
60
68
|
}>> & Readonly<{
|
|
61
69
|
"onUpdate:state"?: ((state: import("../types.js", { with: { "resolution-mode": "import" } }).VjsfStatefulLayout) => any) | undefined;
|
|
62
70
|
"onUpdate:modelValue"?: ((data: any) => any) | undefined;
|
|
@@ -66,5 +74,6 @@ declare const __VLS_export: import("vue", { with: { "resolution-mode": "import"
|
|
|
66
74
|
precompiledLayout: import("../../../node_modules/@json-layout/core/types/compile/types.js", { with: { "resolution-mode": "import" } }).CompiledLayout;
|
|
67
75
|
prefixName: string;
|
|
68
76
|
dataTitle: string;
|
|
77
|
+
subAgent: boolean;
|
|
69
78
|
}, {}, {}, {}, string, import("vue", { with: { "resolution-mode": "import" } }).ComponentProvideOptions, true, {}, any>;
|
|
70
79
|
//# sourceMappingURL=vjsf-webmcp.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vjsf-webmcp.vue.d.ts","sourceRoot":"","sources":["../../src/components/vjsf-webmcp.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vjsf-webmcp.vue.d.ts","sourceRoot":"","sources":["../../src/components/vjsf-webmcp.vue"],"names":[],"mappings":"wBA4OqB,OAAO,YAAY;;AAnCxC;;;;;;QAQI,+EAA+E;cAArE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,mBAAmB,EAAE,cAAc,CAAC;;;;;;;;QAS5E,oFAAoF;cAA1E,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;QATjF,+EAA+E;cAArE,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,mBAAmB,EAAE,cAAc,CAAC;;;;;;;;QAS5E,oFAAoF;cAA1E,OAAO,KAAK,EAAE,QAAQ,CAAC,OAAO,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;wHAiBlF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-vjsf.d.ts","sourceRoot":"","sources":["../../src/composables/use-vjsf.js"],"names":[],"mappings":"AAcA;IACE;;MAEE;gCADO,GAAG;IAGZ;;MAEE;4BADO,OAAO,aAAa,EAAE,kBAAkB;EAGlD;AAiBM,gCAdI,OAAO,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,cACzB,OAAO,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,WACtB,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC,kBAClE,MAAM,CAAC,MAAM,EAAE,OAAO,KAAK,EAAE,SAAS,CAAC,QACvC,GAAG,YACH,cAAc,2BAA2B,EAAE,OAAO,0BAClD,cAAc,2BAA2B,EAAE,qBAAqB,sBAChE,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,mBAAmB,EAAE,cAAc,CAAC,GAC3D;IACV,EAAE,EAAE,OAAO,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5B,cAAc,EAAE,OAAO,KAAK,EAAE,UAAU,CAAC,OAAO,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC,CAAC;IAC1F,SAAS,EAAE,OAAO,KAAK,EAAE,UAAU,CAAC,OAAO,mBAAmB,EAAE,SAAS,GAAG,IAAI,CAAC,CAAA;CAChF,
|
|
1
|
+
{"version":3,"file":"use-vjsf.d.ts","sourceRoot":"","sources":["../../src/composables/use-vjsf.js"],"names":[],"mappings":"AAcA;IACE;;MAEE;gCADO,GAAG;IAGZ;;MAEE;4BADO,OAAO,aAAa,EAAE,kBAAkB;EAGlD;AAiBM,gCAdI,OAAO,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,cACzB,OAAO,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,WACtB,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC,kBAClE,MAAM,CAAC,MAAM,EAAE,OAAO,KAAK,EAAE,SAAS,CAAC,QACvC,GAAG,YACH,cAAc,2BAA2B,EAAE,OAAO,0BAClD,cAAc,2BAA2B,EAAE,qBAAqB,sBAChE,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,mBAAmB,EAAE,cAAc,CAAC,GAC3D;IACV,EAAE,EAAE,OAAO,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5B,cAAc,EAAE,OAAO,KAAK,EAAE,UAAU,CAAC,OAAO,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC,CAAC;IAC1F,SAAS,EAAE,OAAO,KAAK,EAAE,UAAU,CAAC,OAAO,mBAAmB,EAAE,SAAS,GAAG,IAAI,CAAC,CAAA;CAChF,CAyKH"}
|