1
1
import {
2
2
Component , ChangeDetectionStrategy , Input , Output , EventEmitter , ContentChild , ViewChildren ,
3
- QueryList , ViewChild , ElementRef , TemplateRef , DoCheck , AfterContentInit , HostBinding ,
3
+ QueryList , ViewChild , TemplateRef , DoCheck , AfterContentInit , HostBinding ,
4
4
forwardRef , OnInit , AfterViewInit , ContentChildren
5
5
} from '@angular/core' ;
6
6
import { GridBaseAPIService } from '../api.service' ;
@@ -14,8 +14,6 @@ import { IgxGroupByRowTemplateDirective, IgxGridDetailTemplateDirective } from '
14
14
import { IgxGridGroupByRowComponent } from './groupby-row.component' ;
15
15
import { IGroupByExpandState } from '../../data-operations/groupby-expand-state.interface' ;
16
16
import { IForOfState } from '../../directives/for-of/for_of.directive' ;
17
- import { IBaseChipEventArgs , IChipClickEventArgs , IChipKeyDownEventArgs } from '../../chips/chip.component' ;
18
- import { IChipsAreaReorderEventArgs } from '../../chips/chips-area.component' ;
19
17
import { IgxColumnComponent } from '../columns/column.component' ;
20
18
import { takeUntil } from 'rxjs/operators' ;
21
19
import { IgxFilteringService } from '../filtering/grid-filtering.service' ;
@@ -25,12 +23,13 @@ import { IgxGridSummaryService } from '../summaries/grid-summary.service';
25
23
import { IgxGridSelectionService } from '../selection/selection.service' ;
26
24
import { IgxForOfSyncService , IgxForOfScrollSyncService } from '../../directives/for-of/for_of.sync.service' ;
27
25
import { IgxGridMRLNavigationService } from '../grid-mrl-navigation.service' ;
28
- import { FilterMode , RowPinningPosition } from '../common/enums' ;
26
+ import { FilterMode } from '../common/enums' ;
29
27
import { GridType } from '../common/grid.interface' ;
30
28
import { IgxGroupByRowSelectorDirective } from '../selection/row-selectors' ;
31
29
import { IgxGridCRUDService } from '../common/crud.service' ;
32
30
import { IgxGridRow , IgxGroupByRow , IgxSummaryRow } from '../grid-public-row' ;
33
31
import { RowType } from '../common/row.interface' ;
32
+ import { IgxGridGroupByAreaComponent } from '../grouping/grid-group-by-area.component' ;
34
33
35
34
let NEXT_ID = 0 ;
36
35
@@ -156,17 +155,11 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
156
155
@ContentChild ( IgxGridDetailTemplateDirective , { read : TemplateRef , static : false } )
157
156
public detailTemplate : TemplateRef < any > = null ;
158
157
159
- /**
160
- * @hidden @internal
161
- */
162
- @ViewChild ( 'defaultDropArea' , { read : TemplateRef , static : true } )
163
- public defaultDropAreaTemplate : TemplateRef < any > ;
164
-
165
158
/**
166
159
* @hidden @internal
167
160
*/
168
161
@ViewChild ( 'groupArea' )
169
- public groupArea : ElementRef ;
162
+ public groupArea : IgxGridGroupByAreaComponent ;
170
163
171
164
/**
172
165
* @hidden @internal
@@ -371,7 +364,6 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
371
364
const newExpressions : IGroupingExpression [ ] = value ;
372
365
this . _groupingExpressions = cloneArray ( value ) ;
373
366
this . groupingExpressionsChange . emit ( this . _groupingExpressions ) ;
374
- this . chipsGoupingExpressions = cloneArray ( value ) ;
375
367
if ( this . _gridAPI . grid ) {
376
368
/* grouping should work in conjunction with sorting
377
369
and without overriding separate sorting expressions */
@@ -572,12 +564,6 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
572
564
public isDetailActive ( rowIndex ) {
573
565
return this . navigation . activeNode ? this . navigation . activeNode . row === rowIndex : false ;
574
566
}
575
- /**
576
- * @hidden @internal
577
- */
578
- public get groupAreaHostClass ( ) : string {
579
- return this . getComponentDensityClass ( 'igx-drop-area' ) ;
580
- }
581
567
582
568
/**
583
569
* Gets/Sets the template reference for the group row.
@@ -812,7 +798,7 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
812
798
*/
813
799
public get dropAreaVisible ( ) : boolean {
814
800
return ( this . draggedColumn && this . draggedColumn . groupable ) ||
815
- ! this . chipsGoupingExpressions . length ;
801
+ ! this . groupingExpressions . length ;
816
802
}
817
803
818
804
/**
@@ -878,89 +864,6 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
878
864
}
879
865
}
880
866
881
- /**
882
- * @hidden @internal
883
- */
884
- public onChipRemoved ( event : IBaseChipEventArgs ) {
885
- this . clearGrouping ( event . owner . id ) ;
886
- }
887
-
888
- /**
889
- * @hidden @internal
890
- */
891
- public chipsOrderChanged ( event : IChipsAreaReorderEventArgs ) {
892
- const newGrouping = [ ] ;
893
- for ( const chip of event . chipsArray ) {
894
- const expr = this . groupingExpressions . filter ( ( item ) => item . fieldName === chip . id ) [ 0 ] ;
895
-
896
- if ( ! this . getColumnByName ( expr . fieldName ) . groupable ) {
897
- // disallow changing order if there are columns with groupable: false
898
- return ;
899
- }
900
- newGrouping . push ( expr ) ;
901
- }
902
- this . groupingExpansionState = [ ] ;
903
- this . chipsGoupingExpressions = newGrouping ;
904
-
905
- if ( event . originalEvent instanceof KeyboardEvent ) {
906
- // When reordered using keyboard navigation, we don't have `onMoveEnd` event.
907
- this . groupingExpressions = this . chipsGoupingExpressions ;
908
- }
909
- this . notifyChanges ( ) ;
910
- }
911
-
912
- /**
913
- * @hidden @internal
914
- */
915
- public chipsMovingEnded ( ) {
916
- this . groupingExpressions = this . chipsGoupingExpressions ;
917
- this . notifyChanges ( ) ;
918
- }
919
-
920
- /**
921
- * @hidden @internal
922
- */
923
- public onChipClicked ( event : IChipClickEventArgs ) {
924
- const sortingExpr = this . sortingExpressions ;
925
- const columnExpr = sortingExpr . find ( ( expr ) => expr . fieldName === event . owner . id ) ;
926
- const groupExpr = this . groupingExpressions . find ( ( expr ) => expr . fieldName === event . owner . id ) ;
927
- columnExpr . dir = 3 - columnExpr . dir ;
928
- groupExpr . dir = columnExpr . dir ;
929
- this . sort ( columnExpr ) ;
930
- this . notifyChanges ( ) ;
931
- }
932
-
933
- /**
934
- * @hidden @internal
935
- */
936
- public onChipKeyDown ( event : IChipKeyDownEventArgs ) {
937
- if ( event . originalEvent . key === ' ' || event . originalEvent . key === 'Spacebar' || event . originalEvent . key === 'Enter' ) {
938
- const sortingExpr = this . sortingExpressions ;
939
- const columnExpr = sortingExpr . find ( ( expr ) => expr . fieldName === event . owner . id ) ;
940
- columnExpr . dir = 3 - columnExpr . dir ;
941
- this . sort ( columnExpr ) ;
942
- this . notifyChanges ( ) ;
943
- }
944
- }
945
-
946
- /**
947
- * @hidden @internal
948
- */
949
- public get dropAreaTemplateResolved ( ) : TemplateRef < any > {
950
- if ( this . dropAreaTemplate ) {
951
- return this . dropAreaTemplate ;
952
- } else {
953
- return this . defaultDropAreaTemplate ;
954
- }
955
- }
956
-
957
- /**
958
- * @hidden @internal
959
- */
960
- public getGroupByChipTitle ( expression : IGroupingExpression ) : string {
961
- const column = this . getColumnByName ( expression . fieldName ) ;
962
- return ( column && column . header ) || expression . fieldName ;
963
- }
964
867
/**
965
868
* @hidden @internal
966
869
*/
@@ -972,14 +875,6 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
972
875
}
973
876
}
974
877
975
- /**
976
- * @hidden @internal
977
- */
978
- public getColumnGroupable ( fieldName : string ) : boolean {
979
- const column = this . getColumnByName ( fieldName ) ;
980
- return column && column . groupable ;
981
- }
982
-
983
878
/**
984
879
* @hidden @internal
985
880
*/
0 commit comments