Expand description
Cross-container moves - the kanban pattern. Items travel between columns
(and optionally to a position within a column) via the shared
crate::core::DndContext.
The payload type flowing through the context is BoardPayload<T>, which
remembers where the item came from. Wrap your app (or board) in
DndProvider::<BoardPayload<Card>>.
DndProvider::<BoardPayload<Card>> {
for (col_id, cards) in columns {
BoardColumn::<Card> {
id: col_id,
on_move: move |mv: MoveEvent<Card>| {
apply_move(&mut board.write(), &mv);
},
for (ix, card) in cards.iter().enumerate() {
BoardItem::<Card> { item: card.clone(), column: col_id, index: ix,
CardView { card: card.clone() }
}
}
}
}
}Re-exports§
pub use BoardItem_completions::Component::BoardItem;pub use BoardColumn_completions::Component::BoardColumn;pub use BoardSlot_completions::Component::BoardSlot;
Structs§
- Board
Column Props - Properties for the
BoardColumncomponent. - Board
Item Props - Properties for the
BoardItemcomponent. - Board
Payload - What travels through the context while a board item is dragged.
- Board
Slot Props - Properties for the
BoardSlotcomponent. - Move
Event - A completed cross-container move.
Functions§
- Board
Column - A column that receives
BoardItems. EmitsMoveEventwithto.1 = None(append). For precise within-column positions, nestBoardSlots between items. - Board
Item - A draggable card living in a column. Thin wrapper over
crate::core::Draggablethat packs origin info into the payload. - Board
Slot - An insertion point between items in a column. Dropping on it produces a
MoveEventtargeting exactly(column, Some(index)). - apply_
move - Apply a
MoveEventto aHashMap<ContainerId, Vec<T>>board model. Removes from the source (by index, falling back gracefully if the model drifted) and inserts at the target position.
Type Aliases§
- Container
Id - Columns are just zones.