Originally: #7207
Goal
To refactor and enhance Neo.draggable.container.SortZone to support more complex drag-and-drop scenarios, such as dragging a component via a child handle. This will make the base class more generic, powerful, and reusable, significantly reducing the need for complex overrides in subclasses like DashboardSortZone.
Tasks
Add dragHandleSelector Config:
- In
src/draggable/container/SortZone.mjs, introduce a new configuration property: dragHandleSelector.
- Type:
String
- Default:
null
- Purpose: This selector will identify a child element within a sortable item that serves as its drag handle.
Refactor onDragStart:
- Modify the
onDragStart method to incorporate the new dragHandleSelector.
- If
dragHandleSelector is set, the logic must:
- Verify the drag was initiated on an element matching the selector.
- Identify the parent component that owns the handle as the actual item to be dragged.
- Implicitly filter the owner's items to only consider components containing a
dragHandleSelector element as sortable. All internal logic (e.g., creating itemRects) should operate on this filtered list.
- If
dragHandleSelector is null, the method must fall back to its original behavior to ensure backward compatibility.
Ensure Method Compatibility:
- Review and adjust other methods (
onDragEnd, switchItems, updateItem) to ensure they correctly handle the filtered list of sortable items and the associated index mappings.
Acceptance Criteria
- When
dragHandleSelector is configured on a SortZone, dragging an element matching the selector initiates a drag operation for its parent component.
- Items within the
SortZone's owner that do not contain an element matching the dragHandleSelector are not considered sortable and are ignored by the drag-drop logic.
- The
DashboardSortZone can be refactored into a minimal subclass that primarily just configures the dragHandleSelector.
- Existing functionalities that use
container.SortZone (e.g., tab header reordering) remain unaffected and work as before.
Originally: #7207
Goal
To refactor and enhance
Neo.draggable.container.SortZoneto support more complex drag-and-drop scenarios, such as dragging a component via a child handle. This will make the base class more generic, powerful, and reusable, significantly reducing the need for complex overrides in subclasses likeDashboardSortZone.Tasks
Add
dragHandleSelectorConfig:src/draggable/container/SortZone.mjs, introduce a new configuration property:dragHandleSelector.StringnullRefactor
onDragStart:onDragStartmethod to incorporate the newdragHandleSelector.dragHandleSelectoris set, the logic must:dragHandleSelectorelement as sortable. All internal logic (e.g., creatingitemRects) should operate on this filtered list.dragHandleSelectorisnull, the method must fall back to its original behavior to ensure backward compatibility.Ensure Method Compatibility:
onDragEnd,switchItems,updateItem) to ensure they correctly handle the filtered list of sortable items and the associated index mappings.Acceptance Criteria
dragHandleSelectoris configured on aSortZone, dragging an element matching the selector initiates a drag operation for its parent component.SortZone's owner that do not contain an element matching thedragHandleSelectorare not considered sortable and are ignored by the drag-drop logic.DashboardSortZonecan be refactored into a minimal subclass that primarily just configures thedragHandleSelector.container.SortZone(e.g., tab header reordering) remain unaffected and work as before.