ElyTable: a column filter button sorts and filters its own range (T-08)
This commit is contained in:
5 files changed
+46
-1
No files matched your search
@@ -397,6 +397,7 @@ impl Book {
|
||||
book.dialog = Some(Dialog::Column {
|
||||
tab: id,
|
||||
column,
|
||||
row,
|
||||
entries: filter.entries,
|
||||
picked,
|
||||
});
|
||||
@@ -413,12 +414,15 @@ impl Book {
|
||||
let Some(Dialog::Column {
|
||||
tab,
|
||||
column,
|
||||
row,
|
||||
entries,
|
||||
picked,
|
||||
}) = self.dialog.take()
|
||||
else {
|
||||
return;
|
||||
};
|
||||
// The kernel filters the cursor's range: go to the button.
|
||||
self.run_in(Some(tab), "cell.goto", &[&sheet::address(column, row)], cx);
|
||||
match sort {
|
||||
Some(rising) => {
|
||||
let key = SortKey {
|
||||
|
||||
@@ -94,6 +94,8 @@ pub enum Dialog {
|
||||
Column {
|
||||
tab: u64,
|
||||
column: u32,
|
||||
/// The button's row: its cell names the filtered range.
|
||||
row: u32,
|
||||
entries: Vec<Entry>,
|
||||
picked: Vec<SharedString>,
|
||||
},
|
||||
|
||||
@@ -300,3 +300,41 @@ fn the_panel_reads_number_formats_and_find_counts_cells() {
|
||||
.is_some_and(|finder| finder.all.len() == 3)
|
||||
});
|
||||
}
|
||||
|
||||
/// Two blocks: keys in A, other numbers in C.
|
||||
const BLOCKS: &str = r#"<?xml version="1.0" encoding="UTF-8"?>
|
||||
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
|
||||
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
|
||||
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.spreadsheet">
|
||||
<office:body><office:spreadsheet><table:table table:name="S">
|
||||
<table:table-row><table:table-cell><text:p>K</text:p></table:table-cell><table:table-cell/><table:table-cell><text:p>L</text:p></table:table-cell></table:table-row>
|
||||
<table:table-row><table:table-cell office:value-type="float" office:value="3"><text:p>3</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="9"><text:p>9</text:p></table:table-cell></table:table-row>
|
||||
<table:table-row><table:table-cell office:value-type="float" office:value="1"><text:p>1</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="7"><text:p>7</text:p></table:table-cell></table:table-row>
|
||||
<table:table-row><table:table-cell office:value-type="float" office:value="2"><text:p>2</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="8"><text:p>8</text:p></table:table-cell></table:table-row>
|
||||
</table:table></office:spreadsheet></office:body>
|
||||
</office:document>"#;
|
||||
|
||||
#[test]
|
||||
fn a_column_button_sorts_its_own_block_not_the_cursors() {
|
||||
let dir = tempfile::tempdir().expect("a temp dir");
|
||||
let mut cx = TestAppContext::single();
|
||||
let Some((_window, book)) = book(&mut cx, dir.path()) else {
|
||||
eprintln!("SKIP: no LOK build");
|
||||
return;
|
||||
};
|
||||
update(&mut cx, &book, |book, cx| {
|
||||
book.new_from_text("blocks.fods", BLOCKS, cx)
|
||||
});
|
||||
settle(&cx, |app| sheet_names(app, &book) == ["S"]);
|
||||
run(&mut cx, &book, "cell.goto", &["A1"]);
|
||||
run(&mut cx, &book, "data.autofilter", &[]);
|
||||
run(&mut cx, &book, "cell.goto", &["C3"]);
|
||||
let id = cx.update(|app| book.read(app).core.active.expect("a tab"));
|
||||
update(&mut cx, &book, |book, cx| {
|
||||
book.ask_column(id, &Request::Filter { column: 0, row: 0 }, cx)
|
||||
});
|
||||
asked(&cx, &book, |dialog| matches!(dialog, Dialog::Column { .. }));
|
||||
update(&mut cx, &book, |book, cx| book.column_asked(Some(true), cx));
|
||||
assert_eq!(cells(&mut cx, &book, "A2:A4"), "1\n2\n3");
|
||||
assert_eq!(cells(&mut cx, &book, "C2:C4"), "9\n7\n8");
|
||||
}
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
- [x] T-05 文档尺寸按内核像素取整,表尾被裁 — 内核尺寸按其测量时的比例换到当前比例(加载即设比例、缩放即改比例并重测、迟到的测量也换算);R1–R4 缩放后未重测、表尾锚点被截、连续缩放迟到、首次测量无比例与文件超行;R5 PASS
|
||||
- [x] T-06 滚轮向下被内核平铺区卡住 — 表格的可滚范围先行两屏、止于表尾;R1 PASS
|
||||
- [x] T-07 表头点选、行高列宽拖动是“按编号的命令”,而每次点击与拖选都推进修订,紧接着的表头操作被当作过期拒绝 — 行列号不再算作按编号的命令;R1 PASS
|
||||
- [ ] T-08 自动筛选的列菜单对光标所在的表而不是按钮所在的表筛选、排序
|
||||
- [x] T-08 自动筛选的列菜单对光标所在的表而不是按钮所在的表筛选、排序 — 先把光标移到按钮所在格再排序或筛选;R1 PASS
|
||||
- [ ] T-09 导入文本文件时整文件的 UTF-8 校验在界面线程跑
|
||||
- [ ] T-10 CSV 导入对话框开着时打开任何别的对话框,待导入的文件静默消失
|
||||
- [ ] T-11 对话框比其标签活得久:导出、定义名称、重命名不可见却“开着”,挡住导入;名称表的“转到”激活已关闭的标签
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
PASS
|
||||
Reference in new issue
Block a user