Skip to content

Commit

Permalink
fix(VField): allow center-affix to set singleLine only if it is null
Browse files Browse the repository at this point in the history
fixes #20134
  • Loading branch information
yuwu9145 committed Jul 14, 2024
1 parent 8f871fc commit bc2f96a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/api-generator/src/locale/en/VField.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"props": {
"appendInnerIcon": "Creates a [v-icon](/api/v-icon/) component in the **append-inner** slot.",
"baseColor": "Sets the color of the input when it is not focused.",
"centerAffix": "Automatically apply **[singleLine](/api/v-field/#props-single-line)** under the hood, and vertically align **appendInner**, **prependInner**, **clearIcon**, **label** and **input field** in the center.",
"centerAffix": "Automatically apply **[singleLine](/api/v-field/#props-single-line)** when it is not explicitly set to a Boolean (when it is `null` by default), and vertically align **appendInner**, **prependInner**, **clearIcon**, **label** and **input field** in the center.",
"clearIcon": "The icon used when the **clearable** prop is set to true.",
"dirty": "Manually apply the dirty state styling.",
"disabled": "Removes the ability to click or target the input.",
Expand Down
7 changes: 5 additions & 2 deletions packages/vuetify/src/components/VField/VField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ export const makeVFieldProps = propsFactory({
persistentClear: Boolean,
prependInnerIcon: IconValue,
reverse: Boolean,
singleLine: Boolean,
singleLine: {
type: Boolean,
default: null,
},
variant: {
type: String as PropType<Variant>,
default: 'filled',
Expand Down Expand Up @@ -133,7 +136,7 @@ export const VField = genericComponent<new <T>(
const { roundedClasses } = useRounded(props)
const { rtlClasses } = useRtl()

const isSingleLine = computed(() => props.singleLine || props.centerAffix)
const isSingleLine = computed(() => props.singleLine != null ? props.singleLine : props.centerAffix)
const isActive = computed(() => props.dirty || props.active)
const hasLabel = computed(() => !isSingleLine.value && !!(props.label || slots.label))

Expand Down
2 changes: 2 additions & 0 deletions packages/vuetify/src/labs/VNumberInput/VNumberInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ export const VNumberInput = genericComponent<VNumberInputSlots>()({
props.class,
]}
{ ...textFieldProps }
centerAffix={ true }
singleLine={ false }
style={ props.style }
inputmode="decimal"
>
Expand Down

0 comments on commit bc2f96a

Please sign in to comment.