@@ -22,7 +22,11 @@ import type { ItemLike, SelectionChangeInfo } from '@js/ui/collection/ui.collect
2222import errors from '@js/ui/widget/ui.errors' ;
2323import type { ActionConfig } from '@ts/core/widget/component' ;
2424import type { OptionChanged } from '@ts/core/widget/types' ;
25- import type { CollectionWidgetBaseProperties , PostprocessRenderItemInfo } from '@ts/ui/collection/collection_widget.base' ;
25+ import type {
26+ CollectionItemInfo ,
27+ CollectionWidgetBaseProperties ,
28+ PostprocessRenderItemInfo ,
29+ } from '@ts/ui/collection/collection_widget.base' ;
2630import BaseCollectionWidget from '@ts/ui/collection/collection_widget.base' ;
2731import PlainEditStrategy from '@ts/ui/collection/collection_widget.edit.strategy.plain' ;
2832import type DataController from '@ts/ui/collection/m_data_controller' ;
@@ -53,6 +57,8 @@ export interface CollectionWidgetEditProperties<
5357 selectionRequired ?: boolean ;
5458
5559 focusOnSelectedItem ?: boolean ;
60+
61+ grouped ?: boolean ;
5662}
5763
5864class CollectionWidget <
@@ -62,7 +68,7 @@ class CollectionWidget<
6268 TItem extends ItemLike = any ,
6369 // eslint-disable-next-line @typescript-eslint/no-explicit-any
6470 TKey = any ,
65- > extends BaseCollectionWidget < TProperties > {
71+ > extends BaseCollectionWidget < TProperties , TItem , TKey > {
6672 _userOptions ?: TProperties ;
6773
6874 _selection ! : Selection ;
@@ -466,7 +472,9 @@ class CollectionWidget<
466472 normalizedSelection = this . _editStrategy . itemsGetter ( ) [ 0 ] ;
467473 }
468474
469- if ( this . option ( 'grouped' ) && normalizedSelection ?. items ) {
475+ const { grouped } = this . option ( ) ;
476+
477+ if ( grouped && normalizedSelection ?. items ) {
470478 normalizedSelection . items = [ normalizedSelection . items [ 0 ] ] ;
471479 }
472480
@@ -736,7 +744,8 @@ class CollectionWidget<
736744 _deleteItemFromDS ( $item : dxElementWrapper ) : Promise < unknown > | DeferredObj < unknown > {
737745 const dataController = this . _dataController ;
738746 const deferred = Deferred ( ) ;
739- const disabledState = this . option ( 'disabled' ) ;
747+ const { disabled } = this . option ( ) ;
748+
740749 const dataStore = dataController . store ( ) ;
741750
742751 if ( ! dataStore ) {
@@ -762,16 +771,18 @@ class CollectionWidget<
762771 } ) ;
763772
764773 deferred . always ( ( ) : void => {
765- this . option ( 'disabled' , disabledState ) ;
774+ this . option ( 'disabled' , disabled ) ;
766775 } ) ;
767776
768777 return deferred ;
769778 }
770779
771780 _tryRefreshLastPage ( ) : Promise < unknown > {
772781 const deferred = Deferred ( ) ;
782+
783+ const { grouped } = this . option ( ) ;
773784 // @ts -expect-error mixin method
774- if ( this . _isLastPage ( ) || this . option ( ' grouped' ) ) {
785+ if ( this . _isLastPage ( ) || grouped ) {
775786 deferred . resolve ( ) ;
776787 } else {
777788 this . _refreshLastPage ( ) . done ( ( ) => {
@@ -871,13 +882,13 @@ class CollectionWidget<
871882
872883 _afterItemElementDeleted (
873884 $item : dxElementWrapper ,
874- deletedActionArgs : ItemInfo < TItem > ,
885+ deletedActionArgs : CollectionItemInfo < TItem > ,
875886 ) : void {
876887 const changingOption = this . _dataController . getDataSource ( )
877888 ? 'dataSource'
878889 : 'items' ;
879890 this . _simulateOptionChange ( changingOption ) ;
880- this . _itemEventHandler ( $item , 'onItemDeleted' , deletedActionArgs , {
891+ this . _itemEventHandler ( $item , 'onItemDeleted' , deletedActionArgs as ItemInfo < TItem > , {
881892 beforeExecute ( ) {
882893 $item . remove ( ) ;
883894 } ,
@@ -886,7 +897,7 @@ class CollectionWidget<
886897 this . _renderEmptyMessage ( ) ;
887898 }
888899
889- deleteItem ( itemElement : Element ) : Promise < unknown > {
900+ deleteItem ( itemElement : Element ) : PromiseLike < unknown > {
890901 const deferred = Deferred ( ) ;
891902 const $item = this . _editStrategy . getItemElement ( itemElement ) ;
892903 const index = this . _editStrategy . getNormalizedIndex ( itemElement ) ;
0 commit comments