mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-30 05:37:00 -06:00
Add table slicers (insert.slicer / table.insertSlicer)
Implements the two slicer commands from the parity catalog as first-class floating objects that filter a table column. - model: Slicer struct on Sheet (#[serde(default)]), included in Workbook::next_object_id; slicer anchors use AnchorMode::MoveOnly. - engine: cmd/slicer.rs with insert.slicer, table.insertSlicer, slicer.toggle (single + multi), slicer.selectAll, slicer.clear, slicer.delete. Selection is written as a FilterCriterion::Values into the sheet AutoFilter and applied via the existing apply_filter. object.move / object.delete handle "slicer". - ui-egui: slicers rendered, hit-tested, selected and dragged like charts; value tiles toggle on click (Ctrl/Cmd = multi), funnel button clears. Ribbon buttons under Insert > Filters and Table Design > Tools. - tests: slicer_filters_table; the every_command_survives_empty_params fuzz covers the new commands. Native-only for now; .xlsx slicer-cache round-trip is a follow-up. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
e72e16a0ec
commit
fd2243df95
@@ -869,6 +869,7 @@ fn delete_object(s: &mut Session, p: &Json) -> Result<Json> {
|
||||
match kind.as_str() {
|
||||
"chart" => sh.charts.retain(|c| c.id != id),
|
||||
"image" => sh.images.retain(|c| c.id != id),
|
||||
"slicer" => sh.slicers.retain(|c| c.id != id),
|
||||
_ => sh.shapes.retain(|c| c.id != id),
|
||||
}
|
||||
Ok(Json::Null)
|
||||
@@ -884,6 +885,7 @@ fn move_object(s: &mut Session, p: &Json) -> Result<Json> {
|
||||
let anchor = match kind.as_str() {
|
||||
"chart" => sh.charts.iter_mut().find(|c| c.id == id).map(|c| &mut c.anchor),
|
||||
"image" => sh.images.iter_mut().find(|c| c.id == id).map(|c| &mut c.anchor),
|
||||
"slicer" => sh.slicers.iter_mut().find(|c| c.id == id).map(|c| &mut c.anchor),
|
||||
"shape" => sh.shapes.iter_mut().find(|c| c.id == id).map(|c| &mut c.anchor),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user