Skip to main content

Module forms

Module forms 

Source
Expand description

表单控件(FormInput / FormSelect / AlertBox / …)与 INPUT class 常量。 表单控件组件

提供登录、注册、评论等页面共享的输入框、按钮与提示框样式常量与组件。

Re-exports§

pub use FormSelect_completions::Component::FormSelect;
pub use TimePicker_completions::Component::TimePicker;
pub use FormInput_completions::Component::FormInput;
pub use FormLabel_completions::Component::FormLabel;
pub use AlertBox_completions::Component::AlertBox;
pub use ToggleSwitch_completions::Component::ToggleSwitch;

Structs§

AlertBoxProps
Properties for the AlertBox component.
FormInputProps
Properties for the FormInput component.
FormLabelProps
Properties for the FormLabel component.
FormSelectProps
Properties for the FormSelect component.
TimePickerProps
Properties for the TimePicker component.
ToggleSwitchProps
Properties for the ToggleSwitch component.

Constants§

BUTTON_PRIMARY_CLASS
主按钮 CSS 类,用于表单提交等主操作按钮。
FORM_SELECT_COMPACT_CLASS
FormSelect 紧凑触发器样式:工具栏内联小下拉(自动刷新、导出格式等)。 自动宽度 + text-sm + 小圆角,chevron 与面板样式与默认表单款一致。
HOUR_LABELS 🔒
小时/分钟选项标签表(“00”–“23” / “00”–“59”)。 静态表避免每次渲染堆分配;FormSelect 选项标签要求 &'static str
INPUT_CLASS
输入框基础 CSS 类,统一文本框、邮箱框、URL 框等样式。
INPUT_INLINE_CLASS
内联输入框 CSS 类:与 INPUT_CLASS 同主题,但用 flex-1 min-w-0 取代 w-full, 用于与按钮并排、需填充剩余宽度的场景(搜索栏、URL 输入栏等)。
INPUT_SEARCH_CLASS
可清除输入框 CSS 类:与 INPUT_CLASS 同主题(w-full 撑满外层 relative 包裹), 右侧 pr-10 为输入框内的自定义清除按钮(Material Symbols close 图标)让位, ygg-search-clear 钩子隐藏 WebKit/Blink 原生 ::-webkit-search-cancel-button (见 input.css)。用于「输入框内带清除图标」场景(/search 页)。
MINUTE_LABELS 🔒

Statics§

FORM_SELECT_ID 🔒
FormSelect 实例 id 计数器(跨泛型单例化全局唯一)。

Functions§

AlertBox
提示框组件,用于显示成功、错误等状态消息。
FormInput
表单输入框组件。
FormLabel
表单标签组件。
FormSelect
下拉选择框组件(自定义弹层,全主题化)。
TimePicker
时间选择器(24 小时制 “HH:MM”)。
ToggleSwitch
开关(toggle switch)组件。
parse_hhmm 🔒
解析 “HH:MM” 为 (时, 分);任一段缺失或越界整体回退 (0, 0)。 纯防御性兜底:正常路径下 value 只来自服务端 normalize 或本组件输出,必然合法。
should_flip 🔒
面板应向上展开的条件:视口下方空间不足,且上方空间比下方更宽余。
wrap_index 🔒
键盘导航的循环索引:在 len 个选项中从 cur 移动 delta(±1),越界回绕。