[scheduler] Add the eventDialogGeneralTab slot - #23338
Open
rita-codes wants to merge 5 commits into
Open
Conversation
Part of mui#22866. Groundwork for the General-tab slot (mui#22871). The General tab sections received the occurrence as a prop, which a consumer composing them as JSX has no way to pass. They now read it from an editing context provided by `FormContent`, so each section is a zero-prop component. The default composition moves out of `GeneralTab` into `EventDialogGeneralTabContent`, which is what the slot will fall back to. Validators stay registered by the section that owns the field, so omitting a section also drops its validation. `shouldEventRequireResource` is the one case where that silently weakens a guarantee the consumer opted into, so submit warns in dev when no field validates the resource. It reads the selector, which already resolves to `false` when no resources are configured. Also warns when a built-in form key receives a `defaultValue`: built-in keys are always seeded from the event, so `seedDefault` never applies it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Part of mui#22866. Closes mui#22871. Introduces `slots` and `slotProps` on the scheduler, with a single slot: `eventDialogGeneralTab`, the content of the General tab of the event editing dialog. Consumers pass a component that composes whatever they want, so the sections can be reordered, omitted, wrapped in arbitrary JSX, or interleaved with sections of their own that read and write the form through `useEventDialogFormField`. Follows the MUI X convention: a flat camelCase slot name on the root component regardless of how deep the render site is (Pickers exposes `day`, Data Grid exposes `columnsManagement`), delivered to that site through a slots-only context like Charts and Tree View rather than by prop drilling. The slot replaces the content of the tab, not the tab panel: the panel carries `role="tabpanel"`, the ids pairing it with its tab, and the `hidden` state driven by the tab selection, none of which the consumer can supply. The props are declared on every public component that opens an editing surface. `EventCalendarProvider` mounts the context once for all the standalone views, including the compact ones, so the slot reaches the mobile drawer too — it shares `FormContent` with the dialog. The section components stay internal for now; a consumer can only render their own JSX in the slot until they are exported. The API docs builder looks for a `<ComponentName>Slots` interface by default, so `getComponentInfo` points it at the shared `SchedulerSlots` instead, except for `StandaloneEvent`, the only public component that takes no slots. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Also extracts the error code for the new useEventEditingOccurrence guard. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QjGAGrDTiWVHJ1gyrj4uM2
…dit-dialog-general-tab-slot-for-composing-sections-built-in-custom-phase-1 # Conflicts: # packages/x-scheduler-premium/src/compact-day-view-premium/CompactDayViewPremium.types.ts # packages/x-scheduler-premium/src/compact-week-view-premium/CompactWeekViewPremium.types.ts
Deploy previewBundle size
Check out the code infra dashboard for more information about this PR. |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QjGAGrDTiWVHJ1gyrj4uM2
eventDialogGeneralTab slot
Contributor
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #22871 — first of the two planned PRs. The follow-up flips the public exports of the built-in section components and
useEventDialogFormField.Changes
slots/slotPropswith a singleeventDialogGeneralTabslot to every public component that can open the event dialog or the compact editing drawer (17 surfaces across@mui/x-schedulerand@mui/x-scheduler-premium), delivered through a slots-only context (SchedulerSlotsProvider), following the Charts/Tree View pattern.role="tabpanel", theid/aria-labelledbypairing and thehiddenstate stay owned by the dialog.occurrenceas a prop and read it from the newEventEditingOccurrenceContext, so a slot can compose them in any order. The default composition is extracted toEventDialogGeneralTabContent.shouldEventRequireResourceis enabled but no field of the dialog validatesresourceId(for example the slot omitted the resource section) — it reads the selector, so it stays silent when no resources are configured;useEventDialogFormField()receives adefaultValuefor a built-in key, which is always a silent no-op.Notes for reviewers
ResourceAndColorSectiondisables the resource requirement. This is deliberate (one rule for built-in and custom sections alike) and is covered by the submit-time warning instead of an always-on validator, which would leave the end user with a dead Save button and no visible error.slotProps.eventDialogGeneralTabonly carries theEventDialogGeneralTabPropsOverridesaugmentation seam —occurrenceis supplied by the scheduler and cannot be overridden.