@ederzeel/nuxt-schema-form-nightly 0.1.0-29121833.6b9ae9c → 0.1.0-29133424.d9577c2

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/README.md CHANGED
@@ -14,10 +14,10 @@ Runtime form generation for Nuxt apps.
14
14
 
15
15
  ```ts
16
16
  <script lang="ts" setup>
17
- import { Draft2019 } from 'json-schema-library'
17
+ import { compileSchema } from 'json-schema-library'
18
18
 
19
19
  const schemaObject = ref(
20
- new Draft2019({
20
+ compileSchema({
21
21
  title: 'From',
22
22
  description: 'A minimal form example',
23
23
  type: 'object',
@@ -33,8 +33,8 @@ const schemaObject = ref(
33
33
  })
34
34
  )
35
35
 
36
- const schema = ref(schemaObject.value.rootSchema)
37
- const state = ref(schemaObject.value.getTemplate())
36
+ const schema = ref(schemaObject.value.getNode().node.schema)
37
+ const state = ref(schemaObject.value.getData())
38
38
  </script>
39
39
 
40
40
  <template>
@@ -7,7 +7,7 @@ const props = defineProps<{
7
7
  isRequired: boolean
8
8
  }>()
9
9
 
10
- const value = defineModel<string>({ required: true, default: '' })
10
+ const value = defineModel<string>()
11
11
  </script>
12
12
 
13
13
  <template>
@@ -37,7 +37,7 @@ const value = defineModel<string[]>({ required: true })
37
37
  >
38
38
  <USelect
39
39
  v-model="value"
40
- :placeholder="props.placeholder || 'select size'"
40
+ :placeholder="props.placeholder || 'Make a selection'"
41
41
  :items="options"
42
42
  multiple
43
43
  value-attribute="value"
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { Draft2019 } from 'json-schema-library'
2
+ import { compileSchema } from 'json-schema-library'
3
3
  import SComponent from '../Component.vue'
4
4
  import { ref, computed, h, resolveComponent } from 'vue'
5
5
  import type { TableColumn } from '@nuxt/ui'
@@ -38,7 +38,7 @@ const massActions = [
38
38
  ]
39
39
 
40
40
  const selectedRows = ref<{ __id: any }[]>([])
41
- const schemaObject = ref(new Draft2019(props.items))
41
+ const schemaObject = ref(compileSchema(props.items))
42
42
  const model = ref<{ open: boolean; index: number; value: Record<string, unknown> }>({
43
43
  open: false,
44
44
  index: 0,
@@ -53,7 +53,7 @@ const values = computed(() => {
53
53
  if (props.modelValue.length > 0) {
54
54
  return props.modelValue.map((x, i) => ({ ...x, __id: i }))
55
55
  } else if (props.minItems && props.minItems > 0) {
56
- const template = schemaObject.value.getTemplate()
56
+ const template = schemaObject.value.getData()
57
57
  return [...Array(props.minItems)].map((_, i) => ({ ...template, __id: i }))
58
58
  }
59
59
 
@@ -172,7 +172,7 @@ const onInput = (value: Record<string, unknown>, index: number) => {
172
172
  }
173
173
 
174
174
  const add = () => {
175
- emit('update:modelValue', [...props.modelValue, schemaObject.value.getTemplate()])
175
+ emit('update:modelValue', [...props.modelValue, schemaObject.value.getData()])
176
176
  }
177
177
 
178
178
  const remove = (index: number) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ederzeel/nuxt-schema-form-nightly",
3
- "version": "0.1.0-29121833.6b9ae9c",
3
+ "version": "0.1.0-29133424.d9577c2",
4
4
  "description": "A runtime form generator for nuxt",
5
5
  "type": "module",
6
6
  "exports": {
@@ -58,7 +58,7 @@
58
58
  "eslint-config-prettier": "^10.0.1",
59
59
  "globals": "^15.14.0",
60
60
  "jiti": "^2.4.2",
61
- "json-schema-library": "10.0.0-rc7",
61
+ "json-schema-library": "10.0.0",
62
62
  "magic-string": "^0.30.17",
63
63
  "mlly": "^1.7.4",
64
64
  "nuxt": "^3.16.0",