@koumoul/vjsf 3.0.0-alpha.6 → 3.0.0-alpha.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-alpha.6",
3
+ "version": "3.0.0-alpha.7",
4
4
  "description": "Generate forms for the vuetify UI library (vuejs) based on annotated JSON schemas.",
5
5
  "scripts": {
6
6
  "test": "vitest",
@@ -9,7 +9,6 @@ import { defaultOptions } from '<%- baseImport %>/components/options.js'
9
9
  import Tree from '<%- baseImport %>/components/tree.vue'
10
10
  import { useVjsf, emits } from '<%- baseImport %>/composables/use-vjsf.js'
11
11
  import '<%- baseImport %>/styles/vjsf.css'
12
- import { registeredNodeComponents } from '<%- baseImport %>/utils'
13
12
 
14
13
  <% compImports.forEach(function({compName, compImport}){ %>
15
14
  import <%= compName %> from '<%- compImport %>'
@@ -21,7 +20,6 @@ const nodeComponents = {
21
20
  <% compImports.forEach(function({comp, compName}){ %>
22
21
  "<%= comp %>": <%= compName %>,
23
22
  <% }); %>
24
- ...registeredNodeComponents
25
23
  }
26
24
 
27
25
  const props = defineProps({
@@ -5,7 +5,6 @@ import { compile } from '@json-layout/core'
5
5
  import Tree from './tree.vue'
6
6
  import { useVjsf, emits } from '../composables/use-vjsf.js'
7
7
  import '../styles/vjsf.css'
8
- import { registeredNodeComponents } from '../utils/index.js'
9
8
 
10
9
  import NodeSection from './nodes/section.vue'
11
10
  import NodeTextField from './nodes/text-field.vue'
@@ -51,8 +50,7 @@ const nodeComponents = {
51
50
  list: NodeList,
52
51
  combobox: NodeCombobox,
53
52
  'number-combobox': NodeNumberCombobox,
54
- 'file-input': NodeFileInput,
55
- ...registeredNodeComponents
53
+ 'file-input': NodeFileInput
56
54
  }
57
55
 
58
56
  const props = defineProps({
@@ -2,6 +2,7 @@ import { StatefulLayout } from '@json-layout/core'
2
2
  import { inject, toRaw, shallowRef, computed, ref, watch, useSlots } from 'vue'
3
3
  import { useElementSize } from '@vueuse/core'
4
4
  import { getFullOptions } from '../components/options.js'
5
+ import { registeredNodeComponents } from '../utils/index.js'
5
6
 
6
7
  export const emits = {
7
8
  /**
@@ -48,7 +49,7 @@ export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compi
48
49
 
49
50
  const slots = useSlots()
50
51
 
51
- const fullOptions = computed(() => getFullOptions(options.value, form, width.value, slots, nodeComponents))
52
+ const fullOptions = computed(() => getFullOptions(options.value, form, width.value, slots, { ...nodeComponents, ...toRaw(registeredNodeComponents.value) }))
52
53
 
53
54
  const compiledLayout = computed(() => {
54
55
  if (precompiledLayout?.value) return precompiledLayout?.value
@@ -1,10 +1,12 @@
1
- /** @type {Record<string, import('vue').Component>} */
2
- export const registeredNodeComponents = {}
1
+ import { ref } from 'vue'
2
+
3
+ /** @type {import('vue').Ref<Record<string, import('vue').Component>>} */
4
+ export const registeredNodeComponents = ref({})
3
5
 
4
6
  /**
5
7
  * @param {string} name
6
8
  * @param {import('vue').Component} component
7
9
  */
8
10
  export function registerNodeComponent (name, component) {
9
- registeredNodeComponents[name] = component
11
+ registeredNodeComponents.value[name] = component
10
12
  }