Skip to content

Scheduler - Replace action enum with onDone/onCancel callbacks in AppointmentPopup#33047

Merged
aleksei-semikozov merged 7 commits intoDevExpress:26_1from
aleksei-semikozov:scheduler-popup-callbacks
Apr 3, 2026
Merged

Scheduler - Replace action enum with onDone/onCancel callbacks in AppointmentPopup#33047
aleksei-semikozov merged 7 commits intoDevExpress:26_1from
aleksei-semikozov:scheduler-popup-callbacks

Conversation

@aleksei-semikozov
Copy link
Copy Markdown
Contributor

No description provided.

@aleksei-semikozov aleksei-semikozov self-assigned this Mar 26, 2026
@aleksei-semikozov aleksei-semikozov marked this pull request as ready for review April 2, 2026 12:27
@aleksei-semikozov aleksei-semikozov requested a review from a team as a code owner April 2, 2026 12:27
Copilot AI review requested due to automatic review settings April 2, 2026 12:27
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

Updates Scheduler’s AppointmentPopup integration to remove action-enum–driven behavior and instead delegate save behavior to a provided callback (plus new config-driven title/readOnly behavior).

Changes:

  • Replaced ACTION_TO_APPOINTMENT-based save branching in AppointmentPopup with a single config.onDone(...) callback.
  • Updated Scheduler popup invocations to pass onDone, title, and readOnly (while keeping legacy-form behavior on the legacy popup).
  • Refactored/expanded Jest tests and the popup test harness mock to validate callback invocation, title rendering, and read-only behavior.

Reviewed changes

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

File Description
packages/devextreme/js/__internal/scheduler/m_scheduler.ts Switches non-legacy popup usage to callback-based onDone flows and sets popup title/readOnly from scheduler context.
packages/devextreme/js/__internal/scheduler/appointment_popup/m_popup.ts Introduces AppointmentPopupConfig and replaces action-based save logic with config.onDone; uses config.title and config.readOnly.
packages/devextreme/js/__internal/scheduler/appointment_popup/appointment_popup.test.ts Updates tests to validate onDone, title rendering, and Save visibility under readOnly.
packages/devextreme/js/__internal/scheduler/__tests__/__mock__/create_appointment_popup.ts Updates the test factory to pass the new config shape (onDone/title/readOnly) into popup.show.

@aleksei-semikozov aleksei-semikozov force-pushed the scheduler-popup-callbacks branch from 5c8b946 to 9c52ce8 Compare April 2, 2026 12:36
…adOnly in exclude-from-series, fix mock types
Copilot AI review requested due to automatic review settings April 2, 2026 12:56
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 4 out of 4 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings April 2, 2026 15:27
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 5 out of 5 changed files in this pull request and generated no new comments.

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

const formData = this.createFormData(appointmentAdapter);

this.form.readOnly = this.isReadOnly(appointmentAdapter);
this.form.readOnly = this.isReadOnly();
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.

minor: let's remove isReadOnly method and directly use the variable:

this.form.readOnly = this.config.readOnly;

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.

Done

EXCLUDE_FROM_SERIES: 2,
};
export interface AppointmentPopupConfig {
onDone: (appointment: Record<string, unknown>) => PromiseLike<unknown>;
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.

small sugestion: let's rename onDone to onSave, so it will be more obvious when this callback is called

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.

Done

@aleksei-semikozov aleksei-semikozov merged commit f9a8f31 into DevExpress:26_1 Apr 3, 2026
102 checks passed
aleksei-semikozov added a commit to aleksei-semikozov/DevExtreme that referenced this pull request Apr 3, 2026
aleksei-semikozov added a commit to aleksei-semikozov/DevExtreme that referenced this pull request Apr 3, 2026
aleksei-semikozov added a commit to aleksei-semikozov/DevExtreme that referenced this pull request Apr 3, 2026
aleksei-semikozov added a commit to aleksei-semikozov/DevExtreme that referenced this pull request Apr 3, 2026
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