@@ -170,6 +170,7 @@ const SCHEDULER_CELL_DXCLICK_EVENT_NAME = addNamespace(clickEventName, 'dxSchedu
170170
171171const SCHEDULER_CELL_DXPOINTERDOWN_EVENT_NAME = addNamespace ( pointerEvents . down , 'dxSchedulerDateTable' ) ;
172172const SCHEDULER_CELL_DXPOINTERUP_EVENT_NAME = addNamespace ( pointerEvents . up , 'dxSchedulerDateTable' ) ;
173+ const SCHEDULER_TABLE_DXPOINTERUP_EVENT_NAME = addNamespace ( pointerEvents . up , 'dxSchedulerTable' ) ;
173174
174175const SCHEDULER_CELL_DXPOINTERMOVE_EVENT_NAME = addNamespace ( pointerEvents . move , 'dxSchedulerDateTable' ) ;
175176
@@ -218,8 +219,12 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
218219
219220 _selectionChangedAction : any ;
220221
222+ _selectionEndAction : any ;
223+
221224 _isCellClick : any ;
222225
226+ _isSelectionStartedOnCell = false ;
227+
223228 _contextMenuHandled : any ;
224229
225230 _disposed : any ;
@@ -969,6 +974,7 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
969974
970975 _attachEvents ( ) {
971976 this . _createSelectionChangedAction ( ) ;
977+ this . _createSelectionEndAction ( ) ;
972978 this . _attachClickEvent ( ) ;
973979 this . _attachContextMenuEvent ( ) ;
974980 }
@@ -986,6 +992,8 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
986992
987993 ( eventsEngine . off as any ) ( $element , SCHEDULER_WORKSPACE_DXPOINTERDOWN_EVENT_NAME ) ;
988994 ( eventsEngine . off as any ) ( $element , SCHEDULER_CELL_DXCLICK_EVENT_NAME ) ;
995+ ( eventsEngine . off as any ) ( domAdapter . getDocument ( ) , SCHEDULER_TABLE_DXPOINTERUP_EVENT_NAME ) ;
996+
989997 eventsEngine . on ( $element , SCHEDULER_WORKSPACE_DXPOINTERDOWN_EVENT_NAME , ( e ) => {
990998 if ( isMouseEvent ( e ) && e . which > 1 ) {
991999 e . preventDefault ( ) ;
@@ -997,6 +1005,13 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
9971005 const $cell = $ ( e . target ) ;
9981006 that . _cellClickAction ( { event : e , cellElement : getPublicElement ( $cell ) , cellData : that . getCellData ( $cell ) } ) ;
9991007 } ) ;
1008+
1009+ eventsEngine . on ( domAdapter . getDocument ( ) , SCHEDULER_TABLE_DXPOINTERUP_EVENT_NAME , ( ) => {
1010+ if ( that . _isSelectionStartedOnCell ) {
1011+ that . _fireSelectionEndEvent ( ) ;
1012+ that . _isSelectionStartedOnCell = false ;
1013+ }
1014+ } ) ;
10001015 }
10011016
10021017 _createCellClickAction ( ) {
@@ -1009,10 +1024,15 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
10091024 this . _selectionChangedAction = this . _createActionByOption ( 'onSelectionChanged' ) ;
10101025 }
10111026
1027+ _createSelectionEndAction ( ) {
1028+ this . _selectionEndAction = this . _createActionByOption ( 'onSelectionEnd' ) ;
1029+ }
1030+
10121031 // eslint-disable-next-line @typescript-eslint/no-unused-vars
10131032 _cellClickHandler ( argument ?: any ) {
10141033 if ( this . _showPopup ) {
10151034 delete this . _showPopup ;
1035+ this . _isSelectionStartedOnCell = false ;
10161036 this . _handleSelectedCellsClick ( ) ;
10171037 }
10181038 }
@@ -1022,10 +1042,12 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
10221042
10231043 if ( ! $target . hasClass ( DATE_TABLE_CELL_CLASS ) && ! $target . hasClass ( ALL_DAY_TABLE_CELL_CLASS ) ) {
10241044 this . _isCellClick = false ;
1045+ this . _isSelectionStartedOnCell = false ;
10251046 return ;
10261047 }
10271048
10281049 this . _isCellClick = true ;
1050+ this . _isSelectionStartedOnCell = true ;
10291051 if ( $target . hasClass ( DATE_TABLE_FOCUSED_CELL_CLASS ) ) {
10301052 this . _showPopup = true ;
10311053 } else {
@@ -1932,6 +1954,17 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
19321954 this . _selectionChangedAction ( { selectedCellData } ) ;
19331955 }
19341956
1957+ _fireSelectionEndEvent ( ) {
1958+ const selectedCellData = this . option ( 'selectedCellData' ) ?? [ ] ;
1959+ if ( selectedCellData . length > 0 && this . _selectionEndAction ) {
1960+ const selectedCells = this . cellsSelectionState . getSelectedCells ( ) ;
1961+ this . _selectionEndAction ( {
1962+ selectedCellData,
1963+ selectedCells : $ ( selectedCells ) ,
1964+ } ) ;
1965+ }
1966+ }
1967+
19351968 _getCellByData ( cellData ) {
19361969 const {
19371970 startDate, groupIndex, allDay, index,
@@ -2369,6 +2402,9 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
23692402 case 'onSelectionChanged' :
23702403 this . _createSelectionChangedAction ( ) ;
23712404 break ;
2405+ case 'onSelectionEnd' :
2406+ this . _createSelectionEndAction ( ) ;
2407+ break ;
23722408 case 'onCellClick' :
23732409 this . _createCellClickAction ( ) ;
23742410 break ;
0 commit comments