pub struct RangePicker {
pub state: WidgetState,
pub props: WidgetProps,
/* private fields */
}Expand description
A date/time range picker widget
§Example
ⓘ
use revue::widget::{range_picker, RangePicker, Date};
// Basic date range picker
let picker = range_picker()
.start_date(Date::new(2025, 1, 1))
.end_date(Date::new(2025, 1, 31));
// With presets
let picker = range_picker()
.with_presets(true);
// Analytics-style range picker
let picker = analytics_range_picker();Fields§
§state: WidgetStateWidget state
props: WidgetPropsWidget props
Implementations§
Source§impl RangePicker
impl RangePicker
Source§impl RangePicker
impl RangePicker
Sourcepub fn start_date(self, date: Date) -> Self
pub fn start_date(self, date: Date) -> Self
Set start date
Sourcepub fn start_time(self, time: Time) -> Self
pub fn start_time(self, time: Time) -> Self
Set start time
Sourcepub fn first_day(self, first: FirstDayOfWeek) -> Self
pub fn first_day(self, first: FirstDayOfWeek) -> Self
Set first day of week
Sourcepub fn with_presets(self, show: bool) -> Self
pub fn with_presets(self, show: bool) -> Self
Show or hide presets panel
Sourcepub fn presets(self, presets: Vec<PresetRange>) -> Self
pub fn presets(self, presets: Vec<PresetRange>) -> Self
Set available presets
Sourcepub fn range_color(self, color: Color) -> Self
pub fn range_color(self, color: Color) -> Self
Set range colors
Sourcepub fn get_datetime_range(&self) -> (DateTime, DateTime)
pub fn get_datetime_range(&self) -> (DateTime, DateTime)
Get the selected datetime range
Sourcepub fn get_active_preset(&self) -> Option<PresetRange>
pub fn get_active_preset(&self) -> Option<PresetRange>
Get active preset (if any)
Sourcepub fn is_in_range(&self, date: &Date) -> bool
pub fn is_in_range(&self, date: &Date) -> bool
Check if a date is within the selected range
Sourcepub fn get_focus(&self) -> RangeFocus
pub fn get_focus(&self) -> RangeFocus
Get the current focus area
Sourcepub fn apply_preset(&mut self, preset: PresetRange)
pub fn apply_preset(&mut self, preset: PresetRange)
Apply a preset range
Source§impl RangePicker
impl RangePicker
Sourcepub fn handle_key(&mut self, key: &Key) -> bool
pub fn handle_key(&mut self, key: &Key) -> bool
Handle key input
Source§impl RangePicker
impl RangePicker
Sourcepub fn is_focused(&self) -> bool
pub fn is_focused(&self) -> bool
Check if widget is focused
Sourcepub fn is_disabled(&self) -> bool
pub fn is_disabled(&self) -> bool
Check if widget is disabled
Sourcepub fn set_focused(&mut self, focused: bool)
pub fn set_focused(&mut self, focused: bool)
Set focused state (mutable)
Source§impl RangePicker
impl RangePicker
Trait Implementations§
Source§impl Default for RangePicker
impl Default for RangePicker
Source§impl StyledView for RangePicker
impl StyledView for RangePicker
Source§fn remove_class(&mut self, class: &str)
fn remove_class(&mut self, class: &str)
Remove a CSS class
Source§fn toggle_class(&mut self, class: &str)
fn toggle_class(&mut self, class: &str)
Toggle a CSS class
Source§impl View for RangePicker
impl View for RangePicker
Source§fn render(&self, ctx: &mut RenderContext<'_>)
fn render(&self, ctx: &mut RenderContext<'_>)
Render the view to the given context Read more
Source§fn widget_type(&self) -> &'static str
fn widget_type(&self) -> &'static str
Get widget type name (for CSS type selectors) Read more
Source§fn meta(&self) -> WidgetMeta
fn meta(&self) -> WidgetMeta
Get widget metadata for DOM Read more
Auto Trait Implementations§
impl Freeze for RangePicker
impl RefUnwindSafe for RangePicker
impl Send for RangePicker
impl Sync for RangePicker
impl Unpin for RangePicker
impl UnsafeUnpin for RangePicker
impl UnwindSafe for RangePicker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more