@@ -68,14 +68,17 @@ import {
68
68
resourceTimeLineHeaderToolbar ,
69
69
resourceTimeGridHeaderToolbar ,
70
70
} from "./calendarConstants" ;
71
+
72
+ // this should ensure backwards compatibility with older versions of the SDK
73
+ const safeDragEventHandlerControl = typeof DragEventHandlerControl !== 'undefined' ? DragEventHandlerControl : ( ) => { } ;
71
74
72
75
const childrenMap = {
73
76
events : jsonValueExposingStateControl ( "events" , defaultData ) ,
74
77
resourcesEvents : jsonValueExposingStateControl ( "resourcesEvents" , resourcesEventsDefaultData ) ,
75
78
resources : jsonValueExposingStateControl ( "resources" , resourcesDefaultData ) ,
76
79
resourceName : withDefault ( StringControl , trans ( "calendar.resourcesDefault" ) ) ,
77
80
onEvent : ChangeEventHandlerControl ,
78
- onDropEvent : DragEventHandlerControl ,
81
+ onDropEvent : safeDragEventHandlerControl ,
79
82
editable : withDefault ( BoolControl , true ) ,
80
83
showEventTime : withDefault ( BoolControl , true ) ,
81
84
showWeekends : withDefault ( BoolControl , true ) ,
@@ -418,6 +421,12 @@ let CalendarBasicComp = (function () {
418
421
} ) ;
419
422
} ;
420
423
424
+ const handleDrop = ( ) => {
425
+ if ( typeof props . onDropEvent === 'function' ) {
426
+ props . onDropEvent ( "dropEvent" ) ;
427
+ }
428
+ } ;
429
+
421
430
return (
422
431
< Wrapper
423
432
ref = { ref }
@@ -444,7 +453,6 @@ let CalendarBasicComp = (function () {
444
453
plugins = { filteredPlugins }
445
454
headerToolbar = { toolBar ( currentView ) }
446
455
resourceAreaHeaderContent = { resourceName }
447
-
448
456
buttonText = { buttonText }
449
457
schedulerLicenseKey = { licenseKey }
450
458
views = { views }
@@ -526,7 +534,7 @@ let CalendarBasicComp = (function () {
526
534
} }
527
535
eventDragStop = { ( info ) => {
528
536
if ( info . view ) {
529
- props . onDropEvent ( "dropEvent" ) ;
537
+ handleDrop
530
538
}
531
539
} }
532
540
/>
@@ -535,7 +543,6 @@ let CalendarBasicComp = (function () {
535
543
) ;
536
544
} )
537
545
. setPropertyViewFn ( ( children : {
538
-
539
546
events : { propertyView : ( arg0 : { } ) => any ; } ;
540
547
resourcesEvents : { propertyView : ( arg0 : { } ) => any ; } ;
541
548
resources : { propertyView : ( arg0 : { } ) => any ; } ;
@@ -577,7 +584,7 @@ let CalendarBasicComp = (function () {
577
584
{ children . onEvent . propertyView ( ) }
578
585
</ div >
579
586
< div style = { { display : 'flex' , flexDirection : 'column' , gap : '8px' } } >
580
- { children . onDropEvent . propertyView ( { title : trans ( "calendar.dragDropEventHandlers" ) } ) }
587
+ { children . onDropEvent ? .propertyView ( { title : trans ( "calendar.dragDropEventHandlers" ) } ) }
581
588
</ div >
582
589
{ children . editable . propertyView ( { label : trans ( "calendar.editable" ) , } ) }
583
590
</ Section >
0 commit comments