@koumoul/vjsf 3.0.0-beta.5 → 3.0.0-beta.7
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.7",
|
|
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.12.0",
|
|
79
79
|
"@vueuse/core": "^10.5.0",
|
|
80
80
|
"debug": "^4.3.4",
|
|
81
81
|
"ejs": "^3.1.9"
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { StatefulLayout, produceCompileOptions } from '@json-layout/core'
|
|
2
|
-
import { inject,
|
|
2
|
+
import { inject, shallowRef, computed, ref, watch, useSlots } from 'vue'
|
|
3
3
|
import { useElementSize } from '@vueuse/core'
|
|
4
4
|
import { getFullOptions } from '../components/options.js'
|
|
5
5
|
import { registeredNodeComponents } from '../utils/index.js'
|
|
6
|
+
import { setAutoFreeze } from 'immer'
|
|
7
|
+
|
|
8
|
+
// immer freezing is disabled because it is not compatible with Vue 3 reactivity
|
|
9
|
+
setAutoFreeze(false)
|
|
6
10
|
|
|
7
11
|
export const emits = {
|
|
8
12
|
/**
|
|
@@ -49,7 +53,7 @@ export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compi
|
|
|
49
53
|
|
|
50
54
|
const slots = useSlots()
|
|
51
55
|
|
|
52
|
-
const fullOptions = computed(() => getFullOptions(options.value, form, width.value, slots, { ...nodeComponents, ...
|
|
56
|
+
const fullOptions = computed(() => getFullOptions(options.value, form, width.value, slots, { ...nodeComponents, ...registeredNodeComponents.value }))
|
|
53
57
|
|
|
54
58
|
// do not use a simple computed here as we want to prevent recompiling the layout when the options are the same
|
|
55
59
|
/** @type {import('vue').Ref<import('@json-layout/core').PartialCompileOptions>} */
|
|
@@ -85,10 +89,10 @@ export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compi
|
|
|
85
89
|
|
|
86
90
|
// @ts-ignore
|
|
87
91
|
const _statefulLayout = /** @type {import('../types.js').VjsfStatefulLayout} */(new StatefulLayout(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
compiledLayout.value,
|
|
93
|
+
compiledLayout.value.skeletonTree,
|
|
94
|
+
fullOptions.value,
|
|
95
|
+
modelValue.value
|
|
92
96
|
))
|
|
93
97
|
statefulLayout.value = _statefulLayout
|
|
94
98
|
onStatefulLayoutUpdate()
|
|
@@ -118,7 +122,7 @@ export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compi
|
|
|
118
122
|
|
|
119
123
|
// case where data is updated from outside
|
|
120
124
|
watch(modelValue, (newData) => {
|
|
121
|
-
if (statefulLayout.value && statefulLayout.value.data !== newData) statefulLayout.value.data =
|
|
125
|
+
if (statefulLayout.value && statefulLayout.value.data !== newData) statefulLayout.value.data = newData
|
|
122
126
|
})
|
|
123
127
|
|
|
124
128
|
// case where schema or compile options are updated from outside
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-vjsf.d.ts","sourceRoot":"","sources":["../../src/composables/use-vjsf.js"],"names":[],"mappings":"
|
|
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;;;;EA2Gb"}
|