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

Wrapperless cell editor #123

Closed
pzcfg opened this issue Dec 27, 2021 · 6 comments
Closed

Wrapperless cell editor #123

pzcfg opened this issue Dec 27, 2021 · 6 comments

Comments

@pzcfg
Copy link
Contributor

pzcfg commented Dec 27, 2021

I'm building a custom cell editor using the provideEditor attribute, but it seems that this enforces that the editor gets put inside a DataGridOverlayEditorStyle and clip-region div which adds its own border, border radius and styles input and textarea elements.

const portal = createPortal(
<ClickOutsideContainer className={className} onClickOutside={onClickOutside}>
<DataGridOverlayEditorStyle targetRect={target} pad={pad}>
<div className="clip-region" onKeyDown={CustomEditor === undefined ? undefined : onKeyDown}>
{editor}
</div>
</DataGridOverlayEditorStyle>
</ClickOutsideContainer>,
portalElement
);

Would it be possible to support a version of provideEditor that handles its own borders to allow for more flexibility?

I see that I can add a disablePadding property to remove the padding, but it would be great if there was another attribute that could remove some of this other styling too.

let pad = true;
let editor: React.ReactNode;
if (CustomEditor !== undefined) {
pad = CustomEditor.disablePadding !== true;
editor = (
<CustomEditor
isHighlighted={highlight}
onChange={setTempValue}
value={targetValue}
onFinishedEditing={onClickOutside}
/>
);

@bjgrosse
Copy link

Another vote for this!

@jassmith
Copy link
Contributor

jassmith commented Feb 2, 2022

Yes this can be added, we cant get rid of the wrapper entirely but we can unstyle it.

@pzcfg
Copy link
Contributor Author

pzcfg commented Feb 2, 2022

That works for me!

One other issue I've been running into is needing more editor space below the cell. Currently there's a max-height: calc(100vh - ${p => p.targetRect.y + 10}px) that's preventing that from growing. I can use the experimental.paddingBottom to help alleviate this if the user manually scrolls down, but if they haven't, it only scrolls to the bottom of the cell itself and then keeps it clipped. Do you have a suggestion for working around that?

@jassmith
Copy link
Contributor

jassmith commented Feb 2, 2022

What do you want that to do? Currently it stops the cell editor going off screen

@pzcfg
Copy link
Contributor Author

pzcfg commented Feb 2, 2022

I think in the ideal world, if the child wants to grow, it would scroll the table so that the top of the editor still lines up with the cell but the bottom of the editor isn't cut off, but that seems overly complicated. Maybe the editor could specify an anticipated max-height and the table will try to scroll that extra amount when you go to edit?

For now I think I can work around it using paddingBottom and scrollTo with paddingY getting added here #139 (comment)

I'll give some more thought on what would be best here

@jassmith
Copy link
Contributor

jassmith commented Feb 3, 2022

Fixed in 3.3.0

@jassmith jassmith closed this as completed Feb 3, 2022
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

No branches or pull requests

3 participants