types(field): add FieldEnterKeyHint type and update enterkeyhint prop type in Field component (#13692)
This commit is contained in:
@@ -70,6 +70,7 @@ import type {
|
|||||||
FieldValidationStatus,
|
FieldValidationStatus,
|
||||||
FieldValidateTrigger,
|
FieldValidateTrigger,
|
||||||
FieldFormSharedProps,
|
FieldFormSharedProps,
|
||||||
|
FieldEnterKeyHint,
|
||||||
} from './types';
|
} from './types';
|
||||||
|
|
||||||
const [name, bem] = createNamespace('field');
|
const [name, bem] = createNamespace('field');
|
||||||
@@ -94,7 +95,7 @@ export const fieldSharedProps = {
|
|||||||
autocapitalize: String,
|
autocapitalize: String,
|
||||||
autocorrect: String,
|
autocorrect: String,
|
||||||
errorMessage: String,
|
errorMessage: String,
|
||||||
enterkeyhint: String,
|
enterkeyhint: String as PropType<FieldEnterKeyHint>,
|
||||||
clearTrigger: makeStringProp<FieldClearTrigger>('focus'),
|
clearTrigger: makeStringProp<FieldClearTrigger>('focus'),
|
||||||
formatTrigger: makeStringProp<FieldFormatTrigger>('onChange'),
|
formatTrigger: makeStringProp<FieldFormatTrigger>('onChange'),
|
||||||
spellcheck: {
|
spellcheck: {
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ Use `label-align` prop to align the input value, can be set to `center`, `right`
|
|||||||
| rules | Form validation rules | _FieldRule[]_ | - |
|
| rules | Form validation rules | _FieldRule[]_ | - |
|
||||||
| autocomplete | HTML native attribute, see [MDN - autocomplete](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) | _string_ | - |
|
| autocomplete | HTML native attribute, see [MDN - autocomplete](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) | _string_ | - |
|
||||||
| autocapitalize `v4.6.2` | HTML native attribute, see [MDN - autocapitalize](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize)<br> | _string_ | - |
|
| autocapitalize `v4.6.2` | HTML native attribute, see [MDN - autocapitalize](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize)<br> | _string_ | - |
|
||||||
| enterkeyhint | HTML native attribute, see [MDN - enterkeyhint](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint)<br> | _string_ | - |
|
| enterkeyhint | HTML native attribute, see [MDN - enterkeyhint](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint)<br> | _FieldEnterKeyHint_ | - |
|
||||||
| spellcheck `v4.6.2` | HTML native attribute, see [MDN - spellcheck](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck)<br> | _boolean_ | - |
|
| spellcheck `v4.6.2` | HTML native attribute, see [MDN - spellcheck](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck)<br> | _boolean_ | - |
|
||||||
| autocorrect `v4.6.2` | HTML native attribute, Safari only, see [MDN - autocorrect](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#autocorrect)<br> | _string_ | - |
|
| autocorrect `v4.6.2` | HTML native attribute, Safari only, see [MDN - autocorrect](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#autocorrect)<br> | _string_ | - |
|
||||||
| inputmode `v4.9.9` | HTML native attribute, see [MDN - inputmode](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode) | _string_ | Set automatically according to the `type` prop |
|
| inputmode `v4.9.9` | HTML native attribute, see [MDN - inputmode](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode) | _string_ | Set automatically according to the `type` prop |
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ export default {
|
|||||||
| rules | 表单校验规则,详见 [Form 组件](#/zh-CN/form#rule-shu-ju-jie-gou) | _FieldRule[]_ | - |
|
| rules | 表单校验规则,详见 [Form 组件](#/zh-CN/form#rule-shu-ju-jie-gou) | _FieldRule[]_ | - |
|
||||||
| autocomplete | HTML 原生属性,用于控制自动完成功能,详见 [MDN - autocomplete](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) | _string_ | - |
|
| autocomplete | HTML 原生属性,用于控制自动完成功能,详见 [MDN - autocomplete](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) | _string_ | - |
|
||||||
| autocapitalize `v4.6.2` | HTML 原生属性,用于控制文本输入时是否自动大写,此 API 仅在部分浏览器支持,详见 [MDN - autocapitalize](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize) | _string_ | - |
|
| autocapitalize `v4.6.2` | HTML 原生属性,用于控制文本输入时是否自动大写,此 API 仅在部分浏览器支持,详见 [MDN - autocapitalize](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize) | _string_ | - |
|
||||||
| enterkeyhint | HTML 原生属性,用于控制回车键样式,此 API 仅在部分浏览器支持,详见 [MDN - enterkeyhint](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint)<br> | _string_ | - |
|
| enterkeyhint | HTML 原生属性,用于控制回车键样式,此 API 仅在部分浏览器支持,详见 [MDN - enterkeyhint](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint)<br> | _FieldEnterKeyHint_ | - |
|
||||||
| spellcheck `v4.6.2` | HTML 原生属性,用于检查元素的拼写错误,此 API 仅在部分浏览器支持,详见 [MDN - spellcheck](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck)<br> | _boolean_ | - |
|
| spellcheck `v4.6.2` | HTML 原生属性,用于检查元素的拼写错误,此 API 仅在部分浏览器支持,详见 [MDN - spellcheck](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck)<br> | _boolean_ | - |
|
||||||
| autocorrect `v4.6.2` | HTML 原生属性,仅 Safari 适用,用于自动更正输入的文本,详见 [MDN - autocorrect](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#autocorrect)<br> | _string_ | - |
|
| autocorrect `v4.6.2` | HTML 原生属性,仅 Safari 适用,用于自动更正输入的文本,详见 [MDN - autocorrect](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#autocorrect)<br> | _string_ | - |
|
||||||
| inputmode `v4.9.9` | HTML 原生属性,用于指定输入框的输入模式,详见 [MDN - inputmode](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode) | _string_ | 根据 `type` 属性自动设置 |
|
| inputmode `v4.9.9` | HTML 原生属性,用于指定输入框的输入模式,详见 [MDN - inputmode](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode) | _string_ | 根据 `type` 属性自动设置 |
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ export type {
|
|||||||
FieldAutosizeConfig,
|
FieldAutosizeConfig,
|
||||||
FieldValidateTrigger,
|
FieldValidateTrigger,
|
||||||
FieldValidationStatus,
|
FieldValidationStatus,
|
||||||
|
FieldEnterKeyHint,
|
||||||
} from './types';
|
} from './types';
|
||||||
|
|
||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
|
|||||||
@@ -36,6 +36,15 @@ export type FieldFormatTrigger = 'onBlur' | 'onChange';
|
|||||||
|
|
||||||
export type FieldValidateTrigger = 'onBlur' | 'onChange' | 'onSubmit';
|
export type FieldValidateTrigger = 'onBlur' | 'onChange' | 'onSubmit';
|
||||||
|
|
||||||
|
export type FieldEnterKeyHint =
|
||||||
|
| 'search'
|
||||||
|
| 'done'
|
||||||
|
| 'enter'
|
||||||
|
| 'go'
|
||||||
|
| 'next'
|
||||||
|
| 'previous'
|
||||||
|
| 'send';
|
||||||
|
|
||||||
export type FieldAutosizeConfig = {
|
export type FieldAutosizeConfig = {
|
||||||
maxHeight?: number;
|
maxHeight?: number;
|
||||||
minHeight?: number;
|
minHeight?: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user