feat: input-text 支持配置 nativeAutoComplete 比如可用来配置支持浏览器生成默认密码 Close: #4471 (#8465)

This commit is contained in:
liaoxuezhi 2023-10-24 14:28:48 +08:00 committed by GitHub
parent 0016137975
commit 994fba3166
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 5 deletions

View File

@ -439,6 +439,7 @@ order: 56
| borderMode | `"full"\| "half" \| "none"` | `"full"` | 输入框边框模式,全边框,还是半边框,或者没边框。 |
| inputControlClassName | `string` | | control 节点的 CSS 类名 |
| nativeInputClassName | `string` | | 原生 input 标签的 CSS 类名 |
| nativeAutoComplete | `string` | `off` | 原生 input 标签的 `autoComplete` 属性,比如配置集成 `new-password` |
## 事件表

View File

@ -64,6 +64,12 @@ export interface TextControlSchema extends FormOptionsSchema {
*/
autoComplete?: SchemaApi;
/**
* input autoComplete
* @default off
*/
nativeAutoComplete?: string;
/**
*
*/
@ -199,7 +205,8 @@ export default class TextControl extends React.PureComponent<
valueField: 'value',
placeholder: '',
allowInputText: true,
trimContents: true
trimContents: true,
nativeAutoComplete: 'off'
};
componentDidMount() {
@ -699,7 +706,8 @@ export default class TextControl extends React.PureComponent<
popOverContainer,
themeCss,
css,
id
id,
nativeAutoComplete
} = this.props;
let type = this.props.type?.replace(/^(?:native|input)\-/, '');
@ -816,7 +824,7 @@ export default class TextControl extends React.PureComponent<
maxLength,
minLength
})}
autoComplete="off"
autoComplete={nativeAutoComplete}
size={10}
className={cx(nativeInputClassName)}
/>
@ -943,7 +951,8 @@ export default class TextControl extends React.PureComponent<
minLength,
themeCss,
css,
id
id,
nativeAutoComplete
} = this.props;
const type = this.props.type?.replace(/^(?:native|input)\-/, '');
@ -984,7 +993,7 @@ export default class TextControl extends React.PureComponent<
min={min}
maxLength={maxLength}
minLength={minLength}
autoComplete="off"
autoComplete={nativeAutoComplete}
size={10}
step={step}
onChange={this.handleNormalInputChange}