Skip to content

Scheduler - Refactor Appointments Collection - Resizing#34187

Open
bit-byte0 wants to merge 16 commits into
DevExpress:26_1from
bit-byte0:refactor/scheduler-appointments-resizing
Open

Scheduler - Refactor Appointments Collection - Resizing#34187
bit-byte0 wants to merge 16 commits into
DevExpress:26_1from
bit-byte0:refactor/scheduler-appointments-resizing

Conversation

@bit-byte0

@bit-byte0 bit-byte0 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

What

Added appointment resizing (timed + all-day) to the new appointments collection behind the _newAppointments flag with Esc-to-cancel, focus handling, group-bounded drag, and rollback on cancel/failure

How

Extracted the resize math into small pure, unit-tested helpers; added opt-in onCancelByEsc to the Resizable widget; wired it into the new grid appointment with a thin scheduler.ts handler that computes the new dates (timed vs all-day) and updates the appointment, focusing it on resize-start and snapping it back if the update is cancelled/fails

Copilot AI review requested due to automatic review settings July 1, 2026 10:52
@bit-byte0 bit-byte0 requested review from a team as code owners July 1, 2026 10:52
@bit-byte0 bit-byte0 self-assigned this Jul 1, 2026
@bit-byte0 bit-byte0 added the 26_1 label Jul 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors Scheduler appointment resizing by moving resize calculations/config into dedicated helpers, wiring the “new appointments” rendering to use dxResizable, and adding Escape-to-cancel support at the internal Resizable level.

Changes:

  • Added onCancelByEsc + onResizeCancel flow to internal Resizable, including ESC key handling and cancel/restore logic.
  • Implemented new Scheduler appointment resizing pipeline (config generation, delta-time calculation, resized date range calculation) and integrated it into scheduler.ts.
  • Enabled resize handles for grid appointments in the “new appointments” implementation and added/updated Jest coverage for the new behavior.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/devextreme/js/__internal/ui/resizable/resizable.ts Adds ESC cancellation support and a new cancel action for Resizable.
packages/devextreme/js/__internal/ui/resizable/resizable.test.ts New unit tests validating ESC-cancel behavior and event firing.
packages/devextreme/js/__internal/scheduler/scheduler.ts Integrates new resizing logic/config into Scheduler and updates resize start/end handling.
packages/devextreme/js/__internal/scheduler/appointments_new/resizing/get_resized_dates.ts New helper to compute resized start/end dates with working-hours correction + TZ offset adjustments.
packages/devextreme/js/__internal/scheduler/appointments_new/resizing/get_resized_dates.test.ts Tests for start/end resize date calculations and handle-direction logic.
packages/devextreme/js/__internal/scheduler/appointments_new/resizing/get_resizable_config.ts New helper to generate Resizable rules (handles/step/min sizes) based on view model/workspace.
packages/devextreme/js/__internal/scheduler/appointments_new/resizing/get_resizable_config.test.ts Tests for resizable rule generation (vertical/horizontal/reduced/RTL/grouping).
packages/devextreme/js/__internal/scheduler/appointments_new/resizing/get_delta_time.ts New helper to compute resize delta-time from pixel deltas across view types.
packages/devextreme/js/__internal/scheduler/appointments_new/resizing/get_delta_time.test.ts Tests for delta-time calculation across view types and all-day/timeline behavior.
packages/devextreme/js/__internal/scheduler/appointments_new/appointments.ts Adds getResizableConfig hook and passes resize settings into GridAppointmentView.
packages/devextreme/js/__internal/scheduler/appointments_new/appointments.test.ts Updates test properties to include getResizableConfig.
packages/devextreme/js/__internal/scheduler/appointments_new/appointments.focus_controller.ts Exposes focusViewItem to support focusing the resized appointment.
packages/devextreme/js/__internal/scheduler/appointments_new/appointment/grid_appointment.ts Creates a Resizable instance for grid appointments when resizing is enabled.
packages/devextreme/js/__internal/scheduler/appointments_new/appointment/grid_appointment.test.ts Tests that resize handles appear/disappear based on allowResize.
packages/devextreme/js/__internal/scheduler/tests/appointments_resizing.test.ts Integration tests for resize handles rendering and focus-on-resize-start in Scheduler.

Comment thread packages/devextreme/js/__internal/ui/resizable/resizable.ts
Comment thread packages/devextreme/js/__internal/scheduler/scheduler.ts Outdated
Copilot AI review requested due to automatic review settings July 1, 2026 11:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Comment thread packages/devextreme/js/__internal/ui/resizable/resizable.test.ts
Comment thread packages/devextreme/js/__internal/scheduler/scheduler.ts
Copilot AI review requested due to automatic review settings July 1, 2026 14:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Comment thread packages/devextreme/js/__internal/scheduler/scheduler.ts
Comment thread packages/devextreme/js/__internal/scheduler/scheduler.ts Outdated
Comment thread packages/devextreme/js/__internal/scheduler/scheduler.ts Outdated
Copilot AI review requested due to automatic review settings July 1, 2026 16:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Comment thread packages/devextreme/js/__internal/ui/resizable/resizable.ts
Comment thread packages/devextreme/js/__internal/scheduler/scheduler.ts
Comment thread packages/devextreme/js/__internal/ui/resizable/resizable.test.ts
Copilot AI review requested due to automatic review settings July 1, 2026 22:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 7 comments.

Comment thread packages/devextreme/js/__internal/scheduler/scheduler.ts
private onAppointmentResizeEnd(e: AppointmentResizeEvent): void {
const $element = $(e.element);
const settings = this._appointments
.getAppointmentSettings($element) as AppointmentItemViewModel;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

settings can return undefined here. We should add guard
if (!settings) {
return;
}

to avoid type error in runtime

return handles.top;
};

const correctEndDateByDelta = (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correctStartDateByDelta/correctEndDateByDelta — are they almost the same here?

const adapter = new AppointmentAdapter(rawAppointment, this._dataAccessors);
const { startDateTimeZone, isRecurrent } = adapter;

if (!e.handles.top && !isRecurrent) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in old _getEndResizeAppointmentStartDate there was a guard check for appointment not being allDay. In new method we don't have it. Is it by a choice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants