Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(FormGroup): ensure size exists in config #695

Merged
merged 9 commits into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/runtime/components/forms/Range.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default defineComponent({
setup (props, { emit }) {
const { ui, attrs, attrsClass } = useUI('range', props.ui, config)

const { emitFormChange, inputId, color, size, name } = useFormGroup(props, config)
const { emitFormChange, inputId, color, size, name } = useFormGroup(props, ui)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const { emitFormChange, inputId, color, size, name } = useFormGroup(props, ui)
const { emitFormChange, inputId, color, size, name } = useFormGroup(props, config)


const value = computed({
get () {
Expand Down
5 changes: 4 additions & 1 deletion src/runtime/composables/useFormGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ export const useFormGroup = (inputProps?: InputProps, config?: any) => {
return {
inputId: computed(() => inputProps.id ?? formGroup?.inputId.value),
name: computed(() => inputProps?.name ?? formGroup?.name.value),
size: computed(() => inputProps?.size ?? formGroup?.size.value ?? config?.default?.size),
size: computed(() => {
Levy-from-Odessa marked this conversation as resolved.
Show resolved Hide resolved
const formGroupSize = config.size[formGroup?.size.value] ? formGroup?.size.value : null
return inputProps?.size ?? formGroupSize ?? config?.default?.size
}),
benjamincanac marked this conversation as resolved.
Show resolved Hide resolved
color: computed(() => formGroup?.error?.value ? 'red' : inputProps?.color),
emitFormBlur,
emitFormInput,
Expand Down