Scheduler - Refactor Appointments Collection - Support appointmentDragging options#34254
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes Scheduler _newAppointments drag-and-drop behavior by wiring appointmentDragging options/callbacks into the refactored appointments drag controller, enabling cross-scheduler and external-component drops.
Changes:
- Added workspace API to resolve a scheduler cell from screen coordinates (
getCellFromPoint) and exposed it through Scheduler’s internal workspace facade. - Updated the new
AppointmentDragControllerto forwardappointmentDraggingcallbacks/options toDraggable, handle cross-component drops (onAdd/onRemove), and resolve drop target cells by coordinates. - Added Jest coverage for
appointmentDraggingpass-through options, callback invocation/cancellation, and cross-component drag/drop behaviors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/devextreme/js/__internal/scheduler/workspaces/work_space.ts | Exposes getCellFromPoint and reuses it from getCellFromDragTarget to support coordinate-based drop resolution. |
| packages/devextreme/js/__internal/scheduler/scheduler.ts | Extends internal workspace facade and passes appointmentDragging config + helper APIs into the new drag controller. |
| packages/devextreme/js/__internal/scheduler/appointment_drag_controller.ts | Implements appointmentDragging integration, external drag enter/leave highlighting, and cross-component drop resolution. |
| packages/devextreme/js/__internal/scheduler/tests/appointments_dragging.test.ts | Adds tests validating callback forwarding, cancellation, option pass-through, and cross-component drop behavior. |
5b7a942 to
b0470ab
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
packages/devextreme/js/__internal/scheduler/workspaces/work_space.ts:2524
- getCellFromPoint() currently returns the first date/all-day cell from elementsFromPoint without verifying that the cell belongs to this workspace. When multiple schedulers exist on the page, this can resolve a cell from a different scheduler and lead to highlighting/updating against the wrong workspace on drag.
public getCellFromPoint(x: number, y: number): dxElementWrapper | null {
// @ts-expect-error
const elements = domAdapter.elementsFromPoint(x, y) as Element[];
const cell = elements.find((element) => element.classList.contains('dx-scheduler-date-table-cell')
|| element.classList.contains('dx-scheduler-all-day-table-cell'));
return cell ? $(cell) : null;
b0470ab to
c9172aa
Compare
c9172aa to
7f64813
Compare
7f64813 to
2a5ca62
Compare
2a5ca62 to
7b567aa
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
packages/devextreme/js/__internal/scheduler/appointment_drag_controller.ts:313
- updateAppointmentOnDrop() currently never rejects (it always resolves), so this catch is dead code and makes the control flow harder to follow.
.finally(() => { this.removeDraggingClasses($(e.itemElement)); })
.catch((err) => { throw err; });
7b567aa to
fbf3527
Compare
fbf3527 to
e496e5d
Compare
e496e5d to
acd0372
Compare
What
Added
appointmentDraggingsupport to the refactored Scheduler appointments (_newAppointments) - its callbacks and options, plus drag and drop between two schedulers and with an external componentHow
The new drag controller forwards the
appointmentDraggingcallbacks and options to the draggable and resolves cross-component drops by the drop position