mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 00:34:25 +00:00
Text rows: a wrapped cell keeps the room a text row has around its line, so a field with a one-line value stays a text row high
This commit is contained in:
@@ -94,9 +94,9 @@ pub use token_group::{GroupValues, TokenGroup};
|
||||
pub use tokens::{
|
||||
AccentColors, BarSizes, CaptionColors, ColorToken, ColorTokens, ControlSizes, DataColors, DockColumnSizes, Edge, EdgeColors, ElevationTokens,
|
||||
FloatSizes, FontSlot, Gaps, HandleSizes, HitSizes, IconSizes, Insets, KnobShape, LengthSizes, LineColors, Motion, MotionTokens, NoticeSizes,
|
||||
OverlayColors, Pads, PaneSizes, PlotSizes, RadiusSet, RailSizes, RampSizes, RowSizes, RowStyle, RulerSizes, RulerTickSizes, ShapeTokens, SizeTokens,
|
||||
SpaceTokens, StateColors, Status, StatusColors, StatusKind, StorySizes, StrokeTokens, SurfaceColors, TextColors, ThumbSizes, Tokens, TypeRole,
|
||||
TypeStyle, TypeTokens, WindowSizes,
|
||||
OverlayColors, Pads, PaneSizes, PlotSizes, RadiusSet, RailSizes, RampSizes, RowSizes, RowStyle, RulerSizes, RulerTickSizes, ShapeTokens,
|
||||
SizeTokens, SpaceTokens, StateColors, Status, StatusColors, StatusKind, StorySizes, StrokeTokens, SurfaceColors, TextColors, ThumbSizes, Tokens,
|
||||
TypeRole, TypeStyle, TypeTokens, WindowSizes,
|
||||
};
|
||||
pub use values::ColorSource;
|
||||
pub use variant::{CustomVariant, Emphasis, RadiusStep, Variant, VariantLook};
|
||||
|
||||
@@ -12,8 +12,7 @@ pub use events::{
|
||||
CollectionEvent, ColumnEvent, ColumnRequest, ContextMenuRequest, HeaderMenuRequest, ListDrag, OpenChange, Rename, ReorderMove, ToggleEdit,
|
||||
};
|
||||
pub use props::{
|
||||
ActivateOn, CollectionProps, DragPayload, ItemKeys, LeadOnOpen, LeadSource, ReorderRule, RowHeight, RowPressed, RowState, SelectMode,
|
||||
SpaceAction,
|
||||
ActivateOn, CollectionProps, DragPayload, ItemKeys, LeadOnOpen, LeadSource, ReorderRule, RowHeight, RowPressed, RowState, SelectMode, SpaceAction,
|
||||
};
|
||||
pub(crate) use response::Gestures;
|
||||
pub(crate) use response::ItemsOut;
|
||||
|
||||
@@ -51,7 +51,8 @@ pub use body::pad_of;
|
||||
pub use collection::{
|
||||
ActivateOn, CollectionEvent, CollectionProps, CollectionResponse, ColumnAlign, ColumnEvent, ColumnKind, ColumnRequest, ColumnSort, ColumnSpec,
|
||||
ContextMenuRequest, DragPayload, DropAt, DropKind, DropPayload, DropPlace, HeaderMenuRequest, ItemKeys, LeadOnOpen, LeadSource, ListDrag,
|
||||
OpenChange, PendingDrop, Rename, ReorderMove, ReorderRule, RowHeight, RowPressed, RowState, SelectMode, ShownRow, SpaceAction, ToggleColumn, ToggleEdit,
|
||||
OpenChange, PendingDrop, Rename, ReorderMove, ReorderRule, RowHeight, RowPressed, RowState, SelectMode, ShownRow, SpaceAction, ToggleColumn,
|
||||
ToggleEdit,
|
||||
};
|
||||
#[doc(hidden)]
|
||||
pub use container::InBar;
|
||||
|
||||
@@ -63,7 +63,8 @@ impl Sizes {
|
||||
label_line: tokens.typography.get(role).line_height,
|
||||
detail_line: tokens.typography.get(TypeRole::Caption).line_height,
|
||||
cell_inset: control.pad_x,
|
||||
cell_pad: control.gap,
|
||||
// A text row's wrapped cell keeps the room a text row has around its line.
|
||||
cell_pad: if rows == RowHeight::Text { tokens.space.gap.tight } else { control.gap },
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ fn the_metadata_name_column_fits_its_widest_name_up_to_a_third_of_the_table() {
|
||||
}
|
||||
|
||||
/// The search field sits at the top of the metadata table, inset at its sides only, and the first group's row starts
|
||||
/// where the field ends: no gap above the first group.
|
||||
/// where the field ends: no gap above the first group. A field's wrapped value keeps its row a text row high.
|
||||
#[trial]
|
||||
fn the_metadata_filter_sits_in_the_header_with_no_gap_above_the_first_group() {
|
||||
let rect = Rc::new(Cell::new(Rect::NOTHING));
|
||||
@@ -139,6 +139,8 @@ fn the_metadata_filter_sits_in_the_header_with_no_gap_above_the_first_group() {
|
||||
assert!((field.top() - whole.top()).abs() < 0.5, "nothing above the field: {field:?} in {whole:?}");
|
||||
assert!(field.left() > whole.left(), "the field is inset at its start: {field:?} in {whole:?}");
|
||||
assert!((group.top() - field.bottom()).abs() < 0.5, "the first group starts where the field ends: {group:?} under {field:?}");
|
||||
let make = fixture.by_label("Make").expect("the field's row").rect;
|
||||
assert!((make.height() - group.height()).abs() < 0.5, "a row with a one-line wrapped value is as tall as a text row: {make:?}, {group:?}");
|
||||
}
|
||||
|
||||
/// A table sorted by its hideable Size column, with movable Name and Date columns; the app drops its sort on
|
||||
|
||||
Reference in New Issue
Block a user