Background
PR #108 introduced the table rendering seam — TableRenderer<TData> / TableRendererProps<TData> plus bindQuery / bindObservableQuery — and re-expressed DataTableForQuery / DataTableForObservableQuery on top of it. Everything currently lives in @cratis/components/DataTables.
That location is correct for the initial proof, but it is not the ideal long-term home for the behavior half.
Why move
The seam's value is that the UI library is a swappable detail. Today the abstraction that delivers that (TableRenderer + bindQuery) lives inside the PrimeReact library it is meant to abstract away — so consuming bindQuery forces a dependency on @cratis/components and PrimeReact, even for someone who wants a completely different table library.
The binding behavior is the exact analogue of asCommandFormField, which lives in @cratis/arc.react/commands, and it is built on useQueryWithPaging / useObservableQueryWithPaging from @cratis/arc.react/queries. Moving it there would let a Cratis app bind Arc queries to its own table with no PrimeReact dependency, and leave @cratis/components as purely a rendering library — one implementation of the contract, not its owner.
The blocker
bindQuery / bindObservableQuery currently also render TablePaginator (which pulls primereact/button) and the bordered container chrome. @cratis/components depends on @cratis/arc.react (peer dep), never the reverse, so anything that renders the PrimeReact paginator cannot live in arc.react. The behavior and the paginator rendering must be separated first.
Proposed end state
@cratis/arc.react owns:
TableRenderer / TableRendererProps (pure types, no PrimeReact — could move first, independently).
- A headless
bindQuery / bindObservableQuery that exposes paging state and handlers (page, pageCount, setPage, …) and feeds data to the renderer — no paginator, no chrome.
@cratis/components owns:
DataTableCore (implements the arc.react TableRenderer contract).
TablePaginator and the container chrome.
- A batteries-included wrapper that composes the headless binding with the paginator, preserving today's
DataTableForQuery / DataTableForObservableQuery public API.
Notes
- Cross-repo change (arc.react ships from the ApplicationModel/Arc repo).
- Must stay non-breaking:
DataTableForQuery / DataTableForObservableQuery public props and behavior are unchanged.
- Smallest first step, if desired: relocate only the
TableRenderer / TableRendererProps contract to arc.react (no circular-dependency issue, since it carries no PrimeReact).
Background
PR #108 introduced the table rendering seam —
TableRenderer<TData>/TableRendererProps<TData>plusbindQuery/bindObservableQuery— and re-expressedDataTableForQuery/DataTableForObservableQueryon top of it. Everything currently lives in@cratis/components/DataTables.That location is correct for the initial proof, but it is not the ideal long-term home for the behavior half.
Why move
The seam's value is that the UI library is a swappable detail. Today the abstraction that delivers that (
TableRenderer+bindQuery) lives inside the PrimeReact library it is meant to abstract away — so consumingbindQueryforces a dependency on@cratis/componentsand PrimeReact, even for someone who wants a completely different table library.The binding behavior is the exact analogue of
asCommandFormField, which lives in@cratis/arc.react/commands, and it is built onuseQueryWithPaging/useObservableQueryWithPagingfrom@cratis/arc.react/queries. Moving it there would let a Cratis app bind Arc queries to its own table with no PrimeReact dependency, and leave@cratis/componentsas purely a rendering library — one implementation of the contract, not its owner.The blocker
bindQuery/bindObservableQuerycurrently also renderTablePaginator(which pullsprimereact/button) and the bordered container chrome.@cratis/componentsdepends on@cratis/arc.react(peer dep), never the reverse, so anything that renders the PrimeReact paginator cannot live inarc.react. The behavior and the paginator rendering must be separated first.Proposed end state
@cratis/arc.reactowns:TableRenderer/TableRendererProps(pure types, no PrimeReact — could move first, independently).bindQuery/bindObservableQuerythat exposes paging state and handlers (page,pageCount,setPage, …) and feedsdatato the renderer — no paginator, no chrome.@cratis/componentsowns:DataTableCore(implements the arc.reactTableRenderercontract).TablePaginatorand the container chrome.DataTableForQuery/DataTableForObservableQuerypublic API.Notes
DataTableForQuery/DataTableForObservableQuerypublic props and behavior are unchanged.TableRenderer/TableRendererPropscontract toarc.react(no circular-dependency issue, since it carries no PrimeReact).