@koumoul/vjsf 3.0.0-beta.8 → 3.0.0-beta.9
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.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.9",
|
|
4
4
|
"description": "Generate forms for the vuetify UI library (vuejs) based on annotated JSON schemas.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "vitest",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"vuetify": "^3.4.9"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@json-layout/core": "0.
|
|
78
|
+
"@json-layout/core": "0.14.0",
|
|
79
79
|
"@vueuse/core": "^10.5.0",
|
|
80
80
|
"debug": "^4.3.4",
|
|
81
81
|
"ejs": "^3.1.9"
|
|
@@ -30,6 +30,8 @@ export const emits = {
|
|
|
30
30
|
*/
|
|
31
31
|
export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compile, precompiledLayout) => {
|
|
32
32
|
const el = ref(null)
|
|
33
|
+
|
|
34
|
+
// TODO: apply a debounce to width ?
|
|
33
35
|
const { width } = useElementSize(el)
|
|
34
36
|
|
|
35
37
|
/** @type import('vue').ShallowRef<import('../types.js').VjsfStatefulLayout | null> */
|
|
@@ -74,7 +76,6 @@ export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compi
|
|
|
74
76
|
const onStatefulLayoutUpdate = () => {
|
|
75
77
|
if (!statefulLayout.value) return
|
|
76
78
|
stateTree.value = statefulLayout.value.stateTree
|
|
77
|
-
emit('update:modelValue', statefulLayout.value.data)
|
|
78
79
|
emit('update:state', statefulLayout.value)
|
|
79
80
|
if (form) {
|
|
80
81
|
// cf https://vuetifyjs.com/en/components/forms/#validation-state
|
|
@@ -84,6 +85,12 @@ export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compi
|
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
|
|
88
|
+
const onDataUpdate = () => {
|
|
89
|
+
if (statefulLayout.value && modelValue !== statefulLayout.value.data) {
|
|
90
|
+
emit('update:modelValue', statefulLayout.value.data)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
87
94
|
const initStatefulLayout = () => {
|
|
88
95
|
if (!width.value) return
|
|
89
96
|
|
|
@@ -96,9 +103,13 @@ export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compi
|
|
|
96
103
|
))
|
|
97
104
|
statefulLayout.value = _statefulLayout
|
|
98
105
|
onStatefulLayoutUpdate()
|
|
106
|
+
onDataUpdate()
|
|
99
107
|
_statefulLayout.events.on('update', () => {
|
|
100
108
|
onStatefulLayoutUpdate()
|
|
101
109
|
})
|
|
110
|
+
_statefulLayout.events.on('data', () => {
|
|
111
|
+
onDataUpdate()
|
|
112
|
+
})
|
|
102
113
|
emit('update:state', _statefulLayout)
|
|
103
114
|
_statefulLayout.events.on('autofocus', () => {
|
|
104
115
|
if (!el.value) return
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
|
-
$emit: ((event: "update:
|
|
2
|
+
$emit: ((event: "update:state", state: import("../types.js").VjsfStatefulLayout) => void) & ((event: "update:modelValue", data: any) => void);
|
|
3
3
|
options: Partial<Omit<import("../types.js").VjsfOptions, "width">> | null;
|
|
4
4
|
modelValue: any;
|
|
5
5
|
schema: Record<string, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-vjsf.d.ts","sourceRoot":"","sources":["../../src/composables/use-vjsf.js"],"names":[],"mappings":"AAUA;IACE;;MAEE;gCADO,GAAG;IAGZ;;MAEE;4BADO,OAAO,aAAa,EAAE,kBAAkB;EAGlD;AAWM,gCARI,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,OAAO,MAAM,EAAE,OAAO,KAAK,EAAE,SAAS,CAAC,QACvC,GAAG;;;;
|
|
1
|
+
{"version":3,"file":"use-vjsf.d.ts","sourceRoot":"","sources":["../../src/composables/use-vjsf.js"],"names":[],"mappings":"AAUA;IACE;;MAEE;gCADO,GAAG;IAGZ;;MAEE;4BADO,OAAO,aAAa,EAAE,kBAAkB;EAGlD;AAWM,gCARI,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,OAAO,MAAM,EAAE,OAAO,KAAK,EAAE,SAAS,CAAC,QACvC,GAAG;;;;EAsHb"}
|