mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-22 16:00:39 +01:00
fix(FormGroup): remove inputId if the input is a fieldset (#914)
This commit is contained in:
@@ -99,7 +99,7 @@ export default defineComponent({
|
||||
const { ui, attrs } = useUI('radioGroup', toRef(props, 'ui'), config, toRef(props, 'class'))
|
||||
const { ui: uiRadio } = useUI('radio', toRef(props, 'uiRadio'), configRadio)
|
||||
|
||||
const { emitFormChange, color, name } = useFormGroup(props, config)
|
||||
const { emitFormChange, color, name } = useFormGroup({ ...props, isFieldset: true }, config)
|
||||
provide('radio-group', { color, name })
|
||||
|
||||
const onUpdate = (value: any) => {
|
||||
|
||||
@@ -3,10 +3,11 @@ import { type UseEventBusReturn, useDebounceFn } from '@vueuse/core'
|
||||
import type { FormEvent, FormEventType, InjectedFormGroupValue } from '../types/form'
|
||||
|
||||
type InputProps = {
|
||||
id?: string
|
||||
id?: string | null
|
||||
size?: string | number | symbol
|
||||
color?: string
|
||||
name?: string
|
||||
isFieldset?: boolean
|
||||
}
|
||||
|
||||
export const useFormGroup = (inputProps?: InputProps, config?: any) => {
|
||||
@@ -17,7 +18,7 @@ export const useFormGroup = (inputProps?: InputProps, config?: any) => {
|
||||
const inputId = ref(inputProps?.id)
|
||||
|
||||
onMounted(() => {
|
||||
inputId.value = inputProps?.id ?? formGroup?.inputId.value
|
||||
inputId.value = inputProps?.isFieldset ? null : inputProps?.id ?? formGroup?.inputId.value
|
||||
if (formGroup) {
|
||||
// Updates for="..." attribute on label if inputProps.id is provided
|
||||
formGroup.inputId.value = inputId.value
|
||||
|
||||
Reference in New Issue
Block a user