Conversation
…e component Signed-off-by: Adrian Sepiół <adisepko@gmail.com>
Signed-off-by: Adrian Sepiół <adisepko@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR extends the components/src/Table component to support additional UX/features (fuzzy global search, column visibility toggling, and support for sub-rows/expansion) and broadens some table API types.
Changes:
- Add fuzzy global search support via a new
useFuzzySearchhook and a toolbar search input. - Add a column-visibility UI (“Columns” menu) and initial hidden-columns support.
- Extend table API/types (e.g.,
widthacceptsstring,getSubRows, and export TanStack pagination/sorting types).
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| package-lock.json | Adds lockfile entries for @tanstack/match-sorter-utils and remove-accents. |
| components/package.json | Adds @tanstack/match-sorter-utils dependency. |
| components/src/Table/model/table-model.ts | Extends TableProps/TableColumnConfig for new features and types. |
| components/src/Table/index.ts | Re-exports TanStack sorting/pagination state types. |
| components/src/Table/hooks/useFuzzySearch.ts | Introduces fuzzy global filter hook/options for TanStack table. |
| components/src/Table/TableToolbar.tsx | Adds toolbar UI for search + column visibility toggling. |
| components/src/Table/VirtualizedTable.tsx | Renders the new toolbar and switches to visible columns for rendering. |
| components/src/Table/Table.tsx | Wires up global filter + column visibility state into TanStack table instance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| aria-haspopup="listbox" | ||
| aria-expanded={colMenuOpen} | ||
| > | ||
| Columns | ||
| </Button> | ||
| <Menu |
There was a problem hiding this comment.
The button is wired to open a MUI Menu, but aria-haspopup is set to listbox. For accessibility semantics this should be menu/true and ideally include aria-controls pointing at the menu id so assistive tech can associate the trigger with the popup.
| aria-haspopup="listbox" | |
| aria-expanded={colMenuOpen} | |
| > | |
| Columns | |
| </Button> | |
| <Menu | |
| aria-haspopup="menu" | |
| aria-expanded={colMenuOpen} | |
| aria-controls={colMenuOpen ? 'table-toolbar-columns-menu' : undefined} | |
| > | |
| Columns | |
| </Button> | |
| <Menu | |
| id="table-toolbar-columns-menu" |
| const { globalFilter, setGlobalFilter, fuzzySearchOptions } = useFuzzySearch<TableData>(showSearch); | ||
|
|
||
| const [columnVisibility, setColumnVisibility] = useState<VisibilityState>( | ||
| hiddenColumns?.reduce((acc, columnId) => ({ ...acc, [columnId]: false }), {}) ?? {} | ||
| ); |
There was a problem hiding this comment.
New behavior is introduced for global fuzzy search (showSearch/globalFilter) and column visibility (showColumnFilter/hiddenColumns), but there are no corresponding tests in Table.test.tsx. Please add coverage to verify: (1) enabling showSearch filters rows based on the query, (2) enabling showColumnFilter can hide/show a column and affects rendered headers/cells, and (3) hiddenColumns hides the expected columns on initial render.
| export interface UseFuzzySearchResult<TableData> { | ||
| globalFilter: string; | ||
| setGlobalFilter: (value: string) => void; | ||
| fuzzySearchOptions: Pick< |
There was a problem hiding this comment.
UseFuzzySearchResult.setGlobalFilter is typed as (value: string) => void, but the actual setter returned by useState also supports functional updates ((prev) => next). Exposing the narrower type can unnecessarily restrict callers and is inconsistent with TanStack’s onGlobalFilterChange updater signature. Consider typing it as React.Dispatch<React.SetStateAction<string>> (or OnChangeFn<string> from TanStack) instead.
Signed-off-by: Adrian Sepiół <adisepko@gmail.com>
Description
Screenshots
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes
See e2e docs for more details. Common issues include: