diff --git a/apps/www/src/lib/registry/new-york/example/AutoForm.vue b/apps/www/src/lib/registry/new-york/example/AutoForm.vue index a719660b..6f0f04bb 100644 --- a/apps/www/src/lib/registry/new-york/example/AutoForm.vue +++ b/apps/www/src/lib/registry/new-york/example/AutoForm.vue @@ -1,13 +1,12 @@ diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/AutoForm.vue b/apps/www/src/lib/registry/new-york/ui/auto-form/AutoForm.vue index d722c4fb..fd3e4895 100644 --- a/apps/www/src/lib/registry/new-york/ui/auto-form/AutoForm.vue +++ b/apps/www/src/lib/registry/new-york/ui/auto-form/AutoForm.vue @@ -10,6 +10,10 @@ const props = defineProps<{ fieldConfig?: Config> }>() +const emits = defineEmits<{ + submit: [event: Event] +}>() + const shapes = computed(() => { // @ts-expect-error ignore {} not assignable to object const val: { [key in keyof T]: Shape } = {} @@ -33,11 +37,11 @@ const shapes = computed(() => { - + - + - - + + + + {{ config?.label || beautifyObjectName(name) }} diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Date.vue b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Date.vue index 00aaa6ed..3b082c7c 100644 --- a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Date.vue +++ b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Date.vue @@ -23,31 +23,33 @@ const df = new DateFormatter('en-US', { - + {{ config?.label || beautifyObjectName(name) }} - - - - - - {{ componentField.modelValue ? df.format(componentField.modelValue.toDate(getLocalTimeZone())) : "Pick a date" }} - - - - - - - + + + + + + + {{ slotProps.componentField.modelValue ? df.format(slotProps.componentField.modelValue.toDate(getLocalTimeZone())) : "Pick a date" }} + + + + + + + + diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Enum.vue b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Enum.vue index d5fea748..4e2a92bc 100644 --- a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Enum.vue +++ b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Enum.vue @@ -19,29 +19,31 @@ const computedOptions = computed(() => props.config?.enumProps?.options || props - + {{ config?.label || beautifyObjectName(name) }} - - - - {{ beautifyObjectName(option) }} - - + + + + + {{ beautifyObjectName(option) }} + + - - - - - - - {{ beautifyObjectName(option) }} - - - + + + + + + + {{ beautifyObjectName(option) }} + + + + diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/File.vue b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/File.vue index 5fb734e9..c64ed64f 100644 --- a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/File.vue +++ b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/File.vue @@ -28,21 +28,23 @@ async function parseFileAsString(file: File | undefined): Promise { - + {{ config?.label || beautifyObjectName(name) }} - { - const file = (ev.target as HTMLInputElement).files?.[0] - const parsed = await parseFileAsString(file) - componentField.onInput(parsed) - }" - /> + + { + const file = (ev.target as HTMLInputElement).files?.[0] + const parsed = await parseFileAsString(file) + slotProps.componentField.onInput(parsed) + }" + /> + {{ config.description }} diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Input.vue b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Input.vue index b541cba9..71984999 100644 --- a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Input.vue +++ b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Input.vue @@ -14,14 +14,16 @@ defineProps<{ - + {{ config?.label || beautifyObjectName(name) }} - - + + + + {{ config.description }} diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Number.vue b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Number.vue index b95b9514..342863ad 100644 --- a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Number.vue +++ b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Number.vue @@ -17,13 +17,15 @@ defineProps<{ - + {{ config?.label || beautifyObjectName(name) }} - + + + {{ config.description }} diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Object.vue b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Object.vue index 13605761..7ea7c41b 100644 --- a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Object.vue +++ b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Object.vue @@ -49,20 +49,24 @@ const shapes = computed(() => { - - - - {{ schema?.description || beautifyObjectName(name) }} - - - - - - - - + + + + + + {{ schema?.description || beautifyObjectName(name) }} + + + + + + + + + + diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/index.ts b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/index.ts new file mode 100644 index 00000000..69959bbd --- /dev/null +++ b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/index.ts @@ -0,0 +1,7 @@ +export { default as AutoFormFieldBoolean } from './Boolean.vue' +export { default as AutoFormFieldDate } from './Date.vue' +export { default as AutoFormFieldEnum } from './Enum.vue' +export { default as AutoFormFieldFile } from './File.vue' +export { default as AutoFormFieldInput } from './Input.vue' +export { default as AutoFormFieldNumber } from './Number.vue' +export { default as AutoFormFieldObject } from './Object.vue' diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/index.ts b/apps/www/src/lib/registry/new-york/ui/auto-form/index.ts index 6d3ca863..4f2ce1d4 100644 --- a/apps/www/src/lib/registry/new-york/ui/auto-form/index.ts +++ b/apps/www/src/lib/registry/new-york/ui/auto-form/index.ts @@ -1,2 +1,6 @@ export { default as AutoForm } from './AutoForm.vue' +export { default as AutoFormField } from './AutoFormField.vue' export { getObjectFormSchema, getBaseSchema, getBaseType, getDefaultValues } from './utils' +export type { Config, ConfigItem } from './interface' + +export * from './fields'