Merge pull request #7427 from steedos/feat-placeholder-filter

input-text组件的placeholder属性支持表达式 #7426
This commit is contained in:
hsm-lv 2023-07-13 09:09:55 +08:00 committed by GitHub
commit 8170072e7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -680,6 +680,7 @@ export default class TextControl extends React.PureComponent<
creatable,
borderMode,
showCounter,
data,
maxLength,
minLength,
translate: __,
@ -733,6 +734,8 @@ export default class TextControl extends React.PureComponent<
});
}
const filteredPlaceholder = filter(placeholder, data);
return (
<div
className={cx(
@ -749,12 +752,12 @@ export default class TextControl extends React.PureComponent<
onClick={this.handleClick}
>
<>
{placeholder &&
{filteredPlaceholder &&
!selectedOptions.length &&
!this.state.inputValue &&
!this.state.isFocused ? (
<div className={cx('TextControl-placeholder')}>
{placeholder}
{filteredPlaceholder}
</div>
) : null}
@ -938,7 +941,7 @@ export default class TextControl extends React.PureComponent<
) : null}
<Input
name={name}
placeholder={placeholder}
placeholder={filter(placeholder, data)}
ref={this.inputRef}
disabled={disabled}
readOnly={readOnly}