The sophisticated Drag and Drop library you've been waiting for 🥳
isLeavingFromHead
and strict index to zero.isOutThreshold
.bottom
/right
or four directions moving away from two points approach.isDraggedOutPosition
and isDraggedOutContainer
(#419)SWC
for Jest
and remove Babel
(#424)draggedOutPosition
to dragged inside the parent container. Removing unnecessary flags.main
object contains the main element threshold instead of the previous approach which included unclear properties. The new threshold has max and min for each defined point defined as follows:interface ThresholdPointInterface {
max: number;
min: number;
}
ThresholdPoint
for each point.siblingsBoundaries
to type Rect
Draggable
interface and strict flags to read-only
siblingsBoundaries
to type Rect
Draggable
interface and strict flags to read-only
AxesCoordinates classes
(#414)AxesFourCoordinatesBool
for dealing with layout position in four directions.thresholds
)/indicators(isOut
).seTranslate
, setPosition
and rollBack
in the Core and all related classe to include both axes.Axes
and EffectedElemDirection
.setAxes
instead.TempOffset
with AxesCoordinates
setAttribute
, removeAttribute
, and clearAttributes
to abstract core.updateElementVisibility
.detectNearestContainer
that triggered when dragged is out of the parent container and check for possible new parents.siblingsContainer
and setOfTransformedIds
in Draggable.isIDEligible
and isIDEligible2Move
as utils function outside the class.cleanupDisconnectedElements
and isAttachListener
animatedDraggedInsertionFrame
to throttle dragged insertion into the parent container and refactor the tests adding more delay to cover the new throttle.core-instance
for more usability. Add a new method isPositionedLeft
to check horizontal position.getBranchHeadAndTail
and avoid bugs caused by not checking the availability if there's only one element in the branch.Starting from v3.0.0 DFlex is MIT License.
onDragOutContainer
and onDragOutThreshold
event listeners.onDragOver
and onDragLeave
event listeners.onLiftUpSiblings
and onMoveDownSiblings
event listeners.onStateChange
PRs: (#343) and (#344). Docs
cleanupUnconnectedElements
for production usage.accumulateIndicators
.parentID: string
to match elements from the same branch for input in the registry.dataset
when the scroll is the document. Previously, when not the document. Currently, add the dataset to the first div inside the body document. When to add the dataset? Only if the algorithm detects an overflow. (It's also so much easier for the test and debugging),attach
. There's a possibility of throwing an error while validating the new one without clearing the old one. Avoid any potential memory leaks.cleanupUnconnectedElements
so we can dynamically clean connected/unconnected dom elements.clearBranchesScroll
to prevent a memory leak.isElmSingleton
from DOM Gen.removeElementIDFromBranch
, destroyBranch
, clearBranchesAndIndicator
to DOM Gen.setElmBranch
as it has not a clear role otherwise a direct assignment.unregister
it from the store. This fixes a bug that causes branches to preserve elements even f they are deleted from the registry.scrollEventCallback
.id
is not registered or can't find siblings key (SK
).Store
instead of Draggable
.Store
when the branch is empty.CSS
but the container doesn't actually have a scroll (#332)Define three levels of restrictions. Each level is relevant to a different position. Add more flexibility, so each element can define its restricted area separately from another sibling.
Available restrictions:
Changes made to the playground:
Changes related to the API: Define new restrictions with types:
interface Restrictions {
self: {
allowLeavingFromTop: boolean;
allowLeavingFromBottom: boolean;
allowLeavingFromLeft: boolean;
allowLeavingFromRight: boolean;
};
container: {
allowLeavingFromTop: boolean;
allowLeavingFromBottom: boolean;
allowLeavingFromLeft: boolean;
allowLeavingFromRight: boolean;
};
}
And the default values are:
const restrictions= {
self: {
allowLeavingFromTop: true,
allowLeavingFromBottom: true,
allowLeavingFromLeft: true,
allowLeavingFromRight: true,
},
container: {
allowLeavingFromTop: true,
allowLeavingFromBottom: true,
allowLeavingFromLeft: true,
allowLeavingFromRight: true,
},
},
Of course, that's done with testing the new options and refactor Jest cases.
Following that, the old API is changed to simplify the axes filter with just axesYFilter
and axesXFilter
.
isViewportRestricted
flag to the filtersinitialSpeed
to the options instead of speed.scrollHeight
to the store.Scroll/Draggable
(#324)isInitialized
, isPaused
and isVisible
(#303)isPaused
and isInitialized
to the Core. This is going to add more flexibility to the API. When to resume and when to initialize. The current situation is core has multi-levels isInitialized
, isPaused
and isVisible
.id
without HTML reference. It's also consistent with the three new levels.draggedStyleRef
& Add draggedStyleProps
as static.reference
, id
, or both when registration adding more flexibility to the Store registry
.deleteElm
and getElmById
. Reduce the maintainability burden as API grows.dragged
attribute to draggable.dataset
to dragged while dragging.unregister
method to the store to remove one element.destroy
method to clear the registry.