Skip to content

Conversation

@msynk
Copy link
Member

@msynk msynk commented Jul 21, 2025

closes #11142

Summary by CodeRabbit

  • New Features

    • Added support for column resizing in the data grid.
    • Introduced options for customizing row CSS classes and styles, including dynamic selectors.
    • Added the ability to specify a unique key for each row and set a custom CSS class for the table.
  • Refactor

    • Improved parameter organization and documentation for the data grid component.
    • Renamed a supporting component for clarity.
  • Style

    • Enhanced formatting and consistency in component markup.

@msynk msynk requested review from Cyrus-Sushiant and ysmoradi July 21, 2025 14:17
@coderabbitai
Copy link

coderabbitai bot commented Jul 21, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes introduce new parameters to the BitDataGrid component, enabling conditional row styling and column resizing. The code is reorganized for clarity, with improved documentation and minor formatting adjustments. Supporting infrastructure is updated to reflect naming consistency, and minor formatting changes are made elsewhere. No core logic or control flow is altered.

Changes

File(s) Change Summary
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor Refactored and reformatted markup; replaced <Defer> with <BitDataGridDefer>; added row class/style attributes.
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs Reorganized and expanded public parameters; added support for row class/style selectors and column resizing.
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDefer.cs Renamed class from Defer to BitDataGridDefer.
src/BlazorUI/Bit.BlazorUI/Extensions/StringExtensions.cs Removed #nullable enable directive.

Sequence Diagram(s)

sequenceDiagram
    participant Consumer as Consumer Component
    participant BitDataGrid as BitDataGrid
    Consumer->>BitDataGrid: Set RowClassSelector/RowStyleSelector
    BitDataGrid->>BitDataGrid: For each row, call selector functions
    BitDataGrid->>BitDataGrid: Apply computed class/style to <tr>
    BitDataGrid-->>Consumer: Rendered DataGrid with conditional row styles
Loading

Estimated code review effort

3 (30–60 minutes)

Poem

🐇
A grid of rows, now dressed with flair,
Colors and classes everywhere!
With code refactored, neat and tight,
Each row can shine in custom light.
The rabbit hops with style anew—
DataGrid, the world now views you!
🌈

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/BlazorUI/Bit.BlazorUI/Extensions/StringExtensions.cs (1)

1-1: Potential loss of nullable-reference analysis + stray BOM character
Removing #nullable enable disables file-level null-state analysis unless it’s already enforced at the project level. Given the string? parameters in this file, keeping the analyser on is valuable for catching null-related issues. Please either:

  1. Verify that the project’s .csproj contains <Nullable>enable</Nullable> (or annotations/warnings) so global rules still apply, or
  2. Restore the directive locally.

In addition, the leading \uFEFF (BOM) character is now visible in the source (namespace …). Consider saving the file without BOM to avoid odd diffs on *nix tooling.

+#nullable enable
namespace Bit.BlazorUI;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Knowledge Base: Disabled due to Reviews > Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between a0a7eab and a06f2c7.

📒 Files selected for processing (4)
  • src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor (4 hunks)
  • src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs (6 hunks)
  • src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDefer.cs (1 hunks)
  • src/BlazorUI/Bit.BlazorUI/Extensions/StringExtensions.cs (1 hunks)
🔇 Additional comments (14)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDefer.cs (1)

9-9: LGTM! Good naming consistency improvement.

The class rename from Defer to BitDataGridDefer aligns well with the component's naming conventions and improves code organization.

src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor (6)

5-7: LGTM! Improved code block organization.

Wrapping the StartCollectingColumns() call in explicit code blocks improves code readability and consistency.


9-12: LGTM! Consistent component usage and formatting.

The replacement of <Defer> with <BitDataGridDefer> aligns with the infrastructure changes, and the explicit code blocks around FinishCollectingColumns() maintain consistency.


24-29: LGTM! Attribute reordering for consistency.

The Virtualize component's attribute reordering improves code consistency while maintaining all functionality.


64-64: LGTM! Excellent integration of new row styling parameters.

The addition of class="@GetRowClass(item)" and style="@GetRowStyle(item)" attributes properly integrates the new row styling functionality. The @key="@(ItemKey(item))" also ensures proper row identity tracking.


67-71: LGTM! Clean cell content rendering.

Wrapping the cell content rendering in explicit code blocks maintains clean separation and consistent formatting.


81-85: LGTM! Consistent placeholder cell rendering.

The explicit code blocks for placeholder content rendering maintain consistency with the regular cell rendering approach.

src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs (7)

81-90: LGTM! Well-documented component interface.

The new ChildContent and Class parameters are properly documented and follow established patterns.


103-113: LGTM! Excellent ItemKey parameter design.

The ItemKey parameter with its comprehensive documentation and sensible default value (x => x!) provides good flexibility for row identity tracking.


122-127: LGTM! Improved ItemSize documentation.

The enhanced documentation clearly explains the parameter's use with virtualization.


129-136: LGTM! Clear pagination parameter documentation.

The expanded documentation effectively explains the relationship with BitDataGridPaginator and pagination state management.


138-147: LGTM! Comprehensive row styling parameters.

The new parameters ResizableColumns, RowClass, RowClassSelector, RowStyle, and RowStyleSelector properly address the PR objectives for enhanced row styling capabilities.


149-152: LGTM! Consistent theme parameter documentation.

The Theme parameter documentation is clear and maintains consistency.


491-491: LGTM! Minor formatting improvement.

The addition of a space after catch improves code formatting consistency.

@msynk msynk merged commit e167aaf into bitfoundation:develop Jul 21, 2025
3 checks passed
@msynk msynk deleted the 11142-blazorui-datagrid-row-classstyles branch July 21, 2025 18:33
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.

Support conditional row background color in DataGrid

2 participants