feat(createDataTable): add new composable#138
Merged
johnleider merged 18 commits intomasterfrom Feb 18, 2026
Merged
Conversation
Composes createFilter, createGroup (tri-state sort), and createPagination into a unified data table pipeline with row selection and auto page reset.
Extract pipeline into adapter hierarchy following v0 patterns (ThemeAdapter/LoggerAdapter). Abstract DataTableAdapter provides shared filter/sort; ClientAdapter (v0.ts), ServerAdapter, and VirtualAdapter implement pipeline strategies.
Rename variables to remove redundant prefixes where context is clear: sortGroup→group, sortOrder→order, toggleSort→toggle, resetSort→reset, sortableColumns→sortable, filterableKeys→filterable, paginatedItems→visible, getRowId→rowId. Public API: sort.sortBy→sort.entries.
…forcement - Add sort.direction(key) and sort.priority(key) for aria-sort support - Add total: ComputedRef<number> to all adapters for aria-rowcount - Enforce readonly on computed array returns and sort order - Guard compareValues against NaN using isNaN from v0 utilities
…port Readonly enforcement (selectedIds, columns), type-safe itemValue, rename sort.entries to sort.columns, locale-aware sorting via useLocale fallback chain, loading/error adapter states, and selection scope docs.
Lightweight Set-based expansion with expand/collapse/toggle per row, expandAll/collapseAll bulk ops, and accordion mode via expandMultiple.
…/filter, grouping - selectStrategy: 'single' | 'page' | 'all' for selection scope control - mustSort: prevent clearing sort (asc ↔ desc cycle) - firstSortOrder: 'asc' | 'desc' for initial sort direction - DataTableColumn.sort: per-column custom sort comparator - DataTableColumn.filter: per-column custom filter function - itemSelectable: per-row selectability with isSelectable() guard - groupBy: row grouping with open/close state management
- mustSort → mandate - search ref → search() function + query ref - isOpen → opened - ServerAdapter totalItems → total
- Add 'data' to nav subcategory ordering - Update all cross-references across docs - Add createDataTable docs with 4 multi-file examples
…dd ariaSort - Make DataTableColumn generic with key: keyof T & string - Constrain groupBy to keyof T, itemValue to KeysOfType<T, ID> - Make columns input readonly, remove unsafe casts - Add ariaSort() method for ARIA-ready sort values - Fix filterable derivation to require explicit filterable: true - Fix isSelectable to return false for non-existent items - Add SSR warning JSDoc, clarify expansion scope asymmetry
ARIA translation belongs in the component layer, not the headless composable. Consumers map sort.direction() to aria-sort values themselves.
|
commit: |
Use isNullOrUndefined from v0 utilities, remove section comments, simplify watch source in server example.
…y locale - Replace computed with toRef where caching is unnecessary (.length, toValue(), ternary, constants) - Update interfaces from ComputedRef to Readonly<Ref> - Use toSorted instead of spread + sort - Simplify locale resolution to use useLocale() built-in fallback - Replace triangle sort icons with chevrons in examples
Cover search, sort cycles (mandate/firstSortOrder/multi), selection strategies (single/page/all with itemSelectable), expansion, grouping, client/server/virtual adapters, trinity context, and edge cases.
Cover initialization, search/sort/selection pipelines, grouping, computed access caching, full end-to-end pipeline, and client vs virtual adapter comparison at 1K and 10K dataset sizes.
…ction performance - Rename grouping.opened() → isOpen() for consistency with isSelected/isExpanded - Change DataTableGroup.value type from unknown to T[keyof T & string] - Fix enroll initialization to handle async data sources via watcher fallback - Constrain itemSelectable to KeysOfType<T, boolean> - Cache selectable IDs in computed Set for O(1) lookups (was O(n) per call) - Narrow adapter context types: filterableKeys, customSorts, customColumnFilters - Add explicit type assertions on loading/error destructured defaults - Add useDataTable @typeparam JSDoc recommending trinity pattern - Add Options reference table and sort.order to docs
24370a5 to
ab952d3
Compare
johnleider
added a commit
that referenced
this pull request
Mar 21, 2026
* feat(createDataTable): composable data table from v0 primitives Composes createFilter, createGroup (tri-state sort), and createPagination into a unified data table pipeline with row selection and auto page reset. * feat(createDataTable): adapter pattern with v0 naming conventions Extract pipeline into adapter hierarchy following v0 patterns (ThemeAdapter/LoggerAdapter). Abstract DataTableAdapter provides shared filter/sort; ClientAdapter (v0.ts), ServerAdapter, and VirtualAdapter implement pipeline strategies. * refactor(createDataTable): tighten internal naming to single-word focus Rename variables to remove redundant prefixes where context is clear: sortGroup→group, sortOrder→order, toggleSort→toggle, resetSort→reset, sortableColumns→sortable, filterableKeys→filterable, paginatedItems→visible, getRowId→rowId. Public API: sort.sortBy→sort.entries. * feat(createDataTable): add sort helpers, total count, and readonly enforcement - Add sort.direction(key) and sort.priority(key) for aria-sort support - Add total: ComputedRef<number> to all adapters for aria-rowcount - Enforce readonly on computed array returns and sort order - Guard compareValues against NaN using isNaN from v0 utilities * feat(createDataTable): harden types, add locale and loading/error support Readonly enforcement (selectedIds, columns), type-safe itemValue, rename sort.entries to sort.columns, locale-aware sorting via useLocale fallback chain, loading/error adapter states, and selection scope docs. * feat(createDataTable): add row expansion support Lightweight Set-based expansion with expand/collapse/toggle per row, expandAll/collapseAll bulk ops, and accordion mode via expandMultiple. * feat(createDataTable): add select strategy, sort options, custom sort/filter, grouping - selectStrategy: 'single' | 'page' | 'all' for selection scope control - mustSort: prevent clearing sort (asc ↔ desc cycle) - firstSortOrder: 'asc' | 'desc' for initial sort direction - DataTableColumn.sort: per-column custom sort comparator - DataTableColumn.filter: per-column custom filter function - itemSelectable: per-row selectability with isSelectable() guard - groupBy: row grouping with open/close state management * refactor(createDataTable): refine API surface - mustSort → mandate - search ref → search() function + query ref - isOpen → opened - ServerAdapter totalItems → total * docs(createDataTable): add data category and documentation page - Add 'data' to nav subcategory ordering - Update all cross-references across docs - Add createDataTable docs with 4 multi-file examples * refactor(createDataTable): harden types, fix filter/selection bugs, add ariaSort - Make DataTableColumn generic with key: keyof T & string - Constrain groupBy to keyof T, itemValue to KeysOfType<T, ID> - Make columns input readonly, remove unsafe casts - Add ariaSort() method for ARIA-ready sort values - Fix filterable derivation to require explicit filterable: true - Fix isSelectable to return false for non-existent items - Add SSR warning JSDoc, clarify expansion scope asymmetry * refactor(createDataTable): remove ariaSort from headless composable ARIA translation belongs in the component layer, not the headless composable. Consumers map sort.direction() to aria-sort values themselves. * refactor(createDataTable): clean up adapter utilities and examples Use isNullOrUndefined from v0 utilities, remove section comments, simplify watch source in server example. * refactor(createDataTable): use toRef for trivial derivations, simplify locale - Replace computed with toRef where caching is unnecessary (.length, toValue(), ternary, constants) - Update interfaces from ComputedRef to Readonly<Ref> - Use toSorted instead of spread + sort - Simplify locale resolution to use useLocale() built-in fallback - Replace triangle sort icons with chevrons in examples * docs(createDataTable): improve adapter docs, fix server example, update sort icons * docs(createDataTable): fix group toggle icons, fix virtual table border bleed * test(createDataTable): add comprehensive test suite Cover search, sort cycles (mandate/firstSortOrder/multi), selection strategies (single/page/all with itemSelectable), expansion, grouping, client/server/virtual adapters, trinity context, and edge cases. * perf(createDataTable): add benchmark suite Cover initialization, search/sort/selection pipelines, grouping, computed access caching, full end-to-end pipeline, and client vs virtual adapter comparison at 1K and 10K dataset sizes. * perf(createDataTable): improve type safety, API consistency, and selection performance - Rename grouping.opened() → isOpen() for consistency with isSelected/isExpanded - Change DataTableGroup.value type from unknown to T[keyof T & string] - Fix enroll initialization to handle async data sources via watcher fallback - Constrain itemSelectable to KeysOfType<T, boolean> - Cache selectable IDs in computed Set for O(1) lookups (was O(n) per call) - Narrow adapter context types: filterableKeys, customSorts, customColumnFilters - Add explicit type assertions on loading/error destructured defaults - Add useDataTable @typeparam JSDoc recommending trinity pattern - Add Options reference table and sort.order to docs
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
createDataTablecomposable that composes v0 primitives (createGroup, createFilter, createPagination) into a complete data pipelineClientAdapter(default),ServerAdapter, andVirtualAdaptercreateDataTableContext/useDataTableDataTableColumn<T>withkeyof T & stringcolumn keysTest plan
pnpm typecheckpassespnpm lint:fixpasses (only pre-existing unrelated catalog error)