Skip to content

Conversation

@amanmahajan7
Copy link
Collaborator

No description provided.

@amanmahajan7 amanmahajan7 self-assigned this Jul 18, 2023
const index = column.idx + 1;

function onClick() {
selectCell(column.idx);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We probably need to update cell selection logic to handle rowSpan also

@amanmahajan7
Copy link
Collaborator Author

Should we allow groups containing both frozen and unfrozen columns?
image

@codecov
Copy link

codecov bot commented Aug 18, 2023

Codecov Report

Merging #3287 (d9183f0) into main (c7a8e82) will decrease coverage by 0.63%.
The diff coverage is 79.05%.

@@            Coverage Diff             @@
##             main    #3287      +/-   ##
==========================================
- Coverage   83.75%   83.13%   -0.63%     
==========================================
  Files          45       47       +2     
  Lines        4568     4827     +259     
  Branches      717      752      +35     
==========================================
+ Hits         3826     4013     +187     
- Misses        742      814      +72     
Files Changed Coverage Δ
src/GroupedColumnHeaderCell.tsx 33.33% <33.33%> (ø)
src/GroupedColumnHeaderRow.tsx 65.07% <65.07%> (ø)
src/utils/styleUtils.ts 88.05% <80.64%> (-11.95%) ⬇️
src/hooks/useCalculatedColumns.ts 96.56% <91.91%> (-2.56%) ⬇️
src/DataGrid.tsx 88.04% <95.16%> (+0.19%) ⬆️
src/Cell.tsx 94.16% <100.00%> (ø)
src/HeaderCell.tsx 92.69% <100.00%> (+1.47%) ⬆️
src/HeaderRow.tsx 98.01% <100.00%> (+0.01%) ⬆️
src/TreeDataGrid.tsx 79.09% <100.00%> (+0.24%) ⬆️
src/index.ts 100.00% <100.00%> (ø)
... and 3 more

Copy link
Collaborator Author

@amanmahajan7 amanmahajan7 left a comment

Choose a reason for hiding this comment

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

LGTM overall. I will run a few more tests and approve

nstepien
nstepien previously approved these changes Aug 24, 2023
@nstepien nstepien marked this pull request as ready for review August 24, 2023 15:22
Copy link
Collaborator Author

@amanmahajan7 amanmahajan7 left a comment

Choose a reason for hiding this comment

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

A few final comments

Comment on lines 56 to 58
className={clsx(headerRowClassname, {
[rowSelectedClassname]: selectedCellIdx === -1
})}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
className={clsx(headerRowClassname, {
[rowSelectedClassname]: selectedCellIdx === -1
})}
className={headerRowClassname}

TreeDataGrid is not supported so may be we can remove it

return { '--rdg-grid-row-start': rowIdx } as unknown as CSSProperties;
}

export function getHeaderCellStyle<R, SR>(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Worth updating this function to handle colSpan also?

Copy link
Collaborator

Choose a reason for hiding this comment

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

getCellStyle handles it already, so it'd duplicate the work for normal header cells 🤔

}
];

test('grouping', () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should also test that clicking on the group cell correctly selects it. We can do this when we fix cell navigation

@amanmahajan7 amanmahajan7 merged commit 2b6600a into main Aug 24, 2023
@amanmahajan7 amanmahajan7 deleted the am-column-groups branch August 24, 2023 16:47
adityatoshniwal pushed a commit to pgadmin-org/react-data-grid that referenced this pull request Jul 31, 2024
* Initial commit to support column groups

* idk

* calculated groups

* progress

* progress

* progress

* remove level, fix header rows count

* row span

* fix incorrectly skipped headers

* fix scrollPaddingBlock

* Add `aria-rowspan`

* add padding on top to move content at the bottom

* fix colSpan

* fix aria-rowspan

* render grouped column header cells without duplicates

* fix cell positions

* remove `children`

* disallow col groups in TreeDataGrid

* fix test

* add grouping test

* tweak

* dedupe headerRowsHeight

* Remove TODO

* Fix cell click selection on the column group

* grouping -> row grouping

* add col grouping page

* revert common features

* simplify getHeaderCellStyle

* Fix params

* add headerCellClass on ColumnGroup

* group the Or types

* remove TODO, add summary rows in the example

* export CalculatedColumnParent and CalculatedColumnOrColumnGroup

* minor tweaks

* Combine `useMoreCalculatedColumnsStuff` and `useCalculatedColumns`

* tweaks

* consistent gridColumnEnd

* fix tests

* rm rowSelectedClassname usage

* fix cell borders

---------

Co-authored-by: Nicolas Stepien <567105+nstepien@users.noreply.github.com>
Co-authored-by: Nicolas Stepien <stepien.nicolas@gmail.com>
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.

3 participants