Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/devextreme-vue/src/scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ import {
ShowTextMode,
} from "devextreme/ui/toolbar";
import {
dxButtonGroupOptions,
dxButtonGroupItem,
ContentReadyEvent as ButtonGroupContentReadyEvent,
DisposingEvent as ButtonGroupDisposingEvent,
Expand Down Expand Up @@ -1006,7 +1005,7 @@ const DxItemConfig = {
location: String as PropType<ToolbarItemLocation>,
menuItemTemplate: {},
name: String as PropType<string | FormPredefinedButtonItem | SchedulerPredefinedToolbarItem>,
options: Object as PropType<DateNavigatorItemProperties | Record<string, any> | dxButtonGroupOptions>,
options: Object as PropType<DateNavigatorItemProperties | Record<string, any>>,

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.

DateNavigatorItemProperties extends dxButtonGroupOptions, so no point of including dxButtonGroupOptions here

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.

Created a test script:

const options: dxButtonGroupOptions = {}
let accepted: DateNavigatorItemProperties | Record<string, any> = options;
accepted = options;

No type errors.

showText: String as PropType<ShowTextMode>,
tabPanelOptions: Object as PropType<dxTabPanelOptions | Record<string, any>>,
tabs: Array as PropType<Array<Record<string, any>>>,
Expand Down Expand Up @@ -1704,7 +1703,7 @@ const DxToolbarItemConfig = {
location: String as PropType<ToolbarItemLocation>,
menuItemTemplate: {},
name: String as PropType<SchedulerPredefinedToolbarItem>,
options: Object as PropType<DateNavigatorItemProperties | Record<string, any> | dxButtonGroupOptions>,
options: Object as PropType<DateNavigatorItemProperties | Record<string, any>>,

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.

Created a test script:

const options: dxButtonGroupOptions = {}
let accepted: DateNavigatorItemProperties | Record<string, any> = options;
accepted = options;

No type errors.

showText: String as PropType<ShowTextMode>,
template: {},
text: String,
Expand Down
119 changes: 42 additions & 77 deletions packages/devextreme/js/ui/scheduler.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ import {
PointerInteractionEvent,
} from '../events';

import { dxButtonGroupOptions, dxButtonGroupItem } from './button_group';
import {
Properties as ButtonGroupProperties,
Item as ButtonGroupItem,
} from './button_group';
import {
CollectionWidgetItem,
} from './collection/ui.collection_widget.base';
Expand All @@ -35,7 +38,7 @@ import dxForm, { Properties as FormProperties } from './form';
import dxPopup, { Properties as PopupProperties } from './popup';

import dxSortable from './sortable';
import { dxToolbarItem } from './toolbar';
import { Item as ToolbarItemBase } from './toolbar';

import Widget, {
WidgetOptions,
Expand All @@ -56,12 +59,10 @@ interface AppointmentDraggingEvent {
export interface TargetedAppointmentInfo {
/**
* @docid
* @type dxSchedulerAppointment
*/
readonly appointmentData: Appointment;
/**
* @docid
* @type dxSchedulerAppointment
*/
readonly targetedAppointmentData?: Appointment;
}
Expand Down Expand Up @@ -115,7 +116,6 @@ export type SchedulerPredefinedDateNavigatorItem = 'prev' | 'next' | 'dateInterv
export type AppointmentAddedEvent = EventInfo<dxScheduler> & {
/**
* @docid _ui_scheduler_AppointmentAddedEvent.appointmentData
* @type dxSchedulerAppointment
*/
readonly appointmentData: Appointment;
/** @docid _ui_scheduler_AppointmentAddedEvent.error */
Expand All @@ -131,12 +131,10 @@ export type AppointmentAddedEvent = EventInfo<dxScheduler> & {
export type AppointmentAddingEvent = EventInfo<dxScheduler> & {
/**
* @docid _ui_scheduler_AppointmentAddingEvent.appointmentData
* @type dxSchedulerAppointment
*/
readonly appointmentData: Appointment;
/**
* @docid _ui_scheduler_AppointmentAddingEvent.cancel
* @type Boolean|Promise<Boolean>
*/
cancel: boolean | PromiseLike<boolean>;
};
Expand Down Expand Up @@ -183,7 +181,6 @@ export type AppointmentDblClickEvent = Cancelable & NativeEventInfo<dxScheduler,
export type AppointmentDeletedEvent = EventInfo<dxScheduler> & {
/**
* @docid _ui_scheduler_AppointmentDeletedEvent.appointmentData
* @type dxSchedulerAppointment
*/
readonly appointmentData: Appointment;
/** @docid _ui_scheduler_AppointmentDeletedEvent.error */
Expand All @@ -199,12 +196,10 @@ export type AppointmentDeletedEvent = EventInfo<dxScheduler> & {
export type AppointmentDeletingEvent = EventInfo<dxScheduler> & {
/**
* @docid _ui_scheduler_AppointmentDeletingEvent.appointmentData
* @type dxSchedulerAppointment
*/
readonly appointmentData: Appointment;
/**
* @docid _ui_scheduler_AppointmentDeletingEvent.cancel
* @type Boolean|Promise<Boolean>
*/
cancel: boolean | PromiseLike<boolean>;
};
Expand All @@ -218,7 +213,6 @@ export type AppointmentDeletingEvent = EventInfo<dxScheduler> & {
export type AppointmentFormOpeningEvent = Cancelable & EventInfo<dxScheduler> & {
/**
* @docid _ui_scheduler_AppointmentFormOpeningEvent.appointmentData
* @type dxSchedulerAppointment
*/
readonly appointmentData?: Appointment;
/** @docid _ui_scheduler_AppointmentFormOpeningEvent.form */
Expand Down Expand Up @@ -248,7 +242,6 @@ export type AppointmentTooltipShowingEvent = Cancelable & EventInfo<dxScheduler>
readonly targetElement: DxElement;
/**
* @docid _ui_scheduler_AppointmentTooltipShowingEvent.appointments
* @type Array<object>
*/
readonly appointments: AppointmentTooltipShowingAppointmentInfo[];
};
Expand All @@ -273,7 +266,6 @@ export type AppointmentRenderedEvent = EventInfo<dxScheduler> & TargetedAppointm
export type AppointmentUpdatedEvent = EventInfo<dxScheduler> & {
/**
* @docid _ui_scheduler_AppointmentUpdatedEvent.appointmentData
* @type dxSchedulerAppointment
*/
readonly appointmentData: Appointment;
/** @docid _ui_scheduler_AppointmentUpdatedEvent.error */
Expand All @@ -289,17 +281,14 @@ export type AppointmentUpdatedEvent = EventInfo<dxScheduler> & {
export type AppointmentUpdatingEvent = EventInfo<dxScheduler> & {
/**
* @docid _ui_scheduler_AppointmentUpdatingEvent.oldData
* @type Object
*/
readonly oldData: any;
/**
* @docid _ui_scheduler_AppointmentUpdatingEvent.newData
* @type Object
*/
readonly newData: any;
/**
* @docid _ui_scheduler_AppointmentUpdatingEvent.cancel
* @type Boolean|Promise<Boolean>
*/
cancel?: boolean | PromiseLike<boolean>;
};
Expand Down Expand Up @@ -442,7 +431,6 @@ export type AppointmentCollectorTemplateData = {
readonly appointmentCount: number;
/**
* @docid
* @type Array<dxSchedulerAppointment>
*/
readonly items: Appointment[];
/**
Expand All @@ -463,7 +451,10 @@ export type DateNavigatorTextInfo = {
* @namespace DevExpress.ui
* @docid
*/
export interface dxSchedulerOptions extends WidgetOptions<dxScheduler> {
export interface dxSchedulerOptions extends Omit<
WidgetOptions<dxScheduler>,
'onContentReady' | 'onDisposing' | 'onInitialized' | 'onOptionChanged'
> {
/**
* @docid
* @default false
Expand Down Expand Up @@ -878,6 +869,34 @@ export interface dxSchedulerOptions extends WidgetOptions<dxScheduler> {
* @public
*/
onCellContextMenu?: ((e: CellContextMenuEvent) => void) | string;
/**
* @docid
* @public
* @type_function_param1 e:{ui/scheduler:ContentReadyEvent}
* @action
*/
onContentReady?: (e: ContentReadyEvent) => void;
/**
* @docid
* @public
* @type_function_param1 e:{ui/scheduler:DisposingEvent}
* @action
*/
onDisposing?: (e: DisposingEvent) => void;
/**
* @docid
* @public
* @type_function_param1 e:{ui/scheduler:InitializedEvent}
* @action
*/
onInitialized?: (e: InitializedEvent) => void;
/**
* @docid
* @public
* @type_function_param1 e:{ui/scheduler:OptionChangedEvent}
* @action
*/
onOptionChanged?: (e: OptionChangedEvent) => void;
/**
* @docid
* @default "dialog"
Expand Down Expand Up @@ -1206,17 +1225,18 @@ export interface dxSchedulerOptions extends WidgetOptions<dxScheduler> {

/**
* @docid
* @type object
* @inherits dxButtonGroupOptions
* @namespace DevExpress.ui.dxScheduler
* @public
*/
export type DateNavigatorItemProperties = dxButtonGroupOptions & {
export type DateNavigatorItemProperties = ButtonGroupProperties & {
/**
* @docid
* @type Array<dxButtonGroupItem,Enums.SchedulerPredefinedDateNavigatorItem>
* @public
*/
items: Array<dxButtonGroupItem | SchedulerPredefinedDateNavigatorItem>;
items: Array<ButtonGroupItem | SchedulerPredefinedDateNavigatorItem>;
};

/**
Expand All @@ -1231,7 +1251,7 @@ export type dxSchedulerToolbarItem = ToolbarItem;
* @namespace DevExpress.ui.dxScheduler
* @public
*/
export type ToolbarItem = dxToolbarItem & {
export type ToolbarItem = ToolbarItemBase & {
/**
* @docid dxSchedulerToolbarItem.name
* @public
Expand Down Expand Up @@ -1293,25 +1313,22 @@ export type Toolbar = {
* @namespace DevExpress.ui
* @public
*/
export default class dxScheduler extends Widget<dxSchedulerOptions> {
export default class dxScheduler extends Widget<Properties> {
/**
* @docid
* @publicName addAppointment(appointment)
* @param1 appointment:dxSchedulerAppointment
* @public
*/
addAppointment(appointment: Appointment): void;
/**
* @docid
* @publicName deleteAppointment(appointment)
* @param1 appointment:dxSchedulerAppointment
* @public
*/
deleteAppointment(appointment: Appointment): void;
/**
* @docid
* @publicName deleteRecurrence(appointment, date, recurrenceEditMode)
* @param1 appointmentData:dxSchedulerAppointment
* @public
*/
deleteRecurrence(
Expand All @@ -1329,7 +1346,6 @@ export default class dxScheduler extends Widget<dxSchedulerOptions> {
/**
* @docid
* @publicName getOccurrences(startDate, endDate, appointments)
* @param3 appointments:Array<dxSchedulerAppointment>
* @public
*/
getOccurrences(startDate: Date, endDate: Date, appointments: Appointment[]): Occurrence[];
Expand All @@ -1342,7 +1358,6 @@ export default class dxScheduler extends Widget<dxSchedulerOptions> {
/**
* @docid
* @publicName hideAppointmentPopup(saveChanges)
* @param1 saveChanges:Boolean|undefined
* @public
*/
hideAppointmentPopup(saveChanges?: boolean): void;
Expand All @@ -1355,10 +1370,6 @@ export default class dxScheduler extends Widget<dxSchedulerOptions> {
/**
* @docid
* @publicName scrollTo(date, options)
* @param2 options:Object|undefined
* @param2_field group:Object|undefined
* @param2_field allDay:Boolean|undefined
* @param2_field alignInView:Enums.SchedulerScrollToAlign|undefined
* @public
*/
scrollTo(date: Date, options?: {
Expand All @@ -1369,35 +1380,25 @@ export default class dxScheduler extends Widget<dxSchedulerOptions> {
/**
* @docid
* @publicName scrollTo(date, group, allDay)
* @param2 group:Object|undefined
* @param3 allDay:Boolean|undefined
* @public
* @deprecated
*/
scrollTo(date: Date, group?: object, allDay?: boolean): void;
/**
* @docid
* @publicName showAppointmentPopup(appointmentData, createNewAppointment, currentAppointmentData)
* @param1 appointmentData:dxSchedulerAppointment|undefined
* @param2 createNewAppointment:Boolean|undefined
* @param3 currentAppointmentData:dxSchedulerAppointment|undefined
* @public
*/
showAppointmentPopup(appointmentData?: Appointment, createNewAppointment?: boolean, currentAppointmentData?: Appointment): void;
/**
* @docid
* @publicName showAppointmentTooltip(appointmentData, target, currentAppointmentData)
* @param1 appointmentData:dxSchedulerAppointment
* @param2 target:string|Element|jQuery
* @param3 currentAppointmentData:dxSchedulerAppointment|undefined
* @public
*/
showAppointmentTooltip(appointmentData: Appointment, target: string | UserDefinedElement, currentAppointmentData?: Appointment): void;
/**
* @docid
* @publicName updateAppointment(target, appointment)
* @param1 target:dxSchedulerAppointment
* @param2 appointment:dxSchedulerAppointment
* @public
*/
updateAppointment(target: Appointment, appointment: Appointment): void;
Expand Down Expand Up @@ -1504,7 +1505,6 @@ export type Occurrence = {
/**
* @docid
* @public
* @type dxSchedulerAppointment
*/
appointmentData: Appointment;
};
Expand All @@ -1525,38 +1525,3 @@ export interface dxSchedulerScrolling {
*/
mode?: ScrollMode;
}

/// #DEBUG
// eslint-disable-next-line import/first
import { CheckedEvents } from '../core';

type FilterOutHidden<T> = Omit<T, 'onFocusIn' | 'onFocusOut'>;

type EventsIntegrityCheckingHelper = CheckedEvents<FilterOutHidden<Properties>, Required<Events>, 'onAppointmentAdded' | 'onAppointmentAdding' | 'onAppointmentClick' | 'onAppointmentContextMenu' | 'onAppointmentDblClick' | 'onAppointmentDeleted' | 'onAppointmentDeleting' | 'onAppointmentFormOpening' | 'onAppointmentRendered' | 'onAppointmentTooltipShowing' | 'onAppointmentUpdated' | 'onAppointmentUpdating' | 'onCellClick' | 'onCellContextMenu' | 'onSelectionEnd'>;

/**
* @hidden
*/
type Events = {
/**
* @docid dxSchedulerOptions.onContentReady
* @type_function_param1 e:{ui/scheduler:ContentReadyEvent}
*/
onContentReady?: ((e: ContentReadyEvent) => void);
/**
* @docid dxSchedulerOptions.onDisposing
* @type_function_param1 e:{ui/scheduler:DisposingEvent}
*/
onDisposing?: ((e: DisposingEvent) => void);
/**
* @docid dxSchedulerOptions.onInitialized
* @type_function_param1 e:{ui/scheduler:InitializedEvent}
*/
onInitialized?: ((e: InitializedEvent) => void);
/**
* @docid dxSchedulerOptions.onOptionChanged
* @type_function_param1 e:{ui/scheduler:OptionChangedEvent}
*/
onOptionChanged?: ((e: OptionChangedEvent) => void);
};
/// #ENDDEBUG
Loading
Loading