@falcondev-oss/nuxt-layers-base 0.27.0 → 0.27.1
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.
|
@@ -9,7 +9,16 @@ const form = useForm({
|
|
|
9
9
|
schema: z.object({
|
|
10
10
|
duration: z.number().meta({ title: 'Duration' }),
|
|
11
11
|
dateIso: z.string().meta({ title: 'Datum' }),
|
|
12
|
-
text: z
|
|
12
|
+
text: z
|
|
13
|
+
.string()
|
|
14
|
+
.min(3)
|
|
15
|
+
.max(10)
|
|
16
|
+
.meta({
|
|
17
|
+
title: 'Text',
|
|
18
|
+
description: 'Beschreibung',
|
|
19
|
+
default: 'Default Wert',
|
|
20
|
+
examples: ['Hier könnte ein Beispieltext stehen', '123'],
|
|
21
|
+
}),
|
|
13
22
|
}),
|
|
14
23
|
sourceValues: () => ({
|
|
15
24
|
dateIso: null,
|
|
@@ -60,7 +60,7 @@ const formFieldProps = computed<FormFieldProps>(() => {
|
|
|
60
60
|
const bind = computed(() => {
|
|
61
61
|
const field = forwardedProps.value.field
|
|
62
62
|
|
|
63
|
-
const placeholder = field.errors && field.errors.join('\n')
|
|
63
|
+
const placeholder = (field.errors && field.errors.join('\n')) || field.schema.default?.toString()
|
|
64
64
|
|
|
65
65
|
return {
|
|
66
66
|
'modelValue': field.value,
|
|
@@ -115,6 +115,19 @@ const model_ = { model }
|
|
|
115
115
|
</span>
|
|
116
116
|
</template>
|
|
117
117
|
|
|
118
|
+
<template #help>
|
|
119
|
+
<template v-if="Array.isArray(field.schema.examples)">
|
|
120
|
+
<ul>
|
|
121
|
+
<li v-for="(example, index) in field.schema.examples" :key="index">
|
|
122
|
+
{{ example }}
|
|
123
|
+
</li>
|
|
124
|
+
</ul>
|
|
125
|
+
</template>
|
|
126
|
+
<p v-else-if="field.schema.examples">
|
|
127
|
+
{{ field.schema.examples }}
|
|
128
|
+
</p>
|
|
129
|
+
</template>
|
|
130
|
+
|
|
118
131
|
<slot v-bind="{ bind, model: model_.model, field: forwardedProps.field }">
|
|
119
132
|
<DevOnly>
|
|
120
133
|
<p class="font-black text-red-500">UField missing slot</p>
|
|
@@ -132,6 +145,7 @@ const model_ = { model }
|
|
|
132
145
|
:deep([aria-invalid='true']) {
|
|
133
146
|
&::placeholder {
|
|
134
147
|
color: var(--ui-color-error-500);
|
|
148
|
+
opacity: 0.5;
|
|
135
149
|
}
|
|
136
150
|
}
|
|
137
151
|
</style>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@falcondev-oss/nuxt-layers-base",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.27.
|
|
4
|
+
"version": "0.27.1",
|
|
5
5
|
"description": "Nuxt layer with lots of useful helpers and @nuxt/ui components",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "github:falcondev-oss/nuxt-layers",
|