@ederzeel/nuxt-schema-form-nightly 0.1.0-29022347.538d6e6 → 0.1.0-29022475.0a845ef

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.
@@ -16,6 +16,8 @@ export type SComponentProps = {
16
16
  format?: string
17
17
  description?: string
18
18
  jsonSchemaPath?: string
19
+ required?: string[]
20
+ isRequired: boolean
19
21
  validateFields?: (fields: string[]) => Promise<boolean>
20
22
  }
21
23
 
@@ -7,6 +7,7 @@ const props = defineProps<{
7
7
  title?: string
8
8
  description?: string
9
9
  type: string
10
+ isRequired: boolean
10
11
  }>()
11
12
 
12
13
  const value = defineModel<string>({ required: true })
@@ -15,7 +16,12 @@ const date = ref(new Date(value.value))
15
16
 
16
17
  <template>
17
18
  <div>
18
- <UFormGroup :label="props.title || id" :description="props.description" :name="props.id">
19
+ <UFormGroup
20
+ :label="props.title || id"
21
+ :hint="!props.isRequired ? 'optional' : undefined"
22
+ :description="props.description"
23
+ :name="props.id"
24
+ >
19
25
  <UPopover :popper="{ placement: 'bottom-start' }">
20
26
  <UButton icon="i-heroicons-calendar-days-20-solid" :label="format(date, 'd MMM, yyy')" />
21
27
 
@@ -4,6 +4,7 @@ const props = defineProps<{
4
4
  title?: string
5
5
  description?: string
6
6
  type: string
7
+ isRequired: boolean
7
8
  }>()
8
9
 
9
10
  const value = defineModel<string | number>({ required: true })
@@ -11,7 +12,12 @@ const value = defineModel<string | number>({ required: true })
11
12
 
12
13
  <template>
13
14
  <div>
14
- <UFormGroup :label="props.title || id" :description="props.description" :name="props.id">
15
+ <UFormGroup
16
+ :label="props.title || id"
17
+ :hint="!props.isRequired ? 'optional' : undefined"
18
+ :description="props.description"
19
+ :name="props.id"
20
+ >
15
21
  <UInput v-model="value" :type="props.type" />
16
22
  </UFormGroup>
17
23
  </div>
@@ -8,6 +8,8 @@ const props = defineProps<{
8
8
  jsonSchemaPath: string
9
9
  properties: PropertiesType
10
10
  modelValue: Record<string, unknown>
11
+ required: string[]
12
+ isRequired: boolean
11
13
  }>()
12
14
 
13
15
  type PropertiesType = {
@@ -31,6 +33,7 @@ const onInput = (value: unknown, key: string) => {
31
33
  :model-value="modelValue[key]"
32
34
  :json-schema-path="jsonSchemaPath?.length <= 0 ? `properties.${key}` : `${jsonSchemaPath}.properties.${key}`"
33
35
  v-bind="options"
36
+ :isRequired="required.includes(key)"
34
37
  class="mt-4"
35
38
  @update:model-value="event => onInput(event, key)"
36
39
  />
@@ -7,6 +7,7 @@ const props = defineProps<{
7
7
  description?: string
8
8
  enum: string[]
9
9
  enum_titles: string[]
10
+ isRequired: boolean
10
11
  }>()
11
12
 
12
13
  const options = computed(() => props.enum.map((x, i) => ({ key: props?.enum_titles?.[i] ?? x, value: x })))
@@ -16,7 +17,12 @@ const value = defineModel<string>({ required: true })
16
17
 
17
18
  <template>
18
19
  <div>
19
- <UFormGroup :label="props.title || id" :description="props.description" :name="props.id">
20
+ <UFormGroup
21
+ :label="props.title || id"
22
+ :hint="!props.isRequired ? 'optional' : undefined"
23
+ :description="props.description"
24
+ :name="props.id"
25
+ >
20
26
  <USelect
21
27
  v-model="value"
22
28
  placeholder="select size"
@@ -3,6 +3,7 @@ const props = defineProps<{
3
3
  id: string
4
4
  title?: string
5
5
  description?: string
6
+ isRequired: boolean
6
7
  }>()
7
8
 
8
9
  const value = defineModel<string | number>({ required: true })
@@ -10,7 +11,12 @@ const value = defineModel<string | number>({ required: true })
10
11
 
11
12
  <template>
12
13
  <div>
13
- <UFormGroup :label="props.title || id" :description="props.description" :name="props.id">
14
+ <UFormGroup
15
+ :label="props.title || id"
16
+ :hint="!props.isRequired ? 'optional' : undefined"
17
+ :description="props.description"
18
+ :name="props.id"
19
+ >
14
20
  <UTextarea v-model="value" v-bind="properties" />
15
21
  </UFormGroup>
16
22
  </div>
@@ -3,6 +3,8 @@ const props = defineProps<{
3
3
  id: string
4
4
  title?: string
5
5
  description?: string
6
+ enum?: boolean[]
7
+ isRequired: boolean
6
8
  }>()
7
9
 
8
10
  const value = defineModel<boolean>({ required: true })
@@ -10,7 +12,12 @@ const value = defineModel<boolean>({ required: true })
10
12
 
11
13
  <template>
12
14
  <div>
13
- <UFormGroup :label="props.title || id" :description="props.description" :name="props.id">
15
+ <UFormGroup
16
+ :label="props.title || id"
17
+ :hint="!props.isRequired ? 'optional' : undefined"
18
+ :description="props.description"
19
+ :name="props.id"
20
+ >
14
21
  <UToggle v-model="value" />
15
22
  </UFormGroup>
16
23
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ederzeel/nuxt-schema-form-nightly",
3
- "version": "0.1.0-29022347.538d6e6",
3
+ "version": "0.1.0-29022475.0a845ef",
4
4
  "description": "A runtime form generator for nuxt",
5
5
  "type": "module",
6
6
  "exports": {
@@ -47,7 +47,6 @@
47
47
  "@nuxt/kit": "^3.15.4",
48
48
  "@nuxt/module-builder": "^0.8.4",
49
49
  "@types/eslint": "^9.6.1",
50
- "date-fns": "^4.1.0",
51
50
  "eslint": "^9.19.0",
52
51
  "eslint-config-prettier": "^10.0.1",
53
52
  "globals": "^15.14.0",
@@ -69,6 +68,9 @@
69
68
  "v-calendar": "^3.1.2",
70
69
  "yup": "^1.6.1"
71
70
  },
71
+ "dependencies": {
72
+ "date-fns": "^4.1.0"
73
+ },
72
74
  "resolutions": {
73
75
  "@ederzeel/nuxt-schema-form": "workspace:*"
74
76
  },