feat(data_table): Hotwire-first DataTable component family#353
Open
djalmaaraujo wants to merge 5 commits intomainfrom
Open
feat(data_table): Hotwire-first DataTable component family#353djalmaaraujo wants to merge 5 commits intomainfrom
djalmaaraujo wants to merge 5 commits intomainfrom
Conversation
99af161 to
9b18785
Compare
|
Nice exactly what I was looking for - instead of using datatables/grid.js |
Ports the complete DataTable component family from the web repo: - DataTable (Turbo Frame wrapper + data-controller) - DataTableBulkActions, DataTableToolbar, DataTablePaginationBar - DataTableForm (CSRF-aware form wrapper) - DataTableSearch (debounced GET form via Stimulus) - DataTablePerPageSelect (requestSubmit on change) - DataTableSelectAllCheckbox, DataTableRowCheckbox - DataTableSelectionSummary - DataTableSortHead (server-side sort links with inline SVG icons) - DataTableColumnToggle (client-side visibility via DropdownMenu) - DataTableExpandToggle (accessible row expand button) - DataTablePagination (windowed page links + adapter resolution) Three Stimulus controllers: ruby-ui--data-table (selection + expand delegate), ruby-ui--data-table-column-visibility, ruby-ui--data-table-search (debounced input with focus-restore across Turbo Frame swaps). Inline SVGs replace view_context.lucide_icon calls (chevron-up/down, chevrons-up-down, chevron-right, chevron-down). CGI::escape replaces ActiveSupport's to_query and Hash#except replaces reject-based exclusion.
Three duck-typed adapters exposing current_page, total_pages, total_count, and per_page. No runtime gem dependencies: Manual takes raw integers, Pagy wraps a pagy object (pages/items), Kaminari wraps a collection (total_pages/limit_value). A custom adapter (with:) is also supported.
Covers: server-driven sort/search/pagination, selection + bulk actions, column visibility toggle, and expandable rows. Uses static sample rows (no backend dependency) following the accordion_docs pattern.
Converted from ActiveSupport::TestCase to ComponentTest: test blocks to
def test_* methods, assert_no_match to refute_match (no ActiveSupport),
plain "TEXT" to "TEXT" string literals in Phlex blocks, render_component
to phlex { RubyUI.X(...) }. Adapter tests require their subjects explicitly
since the test_helper glob only autoloads top-level RubyUI:: constants.
157 runs, 656 assertions, 0 failures, 0 errors.
Lists component dependencies: Table, Checkbox, NativeSelect, Pagination, DropdownMenu, Input, Button.
3b26f02 to
d89170c
Compare
cirdes
approved these changes
Apr 26, 2026
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
WhatsApp.Video.2026-04-24.at.17.06.57.mp4
Adds a server-first DataTable component family to the gem. Same surface as PR ruby-ui/web#457 but at the source-of-truth layer. 14 components, 3 Stimulus controllers, 3 pagination adapters, docs view, tests.
Companion PR
Docs site wiring: ruby-ui/web#457