Phase 3: Data Grid Molecule
Objective
Section titled “Objective”Port the core AG Grid wrapper molecule (DataGrid<T>), the SortMenuHeader internal component, and the useColumnPersistence hook into canary. Configure AG Grid native row selection to replace the vendored SelectAllHeaderComponent.
Corresponds to Wave 2 of the Porting Strategy.
Entry Criteria
Section titled “Entry Criteria”Phases 1 and 2 must be complete. Verify by checking artifacts — do NOT re-run tests.
Verify before starting:
- Phase 1 shared artifacts present:
ls src/types/canary/pagination.ts src/components/canary/atoms/shared/formatters.ts src/styles/canary/ag-theme-arda.css(all exist) - Phase 2 cell atoms present — check all 7 type directories exist:
ls src/components/canary/atoms/grid/should showtext/,number/,boolean/,date/,enum/,memo/,color/ - Each cell type has Display + Editor: spot-check one type, e.g.,
ls src/components/canary/atoms/grid/text/showstext-cell-display.tsx,text-cell-editor.tsx,index.ts, test file, story file - Phase 2 exit gate passed: check for
npm run lint+npm run testsuccess in the Phase 2 terminal output (do not re-run)
T3.1 — Port useColumnPersistence
Section titled “T3.1 — Port useColumnPersistence”- Copy
components/extras/molecules/data-grid/use-column-persistence.tstocomponents/canary/molecules/data-grid/use-column-persistence.ts - Create the
canary/molecules/data-grid/directory - AG Grid type imports remain
ag-grid-community(no change needed) - Copy and adapt any existing tests
T3.2 — Port SortMenuHeader
Section titled “T3.2 — Port SortMenuHeader”- Extract from
vendored/arda-frontend/components/table/ArdaGrid.tsx(lines 153-257) - Target:
components/canary/molecules/data-grid/sort-menu-header.tsx - This is an internal sub-component of
DataGrid<T>— do NOT export from the barrel - Dependencies:
ag-grid-community(IHeaderParams),createPortalfromreact-dom - CSS classes (
.arda-sort-header,.arda-sort-header-text,.arda-sort-header-icon,.arda-sort-header-btn,.arda-sort-menu-dropdown) must be present instyles/canary/ag-theme-arda.css(ported in Phase 1) - Create tests: verify sort state sync, dropdown open/close, sort direction application
- Create story demonstrating the sort menu interaction within a DataGrid story
T3.3 — Port DataGrid<T>
Section titled “T3.3 — Port DataGrid<T>”- Copy
components/extras/molecules/data-grid/data-grid.tsxtocomponents/canary/molecules/data-grid/data-grid.tsx - Update imports:
PaginationData→@/types/canary/paginationuseColumnPersistence→./use-column-persistence(canary local)ag-theme-arda.css→@/styles/canary/ag-theme-arda.cssag-grid-reactandag-grid-community— no change
- Add
SortMenuHeaderasdefaultColDef.headerComponent(imported from./sort-menu-header) - Configure AG Grid native row selection (replaces vendored
SelectAllHeaderComponent):
const rowSelection = useMemo(() => ({ mode: 'multiRow' as const, headerCheckbox: true, selectAll: 'all' as const,}), []);
const selectionColumnDef = useMemo(() => ({ pinned: 'left' as const, width: 50, suppressHeaderMenuButton: true,}), []);See Appendix A: AG Grid Row Selection for rationale and reference links.
- Copy and adapt existing tests (note: the extras
data-grid.test.tsxalready has alocalStoragemock fix applied earlier in this project) - Copy and adapt existing stories. Critical: the Wave 2 verification requires that ALL cell atoms from Phase 2 are used in column definitions within the DataGrid stories, demonstrating rendering and editing in place in the grid.
- Create barrel:
components/canary/molecules/data-grid/index.tsexportingDataGrid,DataGridRef, config types,PaginationDatare-export
T3.4 — Verify Cell Atom Integration
Section titled “T3.4 — Verify Cell Atom Integration”- Create or update a DataGrid story that defines columns using every canary cell type: text, number, boolean, date, enum, memo, color
- Each column should demonstrate both display rendering and double-click-to-edit with the corresponding Editor atom
- Verify visually in Storybook that all cell types render and edit correctly within the grid
Acceptance Criteria
Section titled “Acceptance Criteria”components/canary/molecules/data-grid/directory contains:data-grid.tsx,sort-menu-header.tsx,use-column-persistence.ts,index.ts, test files, story filesSortMenuHeaderrenders sort indicators and portal dropdown menu- AG Grid native
rowSelectionprovides tri-state header checkbox and shift-click range selection - All 7 canary cell atom types render correctly in DataGrid column definitions
- No imports from
extrasorvendoredin any canary file npm run lint+npm run testpass
Copyright: © Arda Systems 2025-2026, All rights reserved