Expand description
表单控件(FormInput / FormSelect / AlertBox / …)与 INPUT class 常量。 表单控件组件
提供登录、注册、评论等页面共享的输入框、下拉、时间、数字、开关与提示条。
外观定义在 styles/components/ui.css(.field、.listbox、.switch、.alert)。
约定(Leptos):随状态变化的 props 一律是 Signal<T> / MaybeProp<T>,可直接传
常量、信号或 move || 闭包;受控值写作 value=信号 + oninput/onchange 回调
(回调里由调用方写回信号)。id 等可选字符串是 MaybeProp<String>,id="x" 即可。
Structs§
- Alert
BoxProps - Props for the
AlertBoxcomponent. - Form
Input Props - Props for the
FormInputcomponent. - Form
Label Props - Props for the
FormLabelcomponent. - Form
Select Props - Props for the
FormSelectcomponent. - Form
Textarea Props - Props for the
FormTextareacomponent. - Number
Input Props - Props for the
NumberInputcomponent. - Select
Option 🔒Props - Props for the
SelectOptioncomponent. - Time
Picker Props - Props for the
TimePickercomponent. - Toggle
Switch Props - Props for the
ToggleSwitchcomponent.
Constants§
- FILTER_
THRESHOLD 🔒 - 选项多于该数量时,下拉面板顶部出现筛选框。
- FORM_
SELECT_ COMPACT_ CLASS - FormSelect 紧凑触发器:工具栏内联小下拉(自动刷新、导出格式等)。
- INPUT_
CLASS - 输入框基础类:浅底、发丝线环,聚焦陶土双环,
aria-invalid时红环。 - TEXTAREA_
CLASS - 多行输入框基础类:随内容长高(
.field-textarea)。
Statics§
- FORM_
SELECT_ 🔒ID - FormSelect / TimePicker / NumberInput 实例序号计数器(跨泛型单例化全局唯一)。
Functions§
- Alert
Box - 提示条,用于显示成功、错误等状态消息。
- Form
Input - 表单输入框组件。
- Form
Label - 表单标签组件。
- Form
Select - 下拉选择框组件(自定义弹层,全主题化)。
- Form
Textarea - 多行输入框:外观同 FormInput,
.field-textarea随内容长高,rows是不支持 field-sizing 时的初始行数。 - Number
Input - 数字输入框:单位写在框内右侧,两侧 −/+ 步进;越界时边框与说明一起变红。
- Select
Option 🔒 - 下拉面板中的一项。禁用项(
reason为 Some)变淡、写明原因,不响应点击。 - Time
Picker - 时间选择器(24 小时制 “HH:MM”,浏览器本地时间)。
- Toggle
Switch - 开关(toggle switch)组件。
- matches_
query 🔒 - 筛选:忽略大小写的子串匹配,空查询匹配全部。
- parse_
hhmm 🔒 - 解析 “HH:MM” 为 (时, 分);任一段缺失或越界整体回退 (0, 0)。 纯防御性兜底:正常路径下 value 只来自服务端 normalize 或本组件输出,必然合法。
- parse_
in_ 🔒range - 解析草稿文本,在
[min, max]内才返回。 - should_
flip 🔒 - 面板应向上展开的条件:视口下方空间不足,且上方空间比下方更宽余。
- step_
active 🔒 - 在可选项(已筛选、未禁用)之间移动高亮;当前项不在其中时落到首项或末项。
- use_
instance_ 🔒prefix - 分配实例序号,用于拼接未显式传
id时的元素 id(form-select-N等)。 - wrap_
index 🔒 - 键盘导航的循环索引:在
len个选项中从cur移动delta(±1),越界回绕。