feat(table): unified filter pill UI with overflow strip#9638
Open
kirangadhave wants to merge 6 commits into
Open
feat(table): unified filter pill UI with overflow strip#9638kirangadhave wants to merge 6 commits into
kirangadhave wants to merge 6 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
459bdd8 to
9a009bd
Compare
Member
Author
Contributor
|
@kirangadhave I have started the AI code review. It will take a few minutes to complete. |
Contributor
There was a problem hiding this comment.
2 issues found across 17 files
Architecture diagram
sequenceDiagram
participant Table as DataTable
participant Ctx as FilterEditorProvider
participant Header as ColumnHeader
participant Pills as FilterPills
participant Ghost as Ghost Row (hidden)
participant AddBtn as AddFilterButton
participant Editor as FilterPillEditor
participant ChipPicker as CompactChipRow / Chip
participant Overflow as Overflow Popover
Note over Table,Overflow: Unified filter pill UI with overflow strip
Table->>Ctx: Provide requestAddFilter callback
Table->>Pills: Render with filters, addFilterSnapshot, onAddFilterSnapshotChange
Table->>Pills: Pass table, calculateTopKRows
Header->>Ctx: useFilterEditor()
Ctx-->>Header: requestAddFilter
alt User clicks "Filter" in column header
Header->>+Ctx: requestAddFilter({ columnId })
Ctx->>Table: setAddFilterSnapshot(buildEditorSnapshot(column))
Table->>Pills: update addFilterSnapshot prop
Pills->>AddBtn: snapshot != null
AddBtn->>Editor: render FilterPillEditor with snapshot
else User clicks "Filter by values" in column header
Header->>+Ctx: requestAddFilter({ columnId, operator: "in" })
Ctx->>Table: setAddFilterSnapshot(buildEditorSnapshot(column, { operator: "in" }))
Table->>Pills: update addFilterSnapshot prop
Pills->>AddBtn: snapshot != null
AddBtn->>Editor: render FilterPillEditor with "in" operator
end
alt User clicks "+" button on pills strip
AddBtn->>AddBtn: buildEditorSnapshot(first editable column)
AddBtn->>AddBtn: set open = true
AddBtn->>Editor: render FilterPillEditor
else User clicks existing filter pill
Pills->>Editor: open FilterPillEditor with pill's snapshot & editIndex
end
Editor->>Editor: User modifies operator/value
Editor->>Table: onApply → setColumnFilters(updater)
alt editIndex undefined (new filter)
Table->>Table: prepend { id: draftColumnId, value } to filters
else editIndex defined (edit existing)
Table->>Table: replace filters[editIndex] = { id: draftColumnId, value }
end
Editor->>Pills: onClose → close popover
Note over Pills,Ghost: Overflow detection uses hidden ghost row
Pills->>Ghost: Always render all pills at natural width (hidden, not displayed)
Ghost-->>Pills: Provide scrollWidth measurement
Pills->>Pills: Compare scrollWidth > clientWidth via ResizeObserver
alt hasOverflow
Pills->>Pills: Apply CSS mask gradient on container
Pills->>Pills: Show +N button at right edge
Pills->>Overflow: open DraggablePopover with full filter list
Overflow-->>Table: "Clear all" → setColumnFilters([])
end
Note over Pills,ChipPicker: Pill rendering
Pills->>ChipPicker: Format value (scalar or multi-value)
alt scalar value
ChipPicker-->>Pills: Render truncated text with tooltip on hover
else multi-value (in/not_in)
ChipPicker->>ChipPicker: CompactChipRow with max 3 visible chips
ChipPicker-->>Pills: Render chips with +N overflow indicator
end
Note over Table: Column header shows persistent filter indicator
Header->>Header: hasFilter → show FilterIcon next to header text
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Introduces the filter pill strip with a + button to add filters and an overflow popover with a 'See all' button gated by scrollWidth detection. Pills open the filter editor directly from a column-header menu, show a persistent indicator on filtered headers, and 'Filter by values' extends to numeric, date, and time columns. Adds value truncation with a full-segments tooltip, inline is_in/not_in chip rendering, and a shared chip primitive reused by the editor picker.
Pills now use the same dateToISODate, exactDateTime, and dateToISOTime helpers as the column cells, and hide 'Filter by values' on date, datetime, and time columns since those should use the range picker. parsePastedRange also accepts 'and' as a separator alongside hyphen, en-dash, em-dash, and 'to'.
Also consolidates the filter test harness and adds column-header menu coverage.
Splits filters.ts into a filters/ folder by concern (types, operators, guards, builders, defaults, serialize, format). Removes the 'select' filter type; text and number columns now carry their own in/not_in membership shape. Consolidates operator groups so OPERATORS_WITHOUT_VALUE and per-type op lists derive from one source, and promotes supportsMembership to a type guard (isMembershipFilterType) used at all call sites. columnEditableType now throws on invalid filterType instead of silently falling back to text, and is reused in handleColumnChange. Drops the trivial getEditableType wrapper and the ColumnFilterValue cast in defaultFilterValueFor's membership branch. Renames renderSortFilterIcon to renderSortIcon and narrows filterType once in context-menu. Editor defaults for date/datetime are now '=='.
dateToISODate/Time/DateTime were generic Date-to-string helpers stranded in filters/serialize.ts after the folder split. Move them to utils/dates alongside the existing date formatters, rename to make the local-time semantics explicit (dateToLocalISO*), and add docstrings clarifying when to use them versus Date.toISOString().
ebdf69d to
9c1a06f
Compare
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.
Summary
Replaces the column-header value-picker submenu with a unified pill-based filter strip below the table. Users add, edit, and remove filters via a single editor popover anchored to the pills row.
UI
+button on the pills strip opens the editor. The column-header···menu routes through the same editor.scrollWidth > clientWidthcheck on the strip itself with aResizeObserver, re-measured on filter content change.is_in/not_inchip rendering via a shared chip primitive reused by the editor picker.Filter by values editor
Filter pill + Tooltip
Internals
filters.tsinto afilters/folder (types,operators,guards,builders,defaults,serialize,format).selectfilter type. Text and number columns carry their ownin/not_inmembership shape directly.supportsMembershipis promoted to a type guard (isMembershipFilterType) used at every call site.selectwas incorrect conceptually.selectis a filter operator rather than a type.NULLISH,MEMBERSHIP,COMPARISON,TEXT_SCALAR,BOOLEAN_VALUE,EMPTY) consolidated soOPERATORS_WITHOUT_VALUEand per-type lists derive from one source.numbercolumn can have nullish, membership, comparision operators, but not text_scalar, empty or boolean operatorsutils/datesand renameddateToLocalISO*to make local-time semantics explicit (vs.Date.toISOString).Demo
Screen.Recording.2026-05-22.at.4.11.59.PM.mov
Test plan
mo.ui.table(df)with text, number, date, datetime, time, and boolean columns. Column···menu shows "Filter by values" only on text and numeric columns.+button on the pill strip and the column-header···Filter item both open the same editor."X and Y","X to Y","X - Y","X – Y"into a date range input all parse into the two date fields.