Package-level declarations

Types

Link copied to clipboard
abstract class CustomValidator(val message: String, val validator: (field: Any?) -> Boolean) : Validator
Link copied to clipboard
data class Email(val message: String = EMAIL_MESSAGE) : Validator
Link copied to clipboard
object Form
Link copied to clipboard

Form controller, The Form component needs to pass this controller instance so that the controller can control the component outside.

Link copied to clipboard
class FormScope

Form Component scope

Link copied to clipboard
data class Mobile(val message: String = MOBILE_MESSAGE) : Validator
Link copied to clipboard
data class Phone(val message: String = PHONE_MESSAGE) : Validator
Link copied to clipboard
data class Regex(val message: String = REGEX_MESSAGE, val regex: String) : Validator
Link copied to clipboard
data class Required(val message: String = REQUIRED_MESSAGE) : Validator
Link copied to clipboard
sealed interface Validator

Validator,used to verify whether form fields are legal

Functions

Link copied to clipboard
fun Form(formInstance: FormInstance = Form.useForm(), children: @Composable FormScope.() -> Unit)

Headless Form Component

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <T> Form.useWatch(fieldName: String, formInstance: FormInstance): State<T?>

使用这个 Hook 你可以在 FormScope 外直接获取一个字段的内容状态

Link copied to clipboard
fun Array<Validator>.validateField(fieldValue: Any?, pass: Validator.() -> Boolean, fail: Validator.() -> Boolean): Boolean

Verify the value of a field using a list of validators