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

[docs] Add Rendering section #267

Merged
merged 6 commits into from
Sep 14, 2020

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Sep 12, 2020

@oliviertassinari oliviertassinari added the docs Improvements or additions to the documentation label Sep 12, 2020
@oliviertassinari oliviertassinari force-pushed the docs-data-grid-v15 branch 4 times, most recently from 1a46904 to 37a0ff6 Compare September 12, 2020 19:53
@oliviertassinari oliviertassinari force-pushed the docs-data-grid-v15 branch 2 times, most recently from 5f28daa to b5ce5c2 Compare September 13, 2020 00:18
@oliviertassinari oliviertassinari force-pushed the docs-data-grid-v15 branch 2 times, most recently from a34476d to e4bc305 Compare September 13, 2020 18:12
Comment on lines -4 to +3
export function AutoSizerWrapper(props: any) {
return <AutoSizer {...props}>{(size: any) => props.children(size)}</AutoSizer>;
}
export const AutoSizerWrapper = AutoSizer;
Copy link
Member Author

Choose a reason for hiding this comment

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

Avoid the creation of one component. It should be slightly faster.

export const Cell: React.FC<GridCellProps> = React.memo(
({
value,
field,
width,
children,
showRightBorder,
export const Cell: React.FC<GridCellProps> = React.memo((props) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

coding style convention

Comment on lines -75 to +74
!width ? null : <Cell key="empty-col-left" width={width} />,
!width ? null : <Cell width={width} />,
Copy link
Member Author

Choose a reason for hiding this comment

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

The impact of a key is limited to the component that renders the element. So no impact here.

Comment on lines +17 to +26
columns: Columns;
domIndex: number;
extendRowFullWidth: boolean;
firstColIdx: number;
lastColIdx: number;
hasScroll: { y: boolean; x: boolean };
scrollSize: number;
columns: Columns;
lastColIdx: number;
row: RowModel;
showCellRightBorder: boolean;
extendRowFullWidth: boolean;
rowIndex: number;
domIndex: number;
scrollSize: number;
showCellRightBorder: boolean;
Copy link
Member Author

Choose a reason for hiding this comment

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

sort asc

Comment on lines +17 to +18
color: theme.palette.text.primary,
...theme.typography.body2,
Copy link
Member Author

Choose a reason for hiding this comment

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

move as much CSS as possible to the root.

Comment on lines +41 to +44
backgroundColor: fade(
theme.palette.background.default,
theme.palette.action.disabledOpacity,
),
Copy link
Member Author

Choose a reason for hiding this comment

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

Add missing color indicator that there is an overlay blocking the interaction on the cells.

<RightEmptyCell key="right-empty" width={renderCtx.rightEmptyWidth} />
<RightEmptyCell width={renderCtx.rightEmptyWidth} />
Copy link
Member Author

Choose a reason for hiding this comment

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

key has no impact, the position of the children is known by React, it never changes.

const componentParams: ComponentParams = React.useMemo(
const componentProps: ComponentProps = React.useMemo(
Copy link
Member Author

Choose a reason for hiding this comment

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

These used to be render functions, but are components now, hence params -> props to avoid confusion.

@@ -8,7 +8,6 @@ export const NUMERIC_COL_DEF: ColTypeDef = {
type: 'number',
align: 'right',
headerAlign: 'right',
width: 80,
Copy link
Member Author

@oliviertassinari oliviertassinari Sep 13, 2020

Choose a reason for hiding this comment

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

We document 100px as the default, probably also simpler for developers to do the math when they see that they need to add or remove space.

Comment on lines 23 to 27
export const stringNumberComparer: ComparatorFn = (v1: CellValue, v2: CellValue) => {
const nillResult = nillComparer(v1, v2);
if (nillResult != null) {
if (nillResult !== null) {
return nillResult;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

The method seems to be relatively slow when sorting 100,000 rows in memory. I'm not sure we have any great alternatives.

{ field: 'id', hide: true },
{
field: 'date',
width: 500,
Copy link
Member

Choose a reason for hiding this comment

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

you can add a column type here to render the date formatted

Copy link
Member Author

Choose a reason for hiding this comment

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

Great idea

@dtassone
Copy link
Member

Handle https://deploy-preview-267--material-ui-x.netlify.app/components/data-grid/rendering/

Capture d’écran 2020-09-13 à 20 16 23

How do we access the ant-design grid?

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Sep 14, 2020

How do we access the ant-design grid?

Scroll at the bottom of the page or on the overview page click on the "100% customizable" link.

@oliviertassinari oliviertassinari merged commit 0b310e3 into mui:master Sep 14, 2020
@oliviertassinari oliviertassinari deleted the docs-data-grid-v15 branch September 14, 2020 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants