devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
1,400 lines (1,289 loc) • 113 kB
JavaScript
"use strict";
var $ = require("../../core/renderer"),
Callbacks = require("../../core/utils/callbacks"),
translator = require("../../animation/translator"),
errors = require("../widget/ui.errors"),
dialog = require("../dialog"),
recurrenceUtils = require("./utils.recurrence"),
domUtils = require("../../core/utils/dom"),
dateUtils = require("../../core/utils/date"),
each = require("../../core/utils/iterator").each,
extend = require("../../core/utils/extend").extend,
inArray = require("../../core/utils/array").inArray,
noop = require("../../core/utils/common").noop,
typeUtils = require("../../core/utils/type"),
devices = require("../../core/devices"),
config = require("../../core/config"),
registerComponent = require("../../core/component_registrator"),
messageLocalization = require("../../localization/message"),
dateSerialization = require("../../core/utils/date_serialization"),
Widget = require("../widget/ui.widget"),
subscribes = require("./ui.scheduler.subscribes"),
FunctionTemplate = require("../widget/function_template"),
appointmentTooltip = require("./ui.scheduler.appointment_tooltip"),
SchedulerHeader = require("./ui.scheduler.header"),
SchedulerWorkSpaceDay = require("./ui.scheduler.work_space_day"),
SchedulerWorkSpaceWeek = require("./ui.scheduler.work_space_week"),
SchedulerWorkSpaceWorkWeek = require("./ui.scheduler.work_space_work_week"),
SchedulerWorkSpaceMonth = require("./ui.scheduler.work_space_month"),
SchedulerTimelineDay = require("./ui.scheduler.timeline_day"),
SchedulerTimelineWeek = require("./ui.scheduler.timeline_week"),
SchedulerTimelineWorkWeek = require("./ui.scheduler.timeline_work_week"),
SchedulerTimelineMonth = require("./ui.scheduler.timeline_month"),
SchedulerAgenda = require("./ui.scheduler.agenda"),
SchedulerResourceManager = require("./ui.scheduler.resource_manager"),
SchedulerAppointmentModel = require("./ui.scheduler.appointment_model"),
SchedulerAppointments = require("./ui.scheduler.appointments"),
SchedulerLayoutManager = require("./ui.scheduler.appointments.layout_manager"),
DropDownAppointments = require("./ui.scheduler.appointments.drop_down"),
SchedulerTimezones = require("./ui.scheduler.timezones"),
DataHelperMixin = require("../../data_helper"),
loading = require("./ui.loading"),
AppointmentForm = require("./ui.scheduler.appointment_form"),
Popup = require("../popup"),
deferredUtils = require("../../core/utils/deferred"),
when = deferredUtils.when,
Deferred = deferredUtils.Deferred,
EmptyTemplate = require("../widget/empty_template"),
BindableTemplate = require("../widget/bindable_template"),
themes = require("../themes");
var WIDGET_CLASS = "dx-scheduler",
WIDGET_SMALL_CLASS = "dx-scheduler-small",
WIDGET_READONLY_CLASS = "dx-scheduler-readonly",
APPOINTMENT_POPUP_CLASS = "dx-scheduler-appointment-popup",
RECURRENCE_EDITOR_ITEM_CLASS = "dx-scheduler-recurrence-rule-item",
RECURRENCE_EDITOR_OPENED_ITEM_CLASS = "dx-scheduler-recurrence-rule-item-opened",
WIDGET_SMALL_WIDTH = 400,
APPOINTEMENT_POPUP_WIDTH = 610;
var VIEWS_CONFIG = {
day: {
workSpace: SchedulerWorkSpaceDay,
renderingStrategy: "vertical"
},
week: {
workSpace: SchedulerWorkSpaceWeek,
renderingStrategy: "vertical"
},
workWeek: {
workSpace: SchedulerWorkSpaceWorkWeek,
renderingStrategy: "vertical"
},
month: {
workSpace: SchedulerWorkSpaceMonth,
renderingStrategy: "horizontalMonth"
},
timelineDay: {
workSpace: SchedulerTimelineDay,
renderingStrategy: "horizontal"
},
timelineWeek: {
workSpace: SchedulerTimelineWeek,
renderingStrategy: "horizontal"
},
timelineWorkWeek: {
workSpace: SchedulerTimelineWorkWeek,
renderingStrategy: "horizontal"
},
timelineMonth: {
workSpace: SchedulerTimelineMonth,
renderingStrategy: "horizontalMonthLine"
},
agenda: {
workSpace: SchedulerAgenda,
renderingStrategy: "agenda"
}
};
var Scheduler = Widget.inherit({
_getDefaultOptions: function _getDefaultOptions() {
return extend(this.callBase(), {
/**
* @pseudo StartDayHour
* @type number
* @default 0
*/
/**
* @pseudo EndDayHour
* @type number
* @default 24
*/
/**
* @pseudo Groups
* @type Array<string>
* @default []
*/
/**
* @pseudo FirstDayOfWeek
* @type Enums.FirstDayOfWeek
* @default undefined
*/
/**
* @pseudo CellDuration
* @type number
* @default 30
*/
/**
* @pseudo AppointmentTemplate
* @type template|function
* @default "item"
* @type_function_param1 itemData:object
* @type_function_param2 itemIndex:number
* @type_function_param3 itemElement:dxElement
* @type_function_return string|Node|jQuery
*/
/**
* @pseudo AppointmentTooltipTemplate
* @type template|function
* @default "appointmentTooltip"
* @type_function_param1 appointmentData:object
* @type_function_param2 contentElement:dxElement
* @type_function_return string|Node|jQuery
*/
/**
* @pseudo DateCellTemplate
* @type template|function
* @default null
* @type_function_param1 itemData:object
* @type_function_param2 itemIndex:number
* @type_function_param3 itemElement:dxElement
* @type_function_return string|Node|jQuery
*/
/**
* @pseudo DataCellTemplate
* @type template|function
* @default null
* @type_function_param1 itemData:object
* @type_function_param2 itemIndex:number
* @type_function_param3 itemElement:dxElement
* @type_function_return string|Node|jQuery
*/
/**
* @pseudo TimeCellTemplate
* @type template|function
* @default null
* @type_function_param1 itemData:object
* @type_function_param2 itemIndex:number
* @type_function_param3 itemElement:dxElement
* @type_function_return string|Node|jQuery
*/
/**
* @pseudo ResourceCellTemplate
* @type template|function
* @default null
* @type_function_param1 itemData:object
* @type_function_param2 itemIndex:number
* @type_function_param3 itemElement:dxElement
* @type_function_return string|Node|jQuery
*/
/**
* @name dxSchedulerOptions.views
* @publicName views
* @type Array<string>
* @default ['day', 'week']
* @acceptValues 'day'|'week'|'workWeek'|'month'|'timelineDay'|'timelineWeek'|'timelineWorkWeek'|'timelineMonth'|'agenda'
*/
views: ["day", "week"],
/**
* @name dxSchedulerOptions.views.type
* @publicName type
* @type Enums.SchedulerViewType
* @default undefined
*/
/**
* @name dxSchedulerOptions.views.name
* @publicName name
* @type string
* @default undefined
*/
/**
* @name dxSchedulerOptions.views.maxAppointmentsPerCell
* @publicName maxAppointmentsPerCell
* @type number|Enums.MaxAppointmentsPerCell
* @default "auto"
*/
/**
* @name dxSchedulerOptions.views.intervalCount
* @publicName intervalCount
* @type number
* @default 1
*/
/**
* @name dxSchedulerOptions.views.startDate
* @publicName startDate
* @type Date|number|string
* @default undefined
*/
/**
* @name dxSchedulerOptions.views.startDayHour
* @publicName startDayHour
* @extends StartDayHour
*/
/**
* @name dxSchedulerOptions.views.endDayHour
* @publicName endDayHour
* @extends EndDayHour
*/
/**
* @name dxSchedulerOptions.views.groups
* @publicName groups
* @extends Groups
*/
/**
* @name dxSchedulerOptions.views.firstDayOfWeek
* @publicName firstDayOfWeek
* @extends FirstDayOfWeek
*/
/**
* @name dxSchedulerOptions.views.cellDuration
* @publicName cellDuration
* @extends CellDuration
*/
/**
* @name dxSchedulerOptions.views.appointmentTemplate
* @publicName appointmentTemplate
* @extends AppointmentTemplate
*/
/**
* @name dxSchedulerOptions.views.dropDownAppointmentTemplate
* @publicName dropDownAppointmentTemplate
* @default "dropDownAppointment"
* @extends AppointmentTemplate
*/
/**
* @name dxSchedulerOptions.views.appointmentTooltipTemplate
* @publicName appointmentTooltipTemplate
* @extends AppointmentTooltipTemplate
*/
/**
* @name dxSchedulerOptions.views.dateCellTemplate
* @publicName dateCellTemplate
* @extends DateCellTemplate
*/
/**
* @name dxSchedulerOptions.views.timeCellTemplate
* @publicName timeCellTemplate
* @extends TimeCellTemplate
*/
/**
* @name dxSchedulerOptions.views.dataCellTemplate
* @publicName dataCellTemplate
* @extends DataCellTemplate
*/
/**
* @name dxSchedulerOptions.views.resourceCellTemplate
* @publicName resourceCellTemplate
* @extends ResourceCellTemplate
*/
/**
* @name dxSchedulerOptions.views.agendaDuration
* @publicName agendaDuration
* @type number
* @default 7
*/
/**
* @name dxSchedulerOptions.views.groupOrientation
* @publicName groupOrientation
* @type Enums.Orientation
*/
/**
* @name dxSchedulerOptions.currentView
* @publicName currentView
* @type Enums.SchedulerViewType
* @default "day"
* @fires dxSchedulerOptions.onOptionChanged
*/
currentView: "day", // TODO: should we calculate currentView if views array contains only one item, for example 'month'?
/**
* @name dxSchedulerOptions.currentDate
* @publicName currentDate
* @type Date|number|string
* @default new Date()
* @fires dxSchedulerOptions.onOptionChanged
*/
currentDate: dateUtils.trimTime(new Date()),
/**
* @name dxSchedulerOptions.min
* @publicName min
* @type Date|number|string
* @default undefined
*/
min: undefined,
/**
* @name dxSchedulerOptions.max
* @publicName max
* @type Date|number|string
* @default undefined
*/
max: undefined,
/**
* @name dxSchedulerOptions.dateSerializationFormat
* @publicName dateSerializationFormat
* @type string
* @default undefined
*/
dateSerializationFormat: undefined,
/**
* @name dxSchedulerOptions.firstDayOfWeek
* @publicName firstDayOfWeek
* @extends FirstDayOfWeek
*/
firstDayOfWeek: undefined,
/**
* @name dxSchedulerOptions.groups
* @publicName groups
* @extends Groups
*/
groups: [],
/**
* @name dxSchedulerOptions.resources
* @publicName resources
* @type Array<Object>
* @default []
*/
resources: [
/**
* @name dxSchedulerOptions.resources.fieldExpr
* @publicName fieldExpr
* @type String
* @default ""
*/
/**
* @name dxSchedulerOptions.resources.colorExpr
* @publicName colorExpr
* @type String
* @default "color"
*/
/**
* @name dxSchedulerOptions.resources.label
* @publicName label
* @type String
* @default ""
*/
/**
* @name dxSchedulerOptions.resources.allowMultiple
* @publicName allowMultiple
* @type Boolean
* @default false
*/
/**
* @name dxSchedulerOptions.resources.useColorAsDefault
* @publicName useColorAsDefault
* @type Boolean
* @default false
*/
/**
* @name dxSchedulerOptions.resources.valueExpr
* @publicName valueExpr
* @type string|function
* @default 'id'
*/
/**
* @name dxSchedulerOptions.resources.displayExpr
* @publicName displayExpr
* @type string|function
* @default 'text'
*/
/**
* @name dxSchedulerOptions.resources.dataSource
* @publicName dataSource
* @type string|Array<Object>|DataSource|DataSourceOptions
* @default null
*/
],
/**
* @name dxSchedulerOptions.dataSource
* @publicName dataSource
* @type string|Array<dxSchedulerAppointmentTemplate>|DataSource|DataSourceOptions
* @default null
*/
dataSource: null,
/**
* @name dxSchedulerOptions.appointmentTemplate
* @publicName appointmentTemplate
* @extends AppointmentTemplate
*/
appointmentTemplate: "item",
/**
* @name dxSchedulerOptions.dropDownAppointmentTemplate
* @publicName dropDownAppointmentTemplate
* @default "dropDownAppointment"
* @extends AppointmentTemplate
*/
dropDownAppointmentTemplate: "dropDownAppointment",
/**
* @name dxSchedulerOptions.dataCellTemplate
* @publicName dataCellTemplate
* @extends DataCellTemplate
*/
dataCellTemplate: null,
/**
* @name dxSchedulerOptions.timeCellTemplate
* @publicName timeCellTemplate
* @extends TimeCellTemplate
*/
timeCellTemplate: null,
/**
* @name dxSchedulerOptions.resourceCellTemplate
* @publicName resourceCellTemplate
* @extends ResourceCellTemplate
*/
resourceCellTemplate: null,
/**
* @name dxSchedulerOptions.dateCellTemplate
* @publicName dateCellTemplate
* @extends DateCellTemplate
*/
dateCellTemplate: null,
/**
* @name dxSchedulerOptions.startDayHour
* @publicName startDayHour
* @extends StartDayHour
*/
startDayHour: 0,
/**
* @name dxSchedulerOptions.endDayHour
* @publicName endDayHour
* @extends EndDayHour
*/
endDayHour: 24,
/**
* @name dxSchedulerOptions.editing
* @publicName editing
* @type boolean|object
* @default true
*/
editing: {
allowAdding: true,
allowDeleting: true,
allowDragging: true,
allowResizing: true,
allowUpdating: true
},
/**
* @name dxSchedulerOptions.editing.allowAdding
* @publicName allowAdding
* @type boolean
* @default true
*/
/**
* @name dxSchedulerOptions.editing.allowUpdating
* @publicName allowUpdating
* @type boolean
* @default true
*/
/**
* @name dxSchedulerOptions.editing.allowDeleting
* @publicName allowDeleting
* @type boolean
* @default true
*/
/**
* @name dxSchedulerOptions.editing.allowResizing
* @publicName allowResizing
* @type boolean
* @default true
*/
/**
* @name dxSchedulerOptions.editing.allowDragging
* @publicName allowDragging
* @type boolean
* @default true
*/
/**
* @name dxSchedulerOptions.showAllDayPanel
* @publicName showAllDayPanel
* @type boolean
* @default true
*/
showAllDayPanel: true,
/**
* @name dxSchedulerOptions.showCurrentTimeIndicator
* @publicName showCurrentTimeIndicator
* @type boolean
* @default true
*/
showCurrentTimeIndicator: true,
/**
* @name dxSchedulerOptions.shadeUntilCurrentTime
* @publicName shadeUntilCurrentTime
* @type boolean
* @default false
*/
shadeUntilCurrentTime: false,
/**
* @name dxSchedulerOptions.indicatorUpdateInterval
* @publicName indicatorUpdateInterval
* @type number
* @default 300000
*/
indicatorUpdateInterval: 300000,
/**
* @hidden
* @name dxSchedulerOptions.indicatorTime
* @publicName indicatorTime
* @type Date
* @default undefined
*/
indicatorTime: undefined,
/**
* @name dxSchedulerOptions.recurrenceEditMode
* @publicName recurrenceEditMode
* @type Enums.SchedulerRecurrenceEditMode
* @default "dialog"
*/
recurrenceEditMode: "dialog",
/**
* @name dxSchedulerOptions.cellDuration
* @publicName cellDuration
* @extends CellDuration
*/
cellDuration: 30,
/**
* @name dxSchedulerOptions.maxAppointmentsPerCell
* @publicName maxAppointmentsPerCell
* @type number|Enums.MaxAppointmentsPerCell
* @default "auto"
*/
maxAppointmentsPerCell: "auto",
/**
* @name dxSchedulerOptions.selectedCellData
* @publicName selectedCellData
* @readonly
* @type Array<any>
* @default []
*/
selectedCellData: [],
/**
* @name dxSchedulerOptions.onAppointmentRendered
* @publicName onAppointmentRendered
* @extends Action
* @type function(e)
* @type_function_param1 e:object
* @type_function_param1_field4 appointmentData:object
* @type_function_param1_field5 targetedAppointmentData:object
* @type_function_param1_field6 appointmentElement:dxElement
* @action
*/
onAppointmentRendered: null,
/**
* @name dxSchedulerOptions.onAppointmentClick
* @publicName onAppointmentClick
* @type function(e)|string
* @extends Action
* @type_function_param1 e:object
* @type_function_param1_field4 appointmentData:object
* @type_function_param1_field5 targetedAppointmentData:object
* @type_function_param1_field6 appointmentElement:dxElement
* @type_function_param1_field7 jQueryEvent:jQuery.Event:deprecated(event)
* @type_function_param1_field8 event:event
* @type_function_param1_field9 cancel:Boolean
* @action
*/
onAppointmentClick: null,
/**
* @name dxSchedulerOptions.onAppointmentDblClick
* @publicName onAppointmentDblClick
* @type function(e)|string
* @extends Action
* @type_function_param1 e:object
* @type_function_param1_field4 appointmentData:object
* @type_function_param1_field5 targetedAppointmentData:object
* @type_function_param1_field6 appointmentElement:dxElement
* @type_function_param1_field7 jQueryEvent:jQuery.Event:deprecated(event)
* @type_function_param1_field8 event:event
* @type_function_param1_field9 cancel:Boolean
* @action
*/
onAppointmentDblClick: null,
/**
* @name dxSchedulerOptions.onAppointmentContextMenu
* @publicName onAppointmentContextMenu
* @type function(e)|string
* @extends Action
* @type_function_param1 e:object
* @type_function_param1_field4 appointmentData:object
* @type_function_param1_field5 targetedAppointmentData:object
* @type_function_param1_field6 appointmentElement:dxElement
* @type_function_param1_field7 jQueryEvent:jQuery.Event:deprecated(event)
* @type_function_param1_field8 event:event
* @action
*/
onAppointmentContextMenu: null,
/**
* @name dxSchedulerOptions.onCellClick
* @publicName onCellClick
* @type function(e)|string
* @extends Action
* @type_function_param1 e:object
* @type_function_param1_field4 cellData:object
* @type_function_param1_field5 cellElement:dxElement
* @type_function_param1_field6 jQueryEvent:jQuery.Event:deprecated(event)
* @type_function_param1_field7 event:event
* @type_function_param1_field8 cancel:Boolean
* @action
*/
onCellClick: null,
/**
* @name dxSchedulerOptions.onCellContextMenu
* @publicName onCellContextMenu
* @type function(e)|string
* @extends Action
* @type_function_param1 e:object
* @type_function_param1_field4 cellData:object
* @type_function_param1_field5 cellElement:dxElement
* @type_function_param1_field6 jQueryEvent:jQuery.Event:deprecated(event)
* @type_function_param1_field7 event:event
* @action
*/
onCellContextMenu: null,
/**
* @name dxSchedulerOptions.onAppointmentAdding
* @publicName onAppointmentAdding
* @extends Action
* @type function(e)
* @type_function_param1 e:object
* @type_function_param1_field4 appointmentData:Object
* @type_function_param1_field5 cancel:Boolean|Promise<Boolean>
* @action
*/
onAppointmentAdding: null,
/**
* @name dxSchedulerOptions.onAppointmentAdded
* @publicName onAppointmentAdded
* @extends Action
* @type function(e)
* @type_function_param1 e:object
* @type_function_param1_field4 appointmentData:Object
* @type_function_param1_field5 error:Error
* @action
*/
onAppointmentAdded: null,
/**
* @name dxSchedulerOptions.onAppointmentUpdating
* @publicName onAppointmentUpdating
* @extends Action
* @type function(e)
* @type_function_param1 e:object
* @type_function_param1_field4 oldData:Object
* @type_function_param1_field5 newData:Object
* @type_function_param1_field6 cancel:Boolean|Promise<Boolean>
* @action
*/
onAppointmentUpdating: null,
/**
* @name dxSchedulerOptions.onAppointmentUpdated
* @publicName onAppointmentUpdated
* @extends Action
* @type function(e)
* @type_function_param1 e:object
* @type_function_param1_field4 appointmentData:Object
* @type_function_param1_field5 error:Error
* @action
*/
onAppointmentUpdated: null,
/**
* @name dxSchedulerOptions.onAppointmentDeleting
* @publicName onAppointmentDeleting
* @extends Action
* @type function(e)
* @type_function_param1 e:object
* @type_function_param1_field4 appointmentData:Object
* @type_function_param1_field5 cancel:Boolean|Promise<Boolean>
* @action
*/
onAppointmentDeleting: null,
/**
* @name dxSchedulerOptions.onAppointmentDeleted
* @publicName onAppointmentDeleted
* @extends Action
* @type function(e)
* @type_function_param1 e:object
* @type_function_param1_field4 appointmentData:Object
* @type_function_param1_field5 error:Error
* @action
*/
onAppointmentDeleted: null,
/**
* @name dxSchedulerOptions.onAppointmentFormCreated
* @publicName onAppointmentFormCreated
* @extends Action
* @type function(e)
* @type_function_param1 e:object
* @type_function_param1_field4 appointmentData:object
* @type_function_param1_field5 form:dxForm
* @action
*/
onAppointmentFormCreated: null,
/**
* @name dxSchedulerOptions.appointmentTooltipTemplate
* @publicName appointmentTooltipTemplate
* @extends AppointmentTooltipTemplate
*/
appointmentTooltipTemplate: "appointmentTooltip",
/**
* @hidden
* @name dxSchedulerOptions.appointmentPopupTemplate
* @publicName appointmentPopupTemplate
* @type template|function
* @default "appointmentPopup"
* @type_function_param1 appointmentData:object
* @type_function_param2 contentElement:dxElement
* @type_function_return string|Node|jQuery
*/
appointmentPopupTemplate: "appointmentPopup",
/**
* @name dxSchedulerOptions.crossScrollingEnabled
* @publicName crossScrollingEnabled
* @type boolean
* @default false
*/
crossScrollingEnabled: false,
/**
* @name dxSchedulerOptions.useDropDownViewSwitcher
* @publicName useDropDownViewSwitcher
* @type boolean
* @default false
*/
useDropDownViewSwitcher: false,
/**
* @name dxSchedulerOptions.startDateExpr
* @publicName startDateExpr
* @type string
* @default 'startDate'
*/
startDateExpr: "startDate",
/**
* @name dxSchedulerOptions.endDateExpr
* @publicName endDateExpr
* @type string
* @default 'endDate'
*/
endDateExpr: "endDate",
/**
* @name dxSchedulerOptions.textExpr
* @publicName textExpr
* @type string
* @default 'text'
*/
textExpr: "text",
/**
* @name dxSchedulerOptions.descriptionExpr
* @publicName descriptionExpr
* @type string
* @default 'description'
*/
descriptionExpr: "description",
/**
* @name dxSchedulerOptions.allDayExpr
* @publicName allDayExpr
* @type string
* @default 'allDay'
*/
allDayExpr: "allDay",
/**
* @name dxSchedulerOptions.recurrenceRuleExpr
* @publicName recurrenceRuleExpr
* @type string
* @default 'recurrenceRule'
*/
recurrenceRuleExpr: "recurrenceRule",
/**
* @name dxSchedulerOptions.recurrenceExceptionExpr
* @publicName recurrenceExceptionExpr
* @type string
* @default 'recurrenceException'
*/
recurrenceExceptionExpr: "recurrenceException",
/**
* @name dxSchedulerOptions.remoteFiltering
* @publicName remoteFiltering
* @type boolean
* @default false
*/
remoteFiltering: false,
/**
* @name dxSchedulerOptions.timeZone
* @publicName timeZone
* @type string
* @default ""
*/
timeZone: "",
/**
* @name dxSchedulerOptions.startDateTimeZoneExpr
* @publicName startDateTimeZoneExpr
* @type string
* @default 'startDateTimeZone'
*/
startDateTimeZoneExpr: "startDateTimeZone",
/**
* @name dxSchedulerOptions.endDateTimeZoneExpr
* @publicName endDateTimeZoneExpr
* @type string
* @default 'endDateTimeZone'
*/
endDateTimeZoneExpr: "endDateTimeZone",
/**
* @name dxSchedulerOptions.noDataText
* @publicName noDataText
* @type string
* @default "No data to display"
*/
noDataText: messageLocalization.format("dxCollectionWidget-noDataText"),
allowMultipleCellSelection: true,
_appointmentTooltipOffset: { x: 0, y: 0 },
_appointmentTooltipButtonsPosition: "bottom",
_appointmentTooltipCloseButton: false,
_useAppointmentColorForTooltip: false,
_appointmentTooltipOpenButtonText: messageLocalization.format("dxScheduler-openAppointment"),
_appointmentTooltipOpenButtonIcon: "",
_dropDownButtonIcon: "overflow",
_appointmentCountPerCell: 2,
_appointmentGroupButtonOffset: 0,
_appointmentOffset: 26
/**
* @name dxSchedulerOptions.activeStateEnabled
* @publicName activeStateEnabled
* @hidden
* @inheritdoc
*/
/**
* @name dxSchedulerOptions.hoverStateEnabled
* @publicName hoverStateEnabled
* @hidden
* @inheritdoc
*/
/**
* @name dxSchedulerAppointmentTemplate
* @publicName dxSchedulerAppointmentTemplate
* @inherits CollectionWidgetItemTemplate
* @type object
*/
/**
* @name dxSchedulerAppointmentTemplate.html
* @publicName html
* @type String
*/
/**
* @name dxSchedulerAppointmentTemplate.disabled
* @publicName disabled
* @type boolean
* @default false
*/
/**
* @name dxSchedulerAppointmentTemplate.visible
* @publicName visible
* @type boolean
* @default true
*/
/**
* @name dxSchedulerAppointmentTemplate.template
* @publicName template
* @type template
*/
/**
* @name dxSchedulerAppointmentTemplate.text
* @publicName text
* @type String
*/
/**
* @name dxSchedulerAppointmentTemplate.startDate
* @publicName startDate
* @type Date
*/
/**
* @name dxSchedulerAppointmentTemplate.endDate
* @publicName endDate
* @type Date
*/
/**
* @name dxSchedulerAppointmentTemplate.description
* @publicName description
* @type String
*/
/**
* @name dxSchedulerAppointmentTemplate.recurrenceRule
* @publicName recurrenceRule
* @type String
*/
/**
* @name dxSchedulerAppointmentTemplate.recurrenceException
* @publicName recurrenceException
* @type String
*/
/**
* @name dxSchedulerAppointmentTemplate.allDay
* @publicName allDay
* @type Boolean
*/
/**
* @name dxSchedulerAppointmentTemplate.startDateTimeZone
* @publicName startDateTimeZone
* @type String
*/
/**
* @name dxSchedulerAppointmentTemplate.endDateTimeZone
* @publicName endDateTimeZone
* @type String
*/
/**
* @name dxSchedulerAppointmentTooltipTemplate
* @publicName dxSchedulerAppointmentTooltipTemplate
* @type object
*/
/**
* @name dxSchedulerAppointmentTooltipTemplate.text
* @publicName text
* @type String
*/
/**
* @name dxSchedulerAppointmentTooltipTemplate.startDate
* @publicName startDate
* @type Date
*/
/**
* @name dxSchedulerAppointmentTooltipTemplate.endDate
* @publicName endDate
* @type Date
*/
/**
* @name dxSchedulerAppointmentTooltipTemplate.description
* @publicName description
* @type String
*/
/**
* @name dxSchedulerAppointmentTooltipTemplate.recurrenceRule
* @publicName recurrenceRule
* @type String
*/
/**
* @name dxSchedulerAppointmentTooltipTemplate.recurrenceException
* @publicName recurrenceException
* @type String
*/
/**
* @name dxSchedulerAppointmentTooltipTemplate.allDay
* @publicName allDay
* @type Boolean
*/
/**
* @name dxSchedulerAppointmentTooltipTemplate.startDateTimeZone
* @publicName startDateTimeZone
* @type String
*/
/**
* @name dxSchedulerAppointmentTooltipTemplate.endDateTimeZone
* @publicName endDateTimeZone
* @type String
*/
});
},
_defaultOptionsRules: function _defaultOptionsRules() {
return this.callBase().concat([{
device: function device() {
return devices.real().deviceType === "desktop" && !devices.isSimulator();
},
options: {
/**
* @name dxSchedulerOptions.focusStateEnabled
* @publicName focusStateEnabled
* @type boolean
* @default true @for desktop
* @inheritdoc
*/
focusStateEnabled: true
}
}, {
device: function device() {
return !devices.current().generic;
},
options: {
/**
* @name dxSchedulerOptions.useDropDownViewSwitcher
* @publicName useDropDownViewSwitcher
* @default true @for Android|iOS|Windows_Mobile
*/
useDropDownViewSwitcher: true,
/**
* @name dxSchedulerOptions.editing.allowResizing
* @publicName allowResizing
* @default false @for Android|iOS|Windows_Mobile
*/
/**
* @name dxSchedulerOptions.editing.allowDragging
* @publicName allowDragging
* @default false @for Android|iOS|Windows_Mobile
*/
editing: {
allowDragging: false,
allowResizing: false
}
}
}, {
device: function device() {
return themes.isMaterial();
},
options: {
/**
* @name dxSchedulerOptions.useDropDownViewSwitcher
* @publicName useDropDownViewSwitcher
* @default true @for Material
*/
useDropDownViewSwitcher: true,
dateCellTemplate: function dateCellTemplate(data, index, element) {
var text = data.text;
text.split(" ").forEach(function (text, index) {
var span = $("<span>").text(text).addClass("dx-scheduler-header-panel-cell-date");
$(element).append(span);
if (!index) $(element).append(" ");
});
},
_appointmentTooltipOffset: { x: 0, y: 11 },
_appointmentTooltipButtonsPosition: "top",
_appointmentTooltipCloseButton: true,
_useAppointmentColorForTooltip: true,
_appointmentTooltipOpenButtonText: null,
_appointmentTooltipOpenButtonIcon: "edit",
_dropDownButtonIcon: "chevrondown",
_appointmentCountPerCell: 1,
_appointmentGroupButtonOffset: 20,
_appointmentOffset: 30
}
}]);
},
_optionChanged: function _optionChanged(args) {
var value = args.value,
name = args.name;
switch (args.name) {
case "firstDayOfWeek":
this._updateOption("workSpace", name, value);
this._updateOption("header", name, value);
break;
case "currentDate":
value = this._dateOption(name);
value = dateUtils.trimTime(new Date(value));
this._workSpace.option(name, value);
this._header.option(name, this._workSpace._getViewStartByOptions());
this._appointments.option("items", []);
this._filterAppointmentsByDate();
this._reloadDataSource();
break;
case "dataSource":
this._initDataSource();
this._customizeStoreLoadOptions();
this._appointmentModel.setDataSource(this._dataSource);
this._loadResources().done(function () {
this._filterAppointmentsByDate();
this._updateOption("workSpace", "showAllDayPanel", this.option("showAllDayPanel"));
this._reloadDataSource();
}.bind(this));
break;
case "min":
case "max":
value = this._dateOption(name);
this._updateOption("header", name, new Date(value));
this._updateOption("workSpace", name, new Date(value));
break;
case "views":
this._processCurrentView();
if (!!this._getCurrentViewOptions()) {
this.repaint();
} else {
this._header.option(name, value);
}
break;
case "useDropDownViewSwitcher":
this._header.option(name, value);
break;
case "currentView":
this._processCurrentView();
this.option("selectedCellData", []);
var viewCountConfig = this._getViewCountConfig();
this._appointments.option({
items: [],
allowDrag: this._allowDragging(),
allowResize: this._allowResizing(),
itemTemplate: this._getAppointmentTemplate("appointmentTemplate")
});
this._header.option("intervalCount", viewCountConfig.intervalCount);
this._header.option("startDate", viewCountConfig.startDate || new Date(this.option("currentDate")));
this._header.option("min", this._dateOption("min"));
this._header.option("max", this._dateOption("max"));
this._header.option("currentDate", this._dateOption("currentDate"));
this._header.option("firstDayOfWeek", this._getCurrentViewOption("firstDayOfWeek"));
this._header.option("currentView", this._currentView);
this._loadResources().done(function (resources) {
this.getLayoutManager().initRenderingStrategy(this._getAppointmentsRenderingStrategy());
this._refreshWorkSpace(resources);
this._filterAppointmentsByDate();
this._appointments.option("allowAllDayResize", value !== "day");
this._reloadDataSource();
}.bind(this));
break;
case "appointmentTemplate":
this._appointments.option("itemTemplate", value);
break;
case "dateCellTemplate":
case "resourceCellTemplate":
case "dataCellTemplate":
case "timeCellTemplate":
this._updateOption("workSpace", name, value);
this.repaint();
break;
case "groups":
this._loadResources().done(function (resources) {
this._refreshWorkSpace(resources);
this._filterAppointmentsByDate();
this._reloadDataSource();
}.bind(this));
break;
case "resources":
this._resourcesManager.setResources(this.option("resources"));
this._appointmentModel.setDataAccessors(this._combineDataAccessors());
this._loadResources().done(function (resources) {
this._appointments.option("items", []);
this._refreshWorkSpace(resources);
this._filterAppointmentsByDate();
this._reloadDataSource();
}.bind(this));
break;
case "startDayHour":
case "endDayHour":
this._appointments.option("items", []);
this._updateOption("workSpace", name, value);
this._appointments.repaint();
this._filterAppointmentsByDate();
this._reloadDataSource();
break;
case "onAppointmentAdding":
case "onAppointmentAdded":
case "onAppointmentUpdating":
case "onAppointmentUpdated":
case "onAppointmentDeleting":
case "onAppointmentDeleted":
case "onAppointmentFormCreated":
this._actions[name] = this._createActionByOption(name);
break;
case "onAppointmentRendered":
this._appointments.option("onItemRendered", this._getAppointmentRenderedAction());
break;
case "onAppointmentClick":
this._appointments.option("onItemClick", this._createActionByOption(name));
break;
case "onAppointmentDblClick":
this._appointments.option(name, this._createActionByOption(name));
break;
case "onAppointmentContextMenu":
this._appointments.option("onItemContextMenu", this._createActionByOption(name));
break;
case "noDataText":
case "allowMultipleCellSelection":
case "selectedCellData":
case "accessKey":
case "onCellClick":
this._workSpace.option(name, value);
break;
case "onCellContextMenu":
this._workSpace.option(name, value);
break;
case "crossScrollingEnabled":
this._loadResources().done(function (resources) {
this._appointments.option("items", []);
this._refreshWorkSpace(resources);
if (this._readyToRenderAppointments) {
this._appointments.option("items", this._getAppointmentsToRepaint());
}
}.bind(this));
break;
case "cellDuration":
this._appointments.option("items", []);
if (this._readyToRenderAppointments) {
this._updateOption("workSpace", "hoursInterval", value / 60);
this._appointments.option("items", this._getAppointmentsToRepaint());
}
break;
case "tabIndex":
case "focusStateEnabled":
this._updateOption("header", name, value);
this._updateOption("workSpace", name, value);
this._appointments.option(name, value);
this.callBase(args);
break;
case "width":
// TODO: replace with css
this._updateOption("header", name, value);
if (this.option("crossScrollingEnabled")) {
this._updateOption("workSpace", "width", value);
}
this.callBase(args);
this._dimensionChanged();
break;
case "height":
this.callBase(args);
this._dimensionChanged();
break;
case "editing":
this._initEditing();
var editing = this._editing;
this._bringEditingModeToAppointments(editing);
this.hideAppointmentTooltip();
this._cleanPopup();
break;
case "showAllDayPanel":
this._loadResources().done(function () {
this._filterAppointmentsByDate();
this._updateOption("workSpace", "allDayExpanded", value);
this._updateOption("workSpace", name, value);
this._reloadDataSource();
}.bind(this));
break;
case "showCurrentTimeIndicator":
case "indicatorTime":
case "indicatorUpdateInterval":
case "shadeUntilCurrentTime":
this._updateOption("workSpace", name, value);
this.repaint();
break;
case "appointmentTooltipTemplate":
case "appointmentPopupTemplate":
case "recurrenceEditMode":
case "remoteFiltering":
case "timeZone":
case "dropDownAppointmentTemplate":
case "_appointmentTooltipOffset":
case "_appointmentTooltipButtonsPosition":
case "_appointmentTooltipCloseButton":
case "_useAppointmentColorForTooltip":
case "_appointmentTooltipOpenButtonText":
case "_appointmentTooltipOpenButtonIcon":
case "_dropDownButtonIcon":
case "_appointmentCountPerCell":
case "_appointmentGroupButtonOffset":
case "_appointmentOffset":
this.repaint();
break;
case "dateSerializationFormat":
break;
case "maxAppointmentsPerCell":
break;
case "startDateExpr":
case "endDateExpr":
case "startDateTimeZoneExpr":
case "endDateTimeZoneExpr":
case "textExpr":
case "descriptionExpr":
case "allDayExpr":
case "recurrenceRuleExpr":
case "recurrenceExceptionExpr":
this._updateExpression(name, value);
this._initAppointmentTemplate();
this.repaint();
break;
default:
this.callBase(args);
}
},
_dateOption: function _dateOption(optionName) {
var optionValue = this._getCurrentViewOption(optionName);
return dateSerialization.deserializeDate(optionValue);
},
_getSerializationFormat: function _getSerializationFormat(optionName) {
var value = this._getCurrent