import { disposeSymbol } from '@mui/x-internals/disposable'; import { Store } from '@base-ui/utils/store'; import { SchedulerEventId, SchedulerOccurrencePlaceholder, SchedulerResourceId, TemporalSupportedObject, SchedulerEventUpdatedProperties, RecurringEventScope, SchedulerPreferences, SchedulerEventCreationProperties, SchedulerEventPasteProperties } from "../../../models/index.mjs"; import { SchedulerState, SchedulerParameters, UpdateRecurringEventParameters, DeleteRecurringEventParameters, SchedulerParametersToStateMapper, UpdateEventsParameters, SchedulerInstanceName } from "./SchedulerStore.types.mjs"; import { SchedulerRecurringEventsPluginInterface } from "../../plugins/SchedulerRecurringEventsPlugin.types.mjs"; import { SchedulerEvents, SchedulerEventListener, SchedulerEventParameters } from "../../models/events.mjs"; import { Adapter } from "../../../use-adapter/useAdapter.types.mjs"; import { TimeoutManager } from "../TimeoutManager.mjs"; export declare const DEFAULT_SCHEDULER_PREFERENCES: SchedulerPreferences; /** * Instance shared by the Event Calendar and the Event Timeline Premium components. */ export declare class SchedulerStore> extends Store { parameters: Parameters; private initialParameters; instanceName: SchedulerInstanceName; private mapper; protected readonly disposables: DisposableStack; protected timeoutManager: TimeoutManager; private eventManager; constructor(parameters: Parameters, adapter: Adapter, instanceName: SchedulerInstanceName, mapper: SchedulerParametersToStateMapper, recurringEventsPlugin?: SchedulerRecurringEventsPluginInterface | null); /** * Returns the properties of the state that are derived from the parameters. * This do not contain state properties that don't update whenever the parameters update. */ private static deriveStateFromParameters; /** * Updates the state of the calendar based on the new parameters provided to the root component. */ updateStateFromParameters: (parameters: Parameters, adapter: Adapter) => void; /** * Disposes the store synchronously. The React consumer (`useDisposable`) * handles the StrictMode double-invocation by suppressing the simulated * unmount, so this method does not need to defer the teardown itself. */ [disposeSymbol](): void; /** * Removes the error with the given key from `state.errors`. * The key is the one carried by the matching `StoredError` entry. */ dismissError: (key: string) => void; private nextErrorKey; /** * Appends an error to `state.errors`, wrapping non-Error rejections to preserve * the original payload via `cause`. The store owns the key counter so uniqueness * is enforced in one place. Does not dedupe — pushing the same `Error` instance * twice produces two entries (intentional; e.g. a retried failure that should * re-display after the previous one was dismissed). * @internal */ pushError: (error: unknown) => void; /** * Registers an effect to be run when the value returned by the selector changes. */ registerStoreEffect: (selector: (state: State) => Value, effect: (previous: Value, next: Value) => void) => () => void; /** * Publishes an event to all its subscribers. */ publishEvent: (name: E, params: SchedulerEventParameters) => void; /** * Subscribe to an event emitted by the store. Returns an unsubscribe function. */ subscribeEvent: (eventName: E, handler: SchedulerEventListener) => (() => void); protected setVisibleDate: ({ visibleDate, event }: { visibleDate: TemporalSupportedObject; event?: React.UIEvent | null; }) => void; /** * Adds, updates and / or deletes events in the calendar. */ protected updateEvents(parameters: UpdateEventsParameters): { deleted: SchedulerEventId[]; updated: SchedulerEventId[]; created: SchedulerEventId[]; }; /** * Goes to today's date without changing the view. */ goToToday: (event: React.UIEvent) => void; /** * Goes to a specific date without changing the view. */ goToDate: (visibleDate: TemporalSupportedObject, event: React.UIEvent) => void; /** * Creates a new event in the calendar. */ createEvent: (calendarEvent: SchedulerEventCreationProperties) => SchedulerEventId; /** * Updates an event in the calendar. */ updateEvent: (calendarEvent: SchedulerEventUpdatedProperties) => void; /** * Updates a recurring event in the calendar. */ updateRecurringEvent: (params: UpdateRecurringEventParameters) => void; /** * Opens the recurring scope dialog to delete a recurring event. */ deleteRecurringEvent: (params: DeleteRecurringEventParameters) => void; /** * Applies the pending recurring event operation after the user selects a scope. * @param scope The selected scope, or null if canceled. */ selectRecurringEventScope: (scope: RecurringEventScope | null) => void; /** * Deletes an event from the calendar. */ deleteEvent: (eventId: SchedulerEventId) => void; /** * Creates an event from an event occurrence. * The new event will have the same properties as the original event except: * - the start and end dates will be those provided as parameters. * - the recurrence rule will be removed. */ duplicateEventOccurrence: (eventId: SchedulerEventId, start: TemporalSupportedObject, end: TemporalSupportedObject) => SchedulerEventId; /** * Copies an event to be pasted later. */ copyEvent: (eventId: SchedulerEventId) => void; /** * Cuts an event to be pasted later. */ cutEvent: (eventId: SchedulerEventId) => void; /** * Pastes the copied or cut event with the provided changes. */ pasteEvent: (changes: SchedulerEventPasteProperties) => SchedulerEventId | null; /** * Updates the visible resources. */ setVisibleResources: (visibleResources: Record, event: Event | undefined) => void; /** * Sets the occurrence placeholder to render while creating a new event or dragging an existing event occurrence. */ setOccurrencePlaceholder: (newPlaceholder: SchedulerOccurrencePlaceholder | null) => void; /** * Sets the key of the currently active occurrence (e.g. open in the event dialog). * Pass `null` to clear the active occurrence. */ setEditedOccurrenceKey: (occurrenceKey: string | null) => void; /** * Builds an object containing the methods that should be exposed publicly by the scheduler components. */ buildPublicAPI(): { setVisibleDate: ({ visibleDate, event }: { visibleDate: TemporalSupportedObject; event?: React.UIEvent | null; }) => void; }; }