pub struct DropdownFieldView<State: 'static> { /* private fields */ }Expand description
A declarative dropdown trigger. See dropdown_field.
Implementations§
Source§impl<State: 'static> DropdownFieldView<State>
impl<State: 'static> DropdownFieldView<State>
Sourcepub fn anchor(self, anchor: &OverlayAnchor) -> Self
pub fn anchor(self, anchor: &OverlayAnchor) -> Self
Capture this field’s window-space rect into anchor on every paint.
Sourcepub fn selected(self, selected: Vec<String>) -> Self
pub fn selected(self, selected: Vec<String>) -> Self
Hand the field the app-confirmed selection (option values).
Sourcepub fn hint(self, hint: impl Into<String>) -> Self
pub fn hint(self, hint: impl Into<String>) -> Self
Replace the placeholder shown when nothing is selected (hintText).
Sourcepub fn multi(self, multi: bool) -> Self
pub fn multi(self, multi: bool) -> Self
Render the selection as chips rather than as a single label — the
multi-select presentation (showChipAnimation over a multi-select
controller).
Sourcepub fn open(self, open: bool) -> Self
pub fn open(self, open: bool) -> Self
Tell the field whether its panel is open, which is what points the arrow up.
Sourcepub fn enabled(self, enabled: bool) -> Self
pub fn enabled(self, enabled: bool) -> Self
Set whether the field accepts a press (default true). A disabled field
dims its content, refuses to open, and drops its chips’ delete
affordances — the reference’s enabled gate.
Sourcepub fn loading(self, loading: bool) -> Self
pub fn loading(self, loading: bool) -> Self
Swap the trailing slot for a busy indicator and refuse to open — the
field half of the async poll seam (see super).
Sourcepub fn error(self, error: bool) -> Self
pub fn error(self, error: bool) -> Self
Outline the container in the error role. The reference recolors its
border from a FormField’s hasError; with that wrapper descoped, this
is the app-driven equivalent (see super’s descope note).
Sourcepub fn show_clear(self, show_clear: bool) -> Self
pub fn show_clear(self, show_clear: bool) -> Self
Show a clear-all affordance in the trailing slot whenever something is
selected (showClearIcon, off by default). It replaces the arrow while
visible, exactly as upstream.
Sourcepub fn max_chips(self, max: usize) -> Self
pub fn max_chips(self, max: usize) -> Self
Cap the number of chips rendered, past which a +N indicator stands in
for the rest (chipStyle.maxDisplayCount; unlimited by default).
Sourcepub fn on_open<F: Fn(&mut State, bool) + 'static>(self, on_open: F) -> Self
pub fn on_open<F: Fn(&mut State, bool) + 'static>(self, on_open: F) -> Self
Set the open callback: a press reports !open, the reference’s
_toggle.
Trait Implementations§
Source§impl<State: 'static> View<State> for DropdownFieldView<State>
impl<State: 'static> View<State> for DropdownFieldView<State>
Source§type Element = DropdownFieldWidget
type Element = DropdownFieldWidget
Source§fn build(&self, ctx: &mut BuildCtx<'_>) -> DropdownFieldWidget
fn build(&self, ctx: &mut BuildCtx<'_>) -> DropdownFieldWidget
Source§fn rebuild(
&self,
prev: &Self,
element: &mut DropdownFieldWidget,
ctx: &mut BuildCtx<'_>,
) -> ChangeFlags
fn rebuild( &self, prev: &Self, element: &mut DropdownFieldWidget, ctx: &mut BuildCtx<'_>, ) -> ChangeFlags
prev (the previous view of the same type) against the live
element, mutating it in place and reporting what changed.Auto Trait Implementations§
impl<State> !RefUnwindSafe for DropdownFieldView<State>
impl<State> !Send for DropdownFieldView<State>
impl<State> !Sync for DropdownFieldView<State>
impl<State> !UnwindSafe for DropdownFieldView<State>
impl<State> Freeze for DropdownFieldView<State>
impl<State> Unpin for DropdownFieldView<State>
impl<State> UnsafeUnpin for DropdownFieldView<State>where
Option<Rc<dyn Fn(&mut State, bool)>>: UnsafeUnpin,
Option<Rc<dyn Fn(&mut State, Vec<String>)>>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.