Skip to content

Addition of the search filters in a form of filters tabs#184

Open
gkrajniak wants to merge 2 commits into
mainfrom
feat/filter-tabs
Open

Addition of the search filters in a form of filters tabs#184
gkrajniak wants to merge 2 commits into
mainfrom
feat/filter-tabs

Conversation

@gkrajniak

@gkrajniak gkrajniak commented Jun 29, 2026

Copy link
Copy Markdown
Member

The feature takes form of a filters fabs, All tab is added automatically whne there is any filter added as a way to clear applied filter

image image

Summary by CodeRabbit

  • New Features

    • Added optional filter tabs to table cards, letting users switch between predefined views above the table.
    • Included an “All” tab and automatic default-tab selection when configured.
    • Added overflow navigation for tab strips when there are many tabs.
  • Bug Fixes

    • Improved table header spacing and adjusted card header styling for a cleaner layout.
  • Documentation

    • Expanded table card docs with setup, behavior, accessibility, and filtering examples.

Signed-off-by: gkrajniak <gkrajniak@gmail.com>
@gkrajniak gkrajniak requested review from a team as code owners June 29, 2026 13:20
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@gkrajniak, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 35 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bdb17a74-947b-424d-84a8-9c014f37ae22

📥 Commits

Reviewing files that changed from the base of the PR and between 99ecec6 and 54ac451.

📒 Files selected for processing (3)
  • projects/ngx/declarative-ui/stories/discard-changes-dialog.stories.ts
  • projects/ngx/declarative-ui/stories/edit-cards-dialog.stories.ts
  • projects/ngx/declarative-ui/stories/unsaved-changes-dialog.stories.ts
📝 Walkthrough

Walkthrough

Adds a horizontally scrollable filter tab strip to DeclarativeTableCard. A new FieldFilterDefinition interface and optional filterTabs config property are introduced. The component gains tab selection signals, a ResizeObserver-driven chevron scroll mechanism, and a filterTabChanged output. Supporting HTML, SCSS, Storybook stories, and documentation are included.

Changes

Filter Tabs Feature

Layer / File(s) Summary
FieldFilterDefinition interface and TableCardConfig extension
projects/ngx/declarative-ui/table-card/models/configs.ts
Adds the FieldFilterDefinition interface (label, property, value, optional default) and an optional filterTabs array to TableCardConfig.
Component logic: signals, scroll, ResizeObserver, output
projects/ngx/declarative-ui/table-card/declarative-table-card.component.ts
Adds filterTabChanged output, filter tab computed signals, activeFilterTab signal seeded via effect, ResizeObserver-backed canScrollLeft/canScrollRight state, and selectFilterTab/scrollFilterStrip methods; class now implements OnDestroy to disconnect the observer.
Template and styles for filter tab strip
projects/ngx/declarative-ui/table-card/declarative-table-card.component.html, ...component.scss, projects/ngx/declarative-ui/table/declarative-table/declarative-table.component.scss
Inserts conditional @if (hasFilterTabs()) block with "All" tab, dynamic tab list, and chevron buttons; adds SCSS for strip layout, tab hover/active/underline states, and chevron styling; removes old header bottom border; fixes table header row padding.
Storybook stories and documentation
projects/ngx/declarative-ui/stories/declarative-table-card.stories.ts, docs/declarative-table-card.md
Adds three stories (WithFilterTabs, WithFilterTabsAllActive, WithFilterTabsOverflow) and a full "Filter tabs" docs section covering rendering rules, carousel behavior, selection logic, host integration patterns, and keyboard accessibility.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

enhancement

Suggested reviewers

  • lpgarzonr

Poem

🐇 Hop along the tabs so bright,
"All" at the start, the rest in sight,
Chevrons scroll when tabs overflow,
A ResizeObserver steals the show,
The filter hops with every click—
This rabbit built it pretty quick! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: adding filter tabs for table search/filtering.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/filter-tabs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (1)
projects/ngx/declarative-ui/table-card/models/configs.ts (1)

52-53: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document or enforce a single default tab.

This contract currently allows multiple default: true entries, but the component initializes with the first match only (filterTabs().find((t) => t.default) in projects/ngx/declarative-ui/table-card/declarative-table-card.component.ts). Tightening the API here would avoid silent misconfiguration for hosts.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@projects/ngx/declarative-ui/table-card/models/configs.ts` around lines 52 -
53, The table tab config currently allows multiple entries to set default true,
but DeclarativeTableCardComponent only uses the first match via
filterTabs().find((t) => t.default), which can hide misconfiguration. Tighten
the Config interface in configs.ts by documenting or enforcing that only one tab
may be default, and update the tab selection logic in
declarative-table-card.component.ts to validate and reject multiple defaults (or
otherwise surface an explicit error) instead of silently picking the first
match.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/declarative-table-card.md`:
- Around line 279-280: Clarify the initial default-tab behavior in the
declarative table card docs: `activeFilterTab` is initialized from a
`FieldFilterDefinition` with `default: true`, but
`selectFilterTab()`/`filterTabChanged` only fire on user interaction. Update the
contract around `activeFilterTab`, `selectFilterTab()`, and `filterTabChanged`
so hosts know they must seed the initial dataset/query from the default tab too,
or explicitly emit the initial selection during setup.

In
`@projects/ngx/declarative-ui/table-card/declarative-table-card.component.html`:
- Around line 66-89: The filter controls in
declarative-table-card.component.html are using tab semantics for a filter UI,
which is the wrong accessibility pattern. Update the filter strip and its
buttons to use plain button/toggle semantics by removing the tablist/tab roles
and related aria-selected state from the All button and the `@for` tab buttons, or
alternatively implement the full tabs pattern with roving tabindex, keyboard
handling, and panel association. Use the existing filterStrip, isAllTabActive(),
activeFilterTab(), and selectFilterTab() references to locate the markup to
adjust.

In
`@projects/ngx/declarative-ui/table-card/declarative-table-card.component.scss`:
- Around line 96-139: The new filter tab styles in
declarative-table-card.component.scss have inline `//` comments that violate
`scss/double-slash-comment-empty-line-before`. Update the `&__filter-tabs`,
`&__filter-strip`, and `&__filter-tab` blocks so the comments have the required
blank line before them, or convert those notes to block comments, keeping the
SCSS lint-clean.

In `@projects/ngx/declarative-ui/table-card/declarative-table-card.component.ts`:
- Line 180: The callbacks passed to afterNextRender in
DeclarativeTableCardComponent are using shorthand arrows that return void
expressions, which violates the lint rule. Update the affected afterNextRender
calls to use block-bodied arrow functions and invoke recomputeScrollState() and
any other side-effect-only methods inside the block, keeping the behavior
unchanged. Locate the affected usages in DeclarativeTableCardComponent by the
afterNextRender and recomputeScrollState symbols.
- Around line 186-194: The ResizeObserver setup in afterNextRender for
DeclarativeTableCardComponent only runs once, so if filterTabs appears after the
initial render and filterStripRef is still missing, no observer is ever
attached. Move the observer attachment logic into a place that runs when the
conditional strip becomes available or is updated, using the existing
DeclarativeTableCardComponent and recomputeScrollState flow so observe() is
called once filterStripRef() exists.

---

Nitpick comments:
In `@projects/ngx/declarative-ui/table-card/models/configs.ts`:
- Around line 52-53: The table tab config currently allows multiple entries to
set default true, but DeclarativeTableCardComponent only uses the first match
via filterTabs().find((t) => t.default), which can hide misconfiguration.
Tighten the Config interface in configs.ts by documenting or enforcing that only
one tab may be default, and update the tab selection logic in
declarative-table-card.component.ts to validate and reject multiple defaults (or
otherwise surface an explicit error) instead of silently picking the first
match.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1341d0fd-944e-43ec-903b-929fdbe8e3b4

📥 Commits

Reviewing files that changed from the base of the PR and between cd230b8 and 99ecec6.

📒 Files selected for processing (7)
  • docs/declarative-table-card.md
  • projects/ngx/declarative-ui/stories/declarative-table-card.stories.ts
  • projects/ngx/declarative-ui/table-card/declarative-table-card.component.html
  • projects/ngx/declarative-ui/table-card/declarative-table-card.component.scss
  • projects/ngx/declarative-ui/table-card/declarative-table-card.component.ts
  • projects/ngx/declarative-ui/table-card/models/configs.ts
  • projects/ngx/declarative-ui/table/declarative-table/declarative-table.component.scss

Comment thread docs/declarative-table-card.md
… for `DashboardI18nService`

Signed-off-by: gkrajniak <gkrajniak@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant