Comments (6)
Hi @ddenev , I published a patched version. I hope it solves the issue. I still expect some bugs though.
from dflex.
Thank you, @jalal246! Will test and let you know
from dflex.
I have several questions:
- When migrating an element between containers, many
$onDragOver
and$onDragLeave
events are fired (check the sandbox, drag an element from one container to the other and observer the console). Why so many events for a single drag operation?
Note: I assume these fire for every child of the receiving container but to me this looks wrong - I need an
onDrop
or aonDragend
event, i.e. how do I receive the results from the drag operation?
Let me explain: I'm using Vue and my lists are rendered based on my reactive state. So I don't really care for DFlex's commit but rather want to receive the proper information during and at the end of the drag operation so that I can update my Vue state - and Vue will take care of the updating/re-rendering the components. That is why I need to "hook" into the proper events, e.g.onDrop
.
The current mutation listener does not work for me either since it just provides an array of new ids in the container and the HTMLElement object - both are not enough for me to understand:
from dflex.
@jalal246, that's very nice, thank you! I will play with this the next couple of day and will let you know :)
from dflex.
-
You're absolutely right. There was indeed an issue (#745) regarding events firing each time the element was transformed when dragged out of the container. I've addressed this and it's now fixed.
-
I understand your concern. I'll work on finding a solution for this. It would be helpful to have a drag' event that provides information about the path the drag operation took.
Meanwhile, you can try another event: $onLiftUpSiblings
when dragged moving out and elements are up,
and $onMoveDownSiblings
when dragged enter the container and move elements down.
https://github.com/dflex-js/dflex/blob/main/packages/dflex-dnd/src/Events/constants.ts#L3-L26
from dflex.
@ddenev, $onDragCommitted
will emit
type PayloadDragCommitted = {
/** Represents the main category of the drag event. */
category: typeof DRAG_CAT;
/** Indicates the timestamp when the event occurred. */
timestamp: number;
/** Targeted elements */
element: HTMLElement;
indexes: {
/** The initial index of the moved element. */
initial: number;
/** The index where it was inserted in the receiving container. */
inserted: number;
};
containers: {
/** The container from which the element originated. */
origin: HTMLElement;
/** The container where the element is now located. */
target: HTMLElement;
};
}
from dflex.
Related Issues (20)
- bug when dragged is leaving from the end and returning back to the list container
- Add test covering dragged leaving from edn & coming back
- Create draggable example for Svelte HOT 1
- Dark mode breaks text contrast on certain areas HOT 1
- Feature: drag item and scroll HOT 1
- v3.6.0 Draggable throws Error `can't access property "x", translate is undefined` HOT 2
- Drag and scrolling doesn't work HOT 1
- Restricted element cause other elements to jump beneath HOT 1
- Animation demo HOT 1
- playground issues HOT 6
- After dragging is done, translate3d property still exists in dragged element's style attribute HOT 16
- Error when trying to add new DnDComponent while running: Uncaught TypeError: h2 is undefined HOT 25
- Bug in example demo HOT 2
- Defining drop zone HOT 4
- Cannot destructure property 'translate' of 'this.draggedElm' as it is undefined HOT 12
- npm install fails HOT 2
- Bug: not properly committing when migrating between scrollable containers
- Unable to stimulate DnD in puppeteer
- Please update the documentation and release notes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dflex.