fix: incorrect variable input style (#6645)

* fix: textarea variable style issue

* fix: variable input border radius not correct

* fix: unit tests error
This commit is contained in:
gchust 2025-04-11 20:46:31 +08:00 committed by GitHub
parent 9f8fb0e362
commit b20c8b05bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 182 additions and 176 deletions

View File

@ -398,9 +398,8 @@ export function Input(props: VariableInputProps) {
const disabled = props.disabled || form.disabled; const disabled = props.disabled || form.disabled;
return wrapSSR( return wrapSSR(
<>
<Space.Compact style={style} className={classNames(componentCls, hashId, className)}> <Space.Compact style={style} className={classNames(componentCls, hashId, className)}>
{/* 确保所有ant input样式都已加载 */}
<AntInput style={{ display: 'none' }} />
{variable ? ( {variable ? (
<div <div
className={cx( className={cx(
@ -497,6 +496,9 @@ export function Input(props: VariableInputProps) {
)} )}
</Cascader> </Cascader>
)} )}
</Space.Compact>, </Space.Compact>
{/* 确保所有ant input样式都已加载, 放到Compact中会导致Compact中的Input样式不对 */}
<AntInput style={{ display: 'none' }} />
</>,
); );
} }

View File

@ -9,7 +9,7 @@
import { css, cx } from '@emotion/css'; import { css, cx } from '@emotion/css';
import { useForm } from '@formily/react'; import { useForm } from '@formily/react';
import { Space, theme } from 'antd'; import { Input as AntInput, Space, theme } from 'antd';
import type { CascaderProps, DefaultOptionType } from 'antd/lib/cascader'; import type { CascaderProps, DefaultOptionType } from 'antd/lib/cascader';
import useInputStyle from 'antd/es/input/style'; import useInputStyle from 'antd/es/input/style';
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
@ -422,6 +422,7 @@ export function TextArea(props: TextAreaProps) {
); );
const disabled = props.disabled || form.disabled; const disabled = props.disabled || form.disabled;
return wrapSSR( return wrapSSR(
<>
<Space.Compact <Space.Compact
className={cx( className={cx(
componentCls, componentCls,
@ -510,7 +511,10 @@ export function TextArea(props: TextAreaProps) {
fieldNames={fieldNames || defaultFieldNames} fieldNames={fieldNames || defaultFieldNames}
disabled={disabled} disabled={disabled}
/> />
</Space.Compact>, </Space.Compact>
{/* 确保所有ant input样式都已加载, 放到Compact中会导致Compact中的Input样式不对 */}
<AntInput style={{ display: 'none' }} />
</>,
); );
} }