Skip to content

Latest commit

 

History

History
241 lines (123 loc) · 3.39 KB

File metadata and controls

241 lines (123 loc) · 3.39 KB

sapi-pro


sapi-pro / TextField

Class: TextField

文本输入

Extends

Constructors

Constructor

new TextField(label, placeholder, defaultValue?, tooltip?): TextField

Parameters

label

TextType

placeholder

TextType

defaultValue?

TextType

tooltip?

TextType

Returns

TextField

Overrides

ValueField.constructor

Properties

__optional

protected __optional: boolean = false

Inherited from

ValueField.__optional


_key?

protected optional _key?: string

Inherited from

ValueField._key


isValueField

readonly isValueField: true = true

Inherited from

ValueField.isValueField


validators

protected validators: FieldValidator<string>[] = []

Inherited from

ValueField.validators

Accessors

isOptional

Get Signature

get isOptional(): boolean

Returns

boolean

Inherited from

ValueField.isOptional

Methods

build()

build(form, t): void

Parameters

form

ModalFormData

t

UniversalTranslator

Returns

void

Overrides

ValueField.build


getKey()

getKey(): string | undefined

Returns

string | undefined

Inherited from

ValueField.getKey


key()

key(key): this

Parameters

key

string

Returns

this

Inherited from

ValueField.key


optional()

optional(): TextField & object

Returns

TextField & object

Inherited from

ValueField.optional


parse()

parse(raw): string

将 UI 原始值解析为目标类型。

  • 如果是基础类型错误(如期待数字却得到布尔),抛出对应类型的 ParseError。
  • 如果是数值格式错误(如 TextField 输入了非数字),抛出格式 ParseError。

Parameters

raw

ValueType

Returns

string

Overrides

ValueField.parse


validate()

validate(value): string | LangText | undefined

执行校验链。

  • isEmpty 判定:undefined 或空字符串。
  • 如果必填且为空,返回 Field_Empty 错误。

Parameters

value

string | undefined

Returns

string | LangText | undefined

Inherited from

ValueField.validate


validator()

validator(...v): TextField

Parameters

v

...FieldValidator<string>[]

Returns

TextField

Inherited from

ValueField.validator