1
1
import { inject , ref , computed } from 'vue'
2
2
import { type UseEventBusReturn , useDebounceFn } from '@vueuse/core'
3
3
import type { FormEvent , FormEventType , InjectedFormGroupValue } from '../types/form'
4
- import { mergeConfig } from '../utils'
5
- // @ts -expect-error
6
- import appConfig from '#build/app.config'
7
- import { formGroup } from '#ui/ui.config'
8
4
9
5
type InputProps = {
10
6
id ?: string
@@ -16,8 +12,6 @@ type InputProps = {
16
12
}
17
13
18
14
19
- const formGroupConfig = mergeConfig < typeof formGroup > ( appConfig . ui . strategy , appConfig . ui . formGroup , formGroup )
20
-
21
15
export const useFormGroup = ( inputProps ?: InputProps , config ?: any ) => {
22
16
const formBus = inject < UseEventBusReturn < FormEvent , string > | undefined > ( 'form-events' , undefined )
23
17
const formGroup = inject < InjectedFormGroupValue | undefined > ( 'form-group' , undefined )
@@ -62,7 +56,7 @@ export const useFormGroup = (inputProps?: InputProps, config?: any) => {
62
56
name : computed ( ( ) => inputProps ?. name ?? formGroup ?. name . value ) ,
63
57
size : computed ( ( ) => {
64
58
const formGroupSize = config . size [ formGroup ?. size . value as string ] ? formGroup ?. size . value : null
65
- return inputProps ?. size ?? formGroupSize ?? formGroupConfig ? .default ?. size
59
+ return inputProps ?. size ?? formGroupSize ?? config . default ?. size
66
60
} ) ,
67
61
color : computed ( ( ) => formGroup ?. error ?. value ? 'red' : inputProps ?. color ) ,
68
62
emitFormBlur,
0 commit comments