Skip to content

Scheduler - Create appointment by selected range#33351

Merged
aleksei-semikozov merged 9 commits intoDevExpress:26_1from
aleksei-semikozov:scheduler/create-from-selection-26_1
Apr 23, 2026
Merged

Scheduler - Create appointment by selected range#33351
aleksei-semikozov merged 9 commits intoDevExpress:26_1from
aleksei-semikozov:scheduler/create-from-selection-26_1

Conversation

@aleksei-semikozov
Copy link
Copy Markdown
Contributor

No description provided.

@aleksei-semikozov aleksei-semikozov self-assigned this Apr 18, 2026
@github-actions github-actions Bot added the .d.ts label Apr 18, 2026
@aleksei-semikozov aleksei-semikozov force-pushed the scheduler/create-from-selection-26_1 branch 9 times, most recently from 22d05d7 to 2aadab4 Compare April 21, 2026 13:49
@aleksei-semikozov aleksei-semikozov force-pushed the scheduler/create-from-selection-26_1 branch 16 times, most recently from e40d202 to 077708d Compare April 22, 2026 09:53
@aleksei-semikozov aleksei-semikozov marked this pull request as ready for review April 22, 2026 10:41
@aleksei-semikozov aleksei-semikozov requested a review from a team as a code owner April 22, 2026 10:41
Copilot AI review requested due to automatic review settings April 22, 2026 10:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new public Scheduler event (onSelectionEnd) to enable scenarios like creating an appointment after the user finishes selecting a date range, and wires it through core, typings, wrappers, tests, and demos.

Changes:

  • Introduces SelectionEndEvent + onSelectionEnd option in Scheduler typings and action plumbing.
  • Implements selection-end dispatch in the workspace (fires on pointer-up after a selection that started on a cell).
  • Adds Jest/QUnit coverage and new “Create from Selection” demos across frameworks (Angular/React/Vue/jQuery) + demo metadata/artifacts.

Reviewed changes

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

Show a summary per file
File Description
packages/devextreme/ts/dx.all.d.ts Public typings: adds SelectionEndEvent and dxSchedulerOptions.onSelectionEnd.
packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.events.tests.js QUnit event integrity test updated to include onSelectionEnd.
packages/devextreme/js/ui/scheduler_types.d.ts Re-exports SelectionEndEvent for consumers.
packages/devextreme/js/ui/scheduler.d.ts Adds SelectionEndEvent and onSelectionEnd option + event integrity list update.
packages/devextreme/js/__internal/scheduler/workspaces/m_work_space.ts Implements selection-end action creation + document pointer-up listener to fire onSelectionEnd.
packages/devextreme/js/__internal/scheduler/m_scheduler.ts Adds onSelectionEnd action creation and forwards workspace callback to public action with component/element.
packages/devextreme/js/__internal/scheduler/tests/selection_end_event.test.ts New Jest test validating onSelectionEnd firing and payload.
packages/devextreme/js/__internal/scheduler/tests/mock/model/scheduler.ts Adds getWorkspace() helper in scheduler test POM.
packages/devextreme-vue/src/scheduler.ts Exposes onSelectionEnd prop/event typing for Vue wrapper.
packages/devextreme-react/src/scheduler.ts Exposes onSelectionEnd typing and marks it as an independent event for React wrapper.
packages/devextreme-angular/src/ui/scheduler/index.ts Adds Angular @Output() onSelectionEnd and subscribes to selectionEnd.
apps/demos/menuMeta.json Registers new “Scheduler / Create from Selection” demo entry.
apps/demos/Demos/Scheduler/CreateFromSelection/jQuery/index.js jQuery demo: opens appointment popup from selected range on onSelectionEnd.
apps/demos/Demos/Scheduler/CreateFromSelection/jQuery/index.html jQuery demo page scaffold.
apps/demos/Demos/Scheduler/CreateFromSelection/jQuery/data.js jQuery demo data/resources.
apps/demos/Demos/Scheduler/CreateFromSelection/Vue/index.ts Vue demo bootstrap.
apps/demos/Demos/Scheduler/CreateFromSelection/Vue/index.html Vue demo page scaffold.
apps/demos/Demos/Scheduler/CreateFromSelection/Vue/data.ts Vue demo data/resources.
apps/demos/Demos/Scheduler/CreateFromSelection/Vue/App.vue Vue demo: handles @selection-end to create appointment.
apps/demos/Demos/Scheduler/CreateFromSelection/ReactJs/index.js ReactJs demo bootstrap.
apps/demos/Demos/Scheduler/CreateFromSelection/ReactJs/index.html ReactJs demo page scaffold.
apps/demos/Demos/Scheduler/CreateFromSelection/ReactJs/data.js ReactJs demo data/resources.
apps/demos/Demos/Scheduler/CreateFromSelection/ReactJs/App.js ReactJs demo: handles onSelectionEnd to create appointment.
apps/demos/Demos/Scheduler/CreateFromSelection/React/index.tsx React (TS) demo bootstrap.
apps/demos/Demos/Scheduler/CreateFromSelection/React/index.html React (TS) demo page scaffold.
apps/demos/Demos/Scheduler/CreateFromSelection/React/data.ts React (TS) demo typed data/resources.
apps/demos/Demos/Scheduler/CreateFromSelection/React/App.tsx React (TS) demo: handles onSelectionEnd to create appointment.
apps/demos/Demos/Scheduler/CreateFromSelection/Angular/index.html Angular demo page scaffold.
apps/demos/Demos/Scheduler/CreateFromSelection/Angular/app/app.service.ts Angular demo data/service definitions.
apps/demos/Demos/Scheduler/CreateFromSelection/Angular/app/app.component.ts Angular demo: handles onSelectionEnd to create appointment.
apps/demos/Demos/Scheduler/CreateFromSelection/Angular/app/app.component.html Angular demo scheduler markup wiring (onSelectionEnd).
apps/demos/testing/etalons/Scheduler-CreateFromSelection (material.blue.light).png Visual regression baseline for the new demo.

Comment thread packages/devextreme/js/__internal/scheduler/workspaces/m_work_space.ts Outdated
Comment thread packages/devextreme-react/src/scheduler.ts
@aleksei-semikozov aleksei-semikozov force-pushed the scheduler/create-from-selection-26_1 branch from 92c1c56 to c8c42eb Compare April 22, 2026 10:52
@sjbur
Copy link
Copy Markdown
Contributor

sjbur commented Apr 22, 2026

Is this a behavior that we expect:

  1. Select cells — receive onSelectionEnd event
  2. Click on selected cells — we receive onSelectionEnd event and appointment popup also shows up

Maybe we need to add some guard to avoid duplication of onSelectionEnd?

@sjbur
Copy link
Copy Markdown
Contributor

sjbur commented Apr 22, 2026

Question: do we want to support this behavior for keyboard navigation? We have keyboard navigation with arrow buttons(shift + arrow buttons), but I don't see the implemention supporting it


expect(onSelectionEnd).toHaveBeenCalledTimes(1);

const { selectedCellData, component } = onSelectionEnd.mock.calls[0][0];
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.

Typescript error here, please fix it:
Property 'component' does not exist on type 'unknown'.
Property 'selectedCellData' does not exist on type 'unknown'.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copilot AI review requested due to automatic review settings April 23, 2026 09:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 28 out of 33 changed files in this pull request and generated 1 comment.

Comment on lines 2300 to 2302

(eventsEngine.off as any)(domAdapter.getDocument(), SCHEDULER_TABLE_DXPOINTERUP_EVENT_NAME);
this.virtualScrollingDispatcher.dispose();
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

eventsEngine.off(document, SCHEDULER_TABLE_DXPOINTERUP_EVENT_NAME) in _dispose() removes all document handlers registered under that namespace, which can unintentionally detach onSelectionEnd listeners belonging to other Scheduler instances. This should be paired with an instance-specific namespace and/or an exact handler reference so disposing one workspace doesn’t affect others.

Copilot uses AI. Check for mistakes.
@aleksei-semikozov
Copy link
Copy Markdown
Contributor Author

Is this a behavior that we expect:

  1. Select cells — receive onSelectionEnd event
  2. Click on selected cells — we receive onSelectionEnd event and appointment popup also shows up

Maybe we need to add some guard to avoid duplication of onSelectionEnd?

Great catch, thanks for the careful review — fixed and covered with a test

@aleksei-semikozov
Copy link
Copy Markdown
Contributor Author

Question: do we want to support this behavior for keyboard navigation? We have keyboard navigation with arrow buttons(shift + arrow buttons), but I don't see the implemention supporting it

There is no clean "end of keyboard selection" moment:

  • Shift+Arrow is incremental — each press is both the start and the end of an extension.
  • Firing on Shift keyup is fragile: it triggers even with no arrow press at all, and keyup can be missed on focus loss / IME / window switch.
  • We did not find an established pattern for this in comparable scheduler widgets.

If someone really wants to react to "Shift released after a range" we have WA:

const scheduler = $('#scheduler').dxScheduler('instance');

$(scheduler.element()).on('keyup', (e) => {
  if (e.key !== 'Shift') return;

  const cells = scheduler.option('selectedCellData');
  if (!cells || cells.length < 2) return;

  scheduler.showAppointmentPopup({
    startDate: cells[0].startDate,
    endDate: cells[cells.length - 1].endDate,
  }, true);
});

I'll file a follow-up issue to research proper keyboard support separately.

Copilot AI review requested due to automatic review settings April 23, 2026 10:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 28 out of 33 changed files in this pull request and generated 1 comment.

Comment thread packages/devextreme/js/__internal/scheduler/workspaces/m_work_space.ts Outdated
@sjbur
Copy link
Copy Markdown
Contributor

sjbur commented Apr 23, 2026

Found a bug in demo:

  • Select cells in all day panel
  • Create appointment
  • The appointment is not being created in all day panel

The reason for this is that allDay flag is not being passed to showAppointmentPopup

Copilot AI review requested due to automatic review settings April 23, 2026 13:01
@aleksei-semikozov
Copy link
Copy Markdown
Contributor Author

Found a bug in demo:

  • Select cells in all day panel
  • Create appointment
  • The appointment is not being created in all day panel

The reason for this is that allDay flag is not being passed to showAppointmentPopup

fixed

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 28 out of 33 changed files in this pull request and generated no new comments.

@aleksei-semikozov aleksei-semikozov merged commit 1ff8c08 into DevExpress:26_1 Apr 23, 2026
111 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants