# Objective CSV feature needs row filtering feature by column values. This PR provides base implementation of it with barebones ui. > NOTE: Sleek UI with search & proper scrolling hanling is implemented in next PR. It's stacked on top to reduce review scope ## Solution - New `FilterEntry` / `FilterEntryState` model in `table_data_engine/filtering_by_column.rs` tracking per-column applied/candidate filter values - Filtering runs in the background (`feat: Implement background filtering`) so large CSVs don't block the UI thread while a filter is applied - Filter menu entries reflect live counts and support a configurable sort order (`FilterSortOrder`, added in `renderer/settings.rs` / `settings.rs`) - Filter/sort trigger buttons on column headers are hidden until hover, using `GradientFade` (new in `ui/src/components/gradient_fade.rs`) to fade content behind them ## Testing Filter chain tested on csv fixtures with multiple filters applied sequentially columns. ## Self-Review Checklist: (todo) - [ ] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [ ] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) (out of scope of this pr) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable ## Showcase <img width="664" height="249" alt="image" src="https://github.com/user-attachments/assets/0e9b0a91-1a27-4e0f-a8d4-fdce36735131" /> <img width="663" height="205" alt="image" src="https://github.com/user-attachments/assets/0428f5c6-6aaa-4891-b010-ca79803f6613" /> --- Release Notes: - Added initial row filtering UI & logic
49 lines
1.4 KiB
Rust
49 lines
1.4 KiB
Rust
#[derive(Default, Clone, Copy, PartialEq)]
|
|
pub enum RowRenderMechanism {
|
|
/// More correct for multiline content, but slower.
|
|
#[default]
|
|
VariableList,
|
|
/// Default behaviour for now while resizable columns are being stabilized.
|
|
#[allow(dead_code)] // Will be used when settings ui is added
|
|
UniformList,
|
|
}
|
|
|
|
#[derive(Default, Clone, Copy)]
|
|
pub enum VerticalAlignment {
|
|
/// Align text to the top of cells
|
|
#[default]
|
|
Top,
|
|
/// Center text vertically in cells
|
|
Center,
|
|
}
|
|
|
|
#[derive(Default, Clone, Copy)]
|
|
pub enum RowIdentifiers {
|
|
/// Show original line numbers from CSV file
|
|
#[default]
|
|
SrcLines,
|
|
/// Show sequential row numbers starting from 1
|
|
RowNum,
|
|
}
|
|
|
|
#[derive(Default, Clone, Copy, PartialEq)]
|
|
pub enum FilterSortOrder {
|
|
/// Sort alphabetically (A→Z), then by number of occurrences descending within ties
|
|
#[default]
|
|
AlphaThenCount,
|
|
/// Sort by number of occurrences descending, then alphabetically within ties
|
|
CountThenAlpha,
|
|
}
|
|
|
|
#[derive(Clone, Default)]
|
|
pub(crate) struct CsvPreviewSettings {
|
|
pub(crate) rendering_with: RowRenderMechanism,
|
|
pub(crate) vertical_alignment: VerticalAlignment,
|
|
pub(crate) numbering_type: RowIdentifiers,
|
|
pub(crate) filter_sort_order: FilterSortOrder,
|
|
pub(crate) show_debug_info: bool,
|
|
#[cfg(feature = "dev-tools")]
|
|
pub(crate) show_perf_metrics_overlay: bool,
|
|
pub(crate) multiline_cells_enabled: bool,
|
|
}
|