@koumoul/vjsf 3.5.0 → 3.6.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.5.0",
3
+ "version": "3.6.0",
4
4
  "description": "Generate forms for the vuetify UI library (vuejs) based on annotated JSON schemas.",
5
5
  "scripts": {
6
6
  "test": "vitest",
@@ -70,7 +70,7 @@
70
70
  "vuetify": "^3.6.13"
71
71
  },
72
72
  "dependencies": {
73
- "@json-layout/core": "~1.2.1",
73
+ "@json-layout/core": "~1.3.0",
74
74
  "@vueuse/core": "^10.5.0",
75
75
  "debug": "^4.3.4"
76
76
  },
@@ -50,7 +50,7 @@ const nodeClasses = computed(() => {
50
50
  return classes
51
51
  })
52
52
 
53
- if (props.modelValue.layout.comp !== 'none' && !props.statefulLayout.options.nodeComponents[props.modelValue.layout.comp]) {
53
+ if (props.modelValue.layout.comp !== 'none' && !props.modelValue.slots?.component && !props.statefulLayout.options.nodeComponents[props.modelValue.layout.comp]) {
54
54
  console.error(`vjsf: missing component to render vjsf node "${props.modelValue.layout.comp}", maybe you forgot to register a component from a plugin ?`)
55
55
  }
56
56
 
@@ -64,9 +64,9 @@ if (props.modelValue.layout.comp !== 'none' && !props.statefulLayout.options.nod
64
64
  :class="nodeClasses"
65
65
  >
66
66
  <node-slot
67
- v-if="modelValue.layout.slots?.before"
67
+ v-if="modelValue.slots?.before"
68
68
  key="before"
69
- :layout-slot="modelValue.layout.slots?.before"
69
+ :layout-slot="modelValue.slots?.before"
70
70
  :node="modelValue"
71
71
  :stateful-layout="statefulLayout"
72
72
  :class="beforeAfterClasses[modelValue.options.density]"
@@ -77,9 +77,9 @@ if (props.modelValue.layout.comp !== 'none' && !props.statefulLayout.options.nod
77
77
  :node="modelValue"
78
78
  />
79
79
  <node-slot
80
- v-if="modelValue.layout.slots?.component"
80
+ v-if="modelValue.slots?.component"
81
81
  key="component"
82
- :layout-slot="modelValue.layout.slots?.component"
82
+ :layout-slot="modelValue.slots?.component"
83
83
  :node="modelValue"
84
84
  :stateful-layout="statefulLayout"
85
85
  />
@@ -91,9 +91,9 @@ if (props.modelValue.layout.comp !== 'none' && !props.statefulLayout.options.nod
91
91
  />
92
92
 
93
93
  <node-slot
94
- v-if="modelValue.layout.slots?.after"
94
+ v-if="modelValue.slots?.after"
95
95
  key="after"
96
- :layout-slot="modelValue.layout.slots?.after"
96
+ :layout-slot="modelValue.slots?.after"
97
97
  :node="modelValue"
98
98
  :stateful-layout="statefulLayout"
99
99
  :class="beforeAfterClasses[modelValue.options.density]"
@@ -1,6 +1,6 @@
1
1
  import { useDefaults, useLocale } from 'vuetify'
2
2
  import { StatefulLayout, produceCompileOptions } from '@json-layout/core'
3
- import { inject, toRaw, shallowRef, computed, ref, watch, useSlots, getCurrentInstance } from 'vue'
3
+ import { inject, toRaw, shallowRef, computed, ref, watch, useSlots, getCurrentInstance, nextTick } from 'vue'
4
4
  import { useElementSize } from '@vueuse/core'
5
5
  import { getFullOptions } from '../options.js'
6
6
  import { setAutoFreeze } from 'immer'
@@ -88,9 +88,10 @@ export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compi
88
88
  /**
89
89
  * @param {any} data
90
90
  */
91
- const onDataUpdate = (data) => {
91
+ const onDataUpdate = async (data) => {
92
92
  debug('onDataUpdate', data)
93
93
  debug(' -> emit update:modelValue')
94
+ await nextTick() // necessary for form validation to be applied before emitting new data
94
95
  emit('update:modelValue', data)
95
96
  }
96
97
  const onAutofocus = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"use-vjsf.d.ts","sourceRoot":"","sources":["../../src/composables/use-vjsf.js"],"names":[],"mappings":"AAaA;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;;;;EA6Ib"}
1
+ {"version":3,"file":"use-vjsf.d.ts","sourceRoot":"","sources":["../../src/composables/use-vjsf.js"],"names":[],"mappings":"AAaA;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;;;;EA8Ib"}