chore: cleanup, log on the docs

This commit is contained in:
zernonia 2024-04-17 00:12:03 +08:00
parent 0d868693e0
commit ed054e0736
4 changed files with 10 additions and 44 deletions

View File

@ -161,13 +161,14 @@ const onSubmit = handleSubmit((values) => {
@submit="onSubmit" @submit="onSubmit"
> >
<template #username="componentField"> <template #username="componentField">
<div class="w-1/3"> <div class="border p-4 rounded-lg shadow-sm">
<AutoFormField v-bind="{ ...componentField, name: 'username' }" /> <AutoFormField v-bind="{ ...componentField, name: 'username' }" />
</div> </div>
</template> </template>
<template #password="componentField"> <template #customParent="componentField">
<div class="w-1/3"> <div class="flex items-end space-x-4">
<AutoFormField v-bind="{ ...componentField, name: 'password' }" /> <AutoFormField class="w-full" v-bind="{ ...componentField, name: 'customParent' }" />
<Button>Check</Button>
</div> </div>
</template> </template>

View File

@ -56,6 +56,8 @@ const shapes = computed(() => {
:shape="shape" :shape="shape"
/> />
</slot> </slot>
{{ shape.schema }}
</template> </template>
<slot :shapes="shapes" /> <slot :shapes="shapes" />

View File

@ -26,37 +26,4 @@ defineProps<{
> >
<slot /> <slot />
</component> </component>
<!-- <FieldInput
v-if="shape.type === ZodFirstPartyTypeKind.ZodString"
:name="name"
:required="shape.required"
:config="config"
/>
<FieldInput
v-else-if="shape.type === ZodFirstPartyTypeKind.ZodNumber"
:name="name"
:required="shape.required"
type="number"
:config="config"
/>
<FieldBoolean
v-else-if="shape.type === ZodFirstPartyTypeKind.ZodBoolean"
:name="name"
:required="shape.required"
:config="config"
/>
<FieldDate
v-else-if="shape.type === ZodFirstPartyTypeKind.ZodDate"
:name="name"
:required="shape.required"
:config="config"
/>
<FieldEnum
v-else-if="shape.type === ZodFirstPartyTypeKind.ZodEnum"
:name="name"
:required="shape.required"
:config="config"
:options="shape.options"
/> -->
</template> </template>

View File

@ -6,10 +6,6 @@ import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessa
import { Input } from '@/lib/registry/new-york/ui/input' import { Input } from '@/lib/registry/new-york/ui/input'
import { Textarea } from '@/lib/registry/new-york/ui/textarea' import { Textarea } from '@/lib/registry/new-york/ui/textarea'
defineOptions({
inheritAttrs: false,
})
defineProps<{ defineProps<{
name: string name: string
required?: boolean required?: boolean
@ -19,13 +15,13 @@ defineProps<{
<template> <template>
<FormField v-slot="{ componentField }" :name="name"> <FormField v-slot="{ componentField }" :name="name">
<FormItem> <FormItem v-bind="$attrs">
<AutoFormLabel :required="required"> <AutoFormLabel :required="required">
{{ config?.label || beautifyObjectName(name) }} {{ config?.label || beautifyObjectName(name) }}
</AutoFormLabel> </AutoFormLabel>
<FormControl> <FormControl>
<Textarea v-if="config?.component === 'textarea'" type="text" v-bind="{ ...$attrs, ...componentField, ...config?.inputProps }" /> <Textarea v-if="config?.component === 'textarea'" type="text" v-bind="{ ...componentField, ...config?.inputProps }" />
<Input v-else type="text" v-bind="{ ...$attrs, ...componentField, ...config?.inputProps }" /> <Input v-else type="text" v-bind="{ ...componentField, ...config?.inputProps }" />
</FormControl> </FormControl>
<FormDescription v-if="config?.description"> <FormDescription v-if="config?.description">
{{ config.description }} {{ config.description }}