feat(db_view): 数据库对象列表支持全选与拖选多行 - #263
Merged
Merged
Conversation
- 删除 SelectAllInScope 补偿链:对象页签只在容器节点 children_loaded 时才展示清单, 宿主侧该判断必然命中,且列表本身不做截断,可见行即全部对象;一并移除只服务该链路的 DbTreeView::store_loaded_children(它绕过了 lazy_load_children 的重建与事件收尾) 和对应的字符串契约测试 - 拖选锚点改为每次按下无条件重置:gpui 只把 mouse_up 发给命中路径上的元素,指针在列表外 松开时视图收不到释放事件,旧实现会沿用旧锚点截出错区间 - Shift 点击改用 ScrollStrategy::Nearest,不再把可见行顶到视口顶部 - Cmd/Ctrl 拖选支持加选:按下时快照选择集,拖选区间叠加其上,来回拖动可正常收缩 - 清理 PressOutcome、RowDragState::last_hovered 等死状态与重复状态
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
数据库对象页签(表 / 视图 / 命名查询清单)原先只能一行一行点选,批量删除多张表必须逐个点,没有全选入口,也不能用鼠标划选。列表本身已有批量能力(
DatabaseObjectsEvent::Batch),缺的只是「把多行选出来」的入口。本分支与 cnb 的 navop-dev/navop#7 同源,在其之上追加了一次评审修复提交。
改动
crates/db_view/src/object_list_selection.rs:可见行选择模型(全选 / Shift 区间 / 拖选状态 / 位移阈值),可脱离 GPUI 用纯单测覆盖。database_objects_tab.rs:新增SelectAllObjectsaction、行mouse_down/move/up拖选、Shift 区间选择、面板级释放兜底。search_shortcut.rs/core/src/keybindings.rs:新增DB_SELECT_ALL_OBJECTS与cmd-a/ctrl-a默认绑定,Ctrl/Cmd+A 走既有DbSearchkey context,搜索框聚焦时仍优先文本全选。main/src/setting_tab.rs+main/locales/main.yml:设置页展示「全选对象」并支持自定义。评审修复(第二个提交
fix(db_view): 修正对象列表全选的无效补全链路与拖选交互):SelectAllInScope补全链路(含只服务它的DbTreeView::store_loaded_children)。对象页签只在容器节点children_loaded时才展示清单,宿主侧该判断必然命中;列表本身不做截断,可见行即全部对象。mouse_up发给命中路径上的元素,指针在列表外松开时本视图收不到释放事件,旧实现会沿用旧锚点截出错误区间。ScrollStrategy::Nearest,不再把已经可见的行顶到视口顶部。Cmd/Ctrl拖选支持加选:按下时快照选择集,拖选区间叠加其上,来回拖动可正常收缩。验证
cargo +nightly test -p db_view:717 passed / 0 failed / 1 ignoredrustfmt/clippy组件(镜像源 404),因此这次没有跑 lintuniform_list行模型,不是EditTable)