@@ -37,6 +37,9 @@ const isButtonDisabled = computed(() => !props.schema.safeParse(state).success)
3737
3838const defaults: Partial <AutoFormConfig > = {
3939 components: COMPONENTS_MAP ,
40+ theme: {
41+ wFull: true ,
42+ },
4043}
4144
4245const appConfig = computed <AutoFormConfig >(() => {
@@ -50,6 +53,9 @@ const fields = Object.entries(shape).map(([key, zodType]: [string, any]) => {
5053
5154 const meta = typeof zodType .meta === ' function' ? zodType .meta () || {} : {}
5255
56+ const defaultProps = {
57+ class: appConfig .value ?.theme ?.wFull ? ' w-full' : ' ' ,
58+ }
5359 return {
5460 key ,
5561 formField: {
@@ -58,7 +64,7 @@ const fields = Object.entries(shape).map(([key, zodType]: [string, any]) => {
5864 ... parseMeta (meta , key ),
5965 },
6066 component: meta ?.input ?.component ?? result .component ,
61- props: defu (meta ?.input ?.props , result .componentProps ?? {}),
67+ props: defu (defaultProps , meta ?.input ?.props , result .componentProps ?? {}),
6268 }
6369}).filter ((field ): field is NonNullable <typeof field > => field != null )
6470
@@ -75,7 +81,7 @@ function parseMeta(meta: any, key: string) {
7581 description: meta .description ,
7682 hint: meta .hint ,
7783 help: meta .help ,
78- class: meta .autoForm ?.floatRight ? ' flex items-center justify-between text-left' : ' ' ,
84+ class: meta .theme ?.floatRight ? ' flex items-center justify-between text-left' : ' ' ,
7985 }
8086}
8187
0 commit comments