mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-29 05:06:51 -06:00
Tables: add the missing Resize Table button (#935)
table.resize has existed in the engine since #589/#1706 (overlap checks, tests), and the command catalog already promised it under Table Design > Properties, but no ribbon button ever called it -- the only way to resize a table was scripting the command directly (control channel, CLI, MCP). #935 (no drag handle) assumed this menu path worked; it doesn't. Adds a "Resize Table" button next to the Table Name field (same Properties group the catalog already declares), opening a small dialog pre-filled with the table's current range. Confirming runs table.resize with the typed range, same validation as #589/#1706 (rejects overlap with another table, matching Excel's "A table can't overlap another table."). The drag-handle part of #935 is unaddressed; this only restores the menu/dialog path. Verified manually: created two tables, used the new button to grow one onto the other (rejected), then to an adjacent non-overlapping range (accepted, table intact).
This commit is contained in:
@@ -562,6 +562,24 @@ impl Dialog {
|
||||
defaults,
|
||||
)
|
||||
}
|
||||
"tableResize" => {
|
||||
let (table, range) = app
|
||||
.session
|
||||
.active()
|
||||
.and_then(|d| {
|
||||
let sh = d.wb.active()?;
|
||||
let t = sh.table_at(d.selection.active)?;
|
||||
Some((t.name.clone(), t.range.a1()))
|
||||
})
|
||||
.unwrap_or_default();
|
||||
Dialog::form(
|
||||
"tableResize",
|
||||
"Resize Table",
|
||||
"table.resize",
|
||||
vec![Text { key: "range", label: "New range for the table:" }],
|
||||
json!({"table": table, "range": range}),
|
||||
)
|
||||
}
|
||||
"dataValidation" => Dialog::form(
|
||||
"dataValidation",
|
||||
"Data Validation",
|
||||
|
||||
@@ -2282,6 +2282,11 @@ fn table_design(app: &mut SheetApp, ui: &mut Ui) {
|
||||
act(app, "table.rename", json!({"table": tname, "name": name}));
|
||||
}
|
||||
});
|
||||
let __k = big_button(ui, Icon::Table, "Resize\nTable", "Resize Table", false);
|
||||
control_keytip(app, ui, &__k, "dialog:tableResize");
|
||||
if __k.clicked() {
|
||||
app.open_dialog("tableResize", json!({}));
|
||||
}
|
||||
sep(ui);
|
||||
let __k = big_button(ui, Icon::Duplicates, "Remove\nDuplicates", "Remove Duplicates", false);
|
||||
control_keytip(app, ui, &__k, "data.removeDuplicates");
|
||||
|
||||
Reference in New Issue
Block a user