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

Expose tree index at placeholder position #179

Open
chris-oms opened this issue Dec 13, 2022 · 2 comments
Open

Expose tree index at placeholder position #179

chris-oms opened this issue Dec 13, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@chris-oms
Copy link

chris-oms commented Dec 13, 2022

Is your feature request related to a problem? Please describe.
When dragging from one tree to another, I can't currently find a way to drop the external node into the location shown by the placeholder (as demo'd in the "Manual sort with placeholder" example). If the index of the tree item before the placeholder was somehow exposed, I could then calculate the position required to push the new node item into the tree.

Describe the solution you'd like
Expose the index of the external tree item to the placeholder component callback

Describe alternatives you've considered
I cannot find another way of doing what I'm after. Any solution that would allow the correct position for the external node to be placed would be fine - it doesn't have to be the one I've suggested

@chris-oms chris-oms added the enhancement New feature or request label Dec 13, 2022
@minop1205
Copy link
Owner

minop1205 commented Dec 13, 2022

@chris-oms Can't use options.relativeIndex ?

image

@chris-oms
Copy link
Author

@minop1205 I get Property 'relativeIndex' does not exist on type 'PlaceholderRenderParams'

Looks like the only property of options that is passed through to placeholderRender is depth, or am I missing something?

placeholderRender={(node, { depth }) => <OrderDividerPlaceholder depth={depth} />}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants