Calendar
支持键盘导航的月历网格,用于选择单个日期。
正在加载交互演示…
let calendar = Calendar::new("month");
calendar.root().flex_col()#导入
从 quickgui 导入 Calendar。
use quickgui::*;#用法
let calendar = Calendar::new("month");
calendar.root().flex_col()#结构
Calendar::rootCalendar::weekCalendar::day
#API 参考
展开条目查看说明和完整签名。短横线表示声明中未记录默认值。
Calendar
查看源码pub fn new(root_id: impl Into<ElementId>) -> Selfroot_idpub const fn root_id(self) -> ElementId—
week_idpub fn week_id(self, index: usize) -> ElementId—
day_idpub fn day_id(self, day: CivilDate) -> ElementId—
Calendar::grid_with
查看源码pub fn grid_with(self, state: CalendarState, grid: Element) -> ElementDecorate an application-owned month grid without adding layout or appearance.
Calendar::grid
查看源码pub fn grid(self, state: CalendarState) -> ElementCreate the unstyled grid part. Use [`Self::grid_with`] to supply an existing element.
Calendar::week_with
查看源码pub fn week_with(self, index: usize, week: Element) -> ElementDecorate an application-owned week row without adding layout or appearance.
Calendar::week
查看源码pub fn week(self, index: usize) -> ElementCreate the unstyled week part. Use [`Self::week_with`] to supply an existing element.
Calendar::day_with
查看源码pub fn day_with(self, state: CalendarState, day: CivilDate, cell: Element) -> ElementDecorate an application-owned day cell without adding layout or appearance. Exactly one day carries the grid's Tab stop; the rest are reached with the arrow keys. QuickGUI sets the cell's accessible value to the ISO date; call `.accessibility_label(...)` afterwards to replace it with localized product text.
Calendar::day
查看源码pub fn day(self, state: CalendarState, day: CivilDate) -> ElementCreate the unstyled day part. Use [`Self::day_with`] to supply an existing element.
Calendar::key_with
查看源码pub fn key_with<V: 'static>( self, cx: &mut ViewContext<'_, V>, day: CivilDate, cell: Element, access: fn(&mut V) -> &mut CalendarState, ) -> ElementAttach QuickGUI's typed calendar actions and click selection to one day cell. Install [`calendar_key_bindings`] once on the application keymap.
Calendar::key
查看源码pub fn key<V: 'static>( self, cx: &mut ViewContext<'_, V>, day: CivilDate, access: fn(&mut V) -> &mut CalendarState, ) -> ElementCreate the unstyled key part. Use [`Self::key_with`] to supply an existing element.
Calendar::key_with_accessor
查看源码pub fn key_with_accessor<V: 'static>( self, cx: &mut ViewContext<'_, V>, day: CivilDate, cell: Element, access_source: StateAccessor<V, CalendarState>, ) -> ElementAttach the typed calendar actions against a per-instance state accessor. A host that renders many declared calendars through one view passes an accessor that captures which [`CalendarState`] this day cell belongs to.
