Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy grouping props #2012

Merged
merged 6 commits into from
Apr 21, 2020
Merged

Remove legacy grouping props #2012

merged 6 commits into from
Apr 21, 2020

Conversation

amanmahajan7
Copy link
Contributor

@amanmahajan7 amanmahajan7 commented Apr 21, 2020

Cell selection on the grouped row is off on the grouped row but that is how legacy worked so I am not changing it. Let's revisit when we add the new grouping API

@amanmahajan7 amanmahajan7 marked this pull request as ready for review April 21, 2020 14:01
@amanmahajan7 amanmahajan7 self-assigned this Apr 21, 2020
}: IRowRendererProps<R, SR>) {
const { __metaData } = row as RowData;
onRowClick
}: RowRendererProps<R, SR> & SharedDataGridProps<R, SR>) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wonder if we should use memo on the Row component and delete RowRenderer. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

We still want to have the ability to customize the rowrenderer, right? I believe that's the reason why we kept this layer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's just delete this module, memoize Row, and use the Row/rowRenderer directly.
Custom row renderers can memo themselves.

eventBus: EventBus;
isRowSelected: boolean;
}
type IRowRendererProps<R, SR> = RowRendererProps<R, SR> & SharedDataGridProps<R, SR>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need this? Or we should use it at ln#23


function groupByColumn(rows: Row[], columnKeys: string[], expandedGroups: Set<string>, treeDepth = 0, parentKey = '') {
if (columnKeys.length === 0) return rows;
const gridRows: any = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it due to the expanded data so that we cannot put Row[] here?

}: IRowRendererProps<R, SR>) {
const { __metaData } = row as RowData;
onRowClick
}: RowRendererProps<R, SR> & SharedDataGridProps<R, SR>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We still want to have the ability to customize the rowrenderer, right? I believe that's the reason why we kept this layer.

stories/demos/LegacyGrouping.tsx Outdated Show resolved Hide resolved
height: var(--row-height);
line-height: var(--row-height);
padding: 0 8px;
border-bottom: 1px solid #ddd;
Copy link
Contributor

Choose a reason for hiding this comment

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

border-bottom seems like a common variable, I'm wondering if we want to create a css variable for this.

package.json Outdated Show resolved Hide resolved
src/RowRenderer.tsx Outdated Show resolved Hide resolved
}: IRowRendererProps<R, SR>) {
const { __metaData } = row as RowData;
onRowClick
}: RowRendererProps<R, SR> & SharedDataGridProps<R, SR>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's just delete this module, memoize Row, and use the Row/rowRenderer directly.
Custom row renderers can memo themselves.

stories/demos/LegacyGrouping.tsx Outdated Show resolved Hide resolved
const rowGroupHeader = {
groupKey,
name: key,
__metaData: {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it'd be better to refactor this to a more realistic data structure, maybe something like

interface RowGroup {
  type: 'group';
  // ...
}

interface RowData {
  type: 'data';
  // ...
}

type Row = RowGroup | RowData;

Not worth our time right now though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simplified types a bit

stories/demos/LegacyGrouping.tsx Outdated Show resolved Hide resolved
stories/demos/LegacyGrouping.tsx Outdated Show resolved Hide resolved
@amanmahajan7 amanmahajan7 merged commit bdf3a88 into canary Apr 21, 2020
@amanmahajan7 amanmahajan7 deleted the remove-legacy-grouping branch April 21, 2020 18:24
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.

None yet

3 participants