import type { EventCalendarPreferences, CalendarView, EventCalendarPreferencesMenuConfig, EventCalendarViewConfig, EventCalendarViewDefinition } from "../models/index.mjs"; import type { SchedulerState, SchedulerParameters, SchedulerChangeEventDetails } from "../internals/utils/SchedulerStore/index.mjs"; export interface EventCalendarState extends SchedulerState { /** * The view displayed in the calendar. */ view: CalendarView; /** * The views available in the calendar. */ views: CalendarView[]; /** * Preferences for the calendar. */ preferences: Partial; /** * Config of the preferences menu. * Defines which options are visible in the menu. */ preferencesMenuConfig: EventCalendarPreferencesMenuConfig | false; /** * User configuration applied to each view, keyed by the view name. */ viewConfig: EventCalendarViewConfig; /** * Definition of the current view. * Should not be used in selectors, only in event handlers. */ viewDefinition: EventCalendarViewDefinition | null; } /** * Subset of `SchedulerParameters` properties whose documented defaults differ in the * EventCalendar surfaces (EventCalendar, EventCalendarPremium, and the standalone views). * Surfaces in the EventCalendar family `Omit` these keys from `EventCalendarParameters` * and intersect with this interface so the documented defaults reach the API docs and * PropTypes generators. */ export interface EventCalendarSchedulerParametersOverrides { /** * Whether each event must be assigned to a resource. When true, the resource cannot be cleared in the edit dialog and the form cannot be submitted without one. * @default false */ shouldEventRequireResource?: boolean; } /** * Parameter keys for collapsing resources. Only `EventTimelinePremium` (resource * rows) and `EventCalendar` (resource tree) act on them, so the single-view * components omit them. */ export type CollapsibleResourcesParameterKeys = 'collapsedResources' | 'defaultCollapsedResources' | 'onCollapsedResourcesChange'; export interface EventCalendarParameters extends SchedulerParameters { /** * The view currently displayed in the calendar. */ view?: CalendarView; /** * The view initially displayed in the calendar. * To render a controlled calendar, use the `view` prop. * @default "week" */ defaultView?: CalendarView; /** * The views available in the calendar. * @default ["day", "week", "month", "agenda"] */ views?: CalendarView[]; /** * Event handler called when the view changes. */ onViewChange?: (view: CalendarView, eventDetails: SchedulerChangeEventDetails) => void; /** * The default preferences for the calendar. * To use controlled preferences, use the `preferences` prop. * @default { showWeekends: true, showWeekNumber: false, isSidePanelOpen: true, showEmptyDaysInAgenda: true, ampm: true } */ defaultPreferences?: Partial; /** * Preferences currently displayed in the calendar. */ preferences?: Partial; /** * Event handler called when the preferences change. */ onPreferencesChange?: (preferences: Partial, eventDetails: SchedulerChangeEventDetails) => void; /** * Config of the preferences menu. * Defines which options are visible in the menu. * If `false`, the menu will be entirely hidden. * @default { toggleWeekendVisibility: true, toggleWeekNumberVisibility: true, toggleAmpm: true, toggleEmptyDaysInAgenda: true, toggleWeekStartsOn: false } */ preferencesMenuConfig?: Partial | false; /** * Configuration applied to each view, keyed by the view name. * For the `day` and `week` views, `startTime` and `endTime` (whole hours between 0 and 24) * limit the hours displayed in the time grid. * @example { week: { startTime: 8, endTime: 20 } } */ viewConfig?: EventCalendarViewConfig; }