@@ -68,14 +68,17 @@ import {
6868 resourceTimeLineHeaderToolbar ,
6969 resourceTimeGridHeaderToolbar ,
7070} from "./calendarConstants" ;
71+
72+ // this should ensure backwards compatibility with older versions of the SDK
73+ const safeDragEventHandlerControl = typeof DragEventHandlerControl !== 'undefined' ? DragEventHandlerControl : ( ) => { } ;
7174
7275const childrenMap = {
7376 events : jsonValueExposingStateControl ( "events" , defaultData ) ,
7477 resourcesEvents : jsonValueExposingStateControl ( "resourcesEvents" , resourcesEventsDefaultData ) ,
7578 resources : jsonValueExposingStateControl ( "resources" , resourcesDefaultData ) ,
7679 resourceName : withDefault ( StringControl , trans ( "calendar.resourcesDefault" ) ) ,
7780 onEvent : ChangeEventHandlerControl ,
78- onDropEvent : DragEventHandlerControl ,
81+ onDropEvent : safeDragEventHandlerControl ,
7982 editable : withDefault ( BoolControl , true ) ,
8083 showEventTime : withDefault ( BoolControl , true ) ,
8184 showWeekends : withDefault ( BoolControl , true ) ,
@@ -418,6 +421,12 @@ let CalendarBasicComp = (function () {
418421 } ) ;
419422 } ;
420423
424+ const handleDrop = ( ) => {
425+ if ( typeof props . onDropEvent === 'function' ) {
426+ props . onDropEvent ( "dropEvent" ) ;
427+ }
428+ } ;
429+
421430 return (
422431 < Wrapper
423432 ref = { ref }
@@ -444,7 +453,6 @@ let CalendarBasicComp = (function () {
444453 plugins = { filteredPlugins }
445454 headerToolbar = { toolBar ( currentView ) }
446455 resourceAreaHeaderContent = { resourceName }
447-
448456 buttonText = { buttonText }
449457 schedulerLicenseKey = { licenseKey }
450458 views = { views }
@@ -526,7 +534,7 @@ let CalendarBasicComp = (function () {
526534 } }
527535 eventDragStop = { ( info ) => {
528536 if ( info . view ) {
529- props . onDropEvent ( "dropEvent" ) ;
537+ handleDrop
530538 }
531539 } }
532540 />
@@ -535,7 +543,6 @@ let CalendarBasicComp = (function () {
535543 ) ;
536544 } )
537545 . setPropertyViewFn ( ( children : {
538-
539546 events : { propertyView : ( arg0 : { } ) => any ; } ;
540547 resourcesEvents : { propertyView : ( arg0 : { } ) => any ; } ;
541548 resources : { propertyView : ( arg0 : { } ) => any ; } ;
@@ -577,7 +584,7 @@ let CalendarBasicComp = (function () {
577584 { children . onEvent . propertyView ( ) }
578585 </ div >
579586 < div style = { { display : 'flex' , flexDirection : 'column' , gap : '8px' } } >
580- { children . onDropEvent . propertyView ( { title : trans ( "calendar.dragDropEventHandlers" ) } ) }
587+ { children . onDropEvent ? .propertyView ( { title : trans ( "calendar.dragDropEventHandlers" ) } ) }
581588 </ div >
582589 { children . editable . propertyView ( { label : trans ( "calendar.editable" ) , } ) }
583590 </ Section >
0 commit comments