DateRangePicker
ui.widgets.DateRangePicker选择 start / end 两端日期。
BEHAVIOR CONTRACT
范围顺序、双输入状态、日历高亮和浮层生命周期由一个组件协调。
RECORDED INTERACTION
Harness 点击 Start date,范围日历展开。
// ── DateRangePicker ──
pub fn buildDateRangePicker(scope: *ui.Scope, cx: *ui.Cx) anyerror!*ui.Node {
const drp = try W.DateRangePicker(.{ .initial_year = 2026, .initial_month = 5 }).mount(scope, cx);
return drp.wrapper;
}这是 Storybook 中该 story 的原样代码(zenit 5f9add5+wip 2026-09-30)。其中 W 即 ui.widgets,col / row / label 是 Storybook 内的布局小工具。
DateRangePickerProps
ui.widgets.DateRangePickerfn DateRangePicker(props: DateRangePickerProps) DateRangePickerBuilder字段
类型
默认值
说明
placeholder_start[]const u8"Start date"—
placeholder_end[]const u8"End date"—
start_date?SimpleDatenull—
end_date?SimpleDatenull—
initial_yearu162025—
initial_monthu81—
widthf32320—
sizetheme.ControlSize.md控件尺寸(与 Button / Input / Select 同一 ControlSize,默认 md)
disabledboolfalse—
on_change?core.HandlerRefnull—
calendar_icon_asset?svg_assets.Assetnull—
prev_icon_asset?svg_assets.Assetnull—
next_icon_asset?svg_assets.Assetnull—
test_id?[]const u8null—
DateRangePickerResult
ui.widgets.DateRangePicker字段
类型
默认值
说明
wrapper*Node—
—
state*DateRangePickerState—
—