Skip to content

Commit b93383d

Browse files
committed
Merge branch 'pivot-grid-master' of https://github.com/IgniteUI/igniteui-angular into mdragnev/feat-10713
2 parents 3561bfd + e76211d commit b93383d

26 files changed

+741
-248
lines changed

projects/igniteui-angular/src/lib/core/styles/components/grid/_grid-theme.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2878,7 +2878,11 @@
28782878

28792879
// Pivot grid
28802880
%grid-thead--pivot {
2881-
flex-direction: column;
2881+
display: flex;
2882+
2883+
%grid-thead--virtualizationWrapper {
2884+
border-#{$left}: var-get($theme, 'header-border-width') var-get($theme, 'header-border-style') var-get($theme, 'header-border-color');
2885+
}
28822886
}
28832887

28842888
%grid-thead--virtualizationWrapper {
@@ -2911,7 +2915,6 @@
29112915
padding: map.get($grid-header-padding, 'comfortable');
29122916
background-clip: border-box !important;
29132917
border-#{$left}: var-get($theme, 'header-border-width') var-get($theme, 'header-border-style') var-get($theme, 'header-border-color');
2914-
border-#{$right}: var-get($theme, 'header-border-width') var-get($theme, 'header-border-style') var-get($theme, 'header-border-color');
29152918
border-bottom: var-get($theme, 'header-border-width') var-get($theme, 'header-border-style') var-get($theme, 'header-border-color');
29162919

29172920
igx-chips-area {

projects/igniteui-angular/src/lib/grids/common/grid.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ export interface PivotGridType extends GridType {
628628
showPivotConfigurationUI: boolean;
629629
columnDimensions: IPivotDimension[];
630630
rowDimensions: IPivotDimension[];
631+
rowDimensionResizing: boolean;
631632
values: IPivotValue[];
632633
filterDimensions: IPivotDimension[];
633634
dimensionDataColumns: ColumnType[];

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
</igx-circular-bar>
127127
</div>
128128
</ng-template>
129-
<igx-grid-column-resizer *ngIf="colResizingService.showResizer"></igx-grid-column-resizer>
129+
<igx-pivot-grid-column-resizer [restrictResizerTop]="theadRow.nativeElement.clientHeight" *ngIf="colResizingService.showResizer"></igx-pivot-grid-column-resizer>
130130
<div class="igx-grid__loading-outlet" #igxLoadingOverlayOutlet igxOverlayOutlet></div>
131131
<div class="igx-grid__outlet" #igxFilteringOverlayOutlet igxOverlayOutlet></div>
132132

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.component.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import { DropPosition } from '../moving/moving.service';
5151
import { DimensionValuesFilteringStrategy, NoopPivotDimensionsStrategy } from '../../data-operations/pivot-strategy';
5252
import { IgxGridExcelStyleFilteringComponent } from '../filtering/excel-style/grid.excel-style-filtering.component';
5353
import { IgxPivotGridNavigationService } from './pivot-grid-navigation.service';
54-
import { IgxColumnResizingService } from '../resizing/resizing.service';
54+
import { IgxPivotColumnResizingService } from '../resizing/pivot-grid/pivot-resizing.service';
5555
import { IgxFlatTransactionFactory, IgxOverlayService, State, Transaction, TransactionService } from '../../services/public_api';
5656
import { DOCUMENT } from '@angular/common';
5757
import { DisplayDensityToken, IDisplayDensityOptions } from '../../core/displayDensity';
@@ -65,6 +65,7 @@ import { GridBaseAPIService } from '../api.service';
6565
import { IgxGridForOfDirective } from '../../directives/for-of/for_of.directive';
6666
import { IgxPivotRowDimensionContentComponent } from './pivot-row-dimension-content.component';
6767
import { flatten } from '@angular/compiler';
68+
import { IgxPivotGridColumnResizerComponent } from '../resizing/pivot-grid/pivot-resizer.component';
6869

6970
let NEXT_ID = 0;
7071
const MINIMUM_COLUMN_WIDTH = 200;
@@ -81,6 +82,7 @@ const MINIMUM_COLUMN_WIDTH = 200;
8182
{ provide: IGX_GRID_BASE, useExisting: IgxPivotGridComponent },
8283
{ provide: IgxFilteringService, useClass: IgxPivotFilteringService },
8384
IgxPivotGridNavigationService,
85+
IgxPivotColumnResizingService,
8486
IgxForOfSyncService,
8587
IgxForOfScrollSyncService
8688
]
@@ -129,7 +131,14 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
129131
* <igx-pivot-grid [pivotConfiguration]="config"></igx-pivot-grid>
130132
* ```
131133
*/
132-
public pivotConfiguration: IPivotConfiguration = { rows: null, columns: null, values: null, filters: null };
134+
public set pivotConfiguration(value :IPivotConfiguration) {
135+
this._pivotConfiguration = value;
136+
this.notifyChanges(true);
137+
}
138+
139+
public get pivotConfiguration() {
140+
return this._pivotConfiguration;
141+
}
133142

134143
@Input()
135144
/**
@@ -161,6 +170,12 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
161170
@ViewChild('headerTemplate', { read: TemplateRef, static: true })
162171
public headerTemplate: TemplateRef<any>;
163172

173+
/**
174+
* @hidden @internal
175+
*/
176+
@ViewChild(IgxPivotGridColumnResizerComponent)
177+
public resizeLine: IgxPivotGridColumnResizerComponent;
178+
164179
/**
165180
* @hidden @interal
166181
*/
@@ -323,9 +338,15 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
323338
return false;
324339
}
325340

341+
/**
342+
* @hidden @internal
343+
*/
344+
public rowDimensionResizing = true;
345+
326346
protected _defaultExpandState = false;
327347
private _data;
328348
private _filteredData;
349+
private _pivotConfiguration: IPivotConfiguration = { rows: null, columns: null, values: null, filters: null };
329350
private p_id = `igx-pivot-grid-${NEXT_ID++}`;
330351

331352

@@ -498,7 +519,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
498519

499520
constructor(
500521
public selectionService: IgxGridSelectionService,
501-
public colResizingService: IgxColumnResizingService,
522+
public colResizingService: IgxPivotColumnResizingService,
502523
gridAPI: GridBaseAPIService<IgxGridBaseDirective & GridType>,
503524
protected transactionFactory: IgxFlatTransactionFactory,
504525
elementRef: ElementRef<HTMLElement>,

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.interface.ts

Lines changed: 73 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,55 @@ import { FilteringExpressionsTree } from '../../data-operations/filtering-expres
33
import { SortingDirection } from '../../data-operations/sorting-strategy';
44
import { ColumnType } from '../common/grid.interface';
55

6+
7+
/**
8+
* Default pivot keys used for data processing in the pivot pipes.
9+
*/
610
export const DEFAULT_PIVOT_KEYS = {
711
aggregations: 'aggregations', records: 'records', children: 'children', level: 'level',
812
rowDimensionSeparator: '_', columnDimensionSeparator: '-'
913
};
1014

15+
16+
/**
17+
* Event emitted when dimension collection for rows, columns of filters is changed.
18+
*/
1119
export interface IDimensionsChange {
20+
/** The new list of dimensions. */
1221
dimensions: IPivotDimension[],
22+
/** The dimension list type - Row, Column or Filter. */
1323
dimensionCollectionType: PivotDimensionType
1424
}
1525

26+
/**
27+
* Event emitted when values list is changed.
28+
*/
1629
export interface IValuesChange {
30+
/** The new list of values. */
1731
values: IPivotValue[]
1832
}
1933

34+
/**
35+
* Interface describing Pivot data processing for dimensions.
36+
* Should contain a process method and return records hierarchy based on the provided dimensions.
37+
*/
2038
export interface IPivotDimensionStrategy {
2139
process(collection: any,
2240
dimensions: IPivotDimension[],
2341
values: IPivotValue[],
2442
pivotKeys?: IPivotKeys): any[];
2543
}
2644

45+
/**
46+
* Interface describing a PivotAggregation function.
47+
* Accepts an array of extracted data members and a array of the original data records.
48+
*/
2749
export type PivotAggregation = (members: any[], data: any[]) => any;
2850

51+
/**
52+
* Interface describing a IPivotAggregator class.
53+
* Used for specifying custom aggregator lists.
54+
*/
2955
export interface IPivotAggregator {
3056
/** Aggregation unique key. */
3157
key: string;
@@ -38,7 +64,7 @@ export interface IPivotAggregator {
3864
aggregator: (members: any[], data?: any[]) => any;
3965
}
4066

41-
/**
67+
/**
4268
* Configuration of the pivot grid.
4369
*/
4470
export interface IPivotConfiguration {
@@ -54,9 +80,13 @@ export interface IPivotConfiguration {
5480
values: IPivotValue[] | null;
5581
/** Dimensions to be displayed in the filter area. */
5682
filters?: IPivotDimension[] | null;
83+
/** Pivot data keys used for data generation. Can be used for custom remote scenarios where the data is pre-populated. */
5784
pivotKeys?: IPivotKeys;
5885
}
5986

87+
/**
88+
* Configuration of a pivot dimension.
89+
*/
6090
export interface IPivotDimension {
6191
/** Allows defining a hierarchy when multiple sub groups need to be extracted from single member. */
6292
childLevel?: IPivotDimension;
@@ -70,15 +100,24 @@ export interface IPivotDimension {
70100
* A predefined or defined via the `igxPivotSelector` filter expression tree for the current dimension to be applied in the filter pipe.
71101
* */
72102
filter?: FilteringExpressionsTree | null;
103+
/**
104+
* The sorting direction of the current dimension. Determines the order in which the values will appear in the related dimension.
105+
*/
73106
sortDirection?: SortingDirection;
107+
/**
108+
* The dataType of the related data field.
109+
*/
74110
dataType?: GridColumnDataType;
75-
// The width of the dimension cells to be rendered.Can be pixel or %.
76-
width? : string;
111+
/** The width of the dimension cells to be rendered.Can be pixel or %. */
112+
width?: string;
77113
}
78-
114+
/**
115+
* Configuration of a pivot value aggregation.
116+
*/
79117
export interface IPivotValue {
118+
/** Field name to use in order to extract value. */
80119
member: string;
81-
// display name if present shows instead of member for the column header of this value
120+
/** Display name to show instead of member for the column header of this value. **/
82121
displayName?: string;
83122
/**
84123
* Active aggregator definition with key, label and aggregator.
@@ -88,34 +127,59 @@ export interface IPivotValue {
88127
* List of aggregates to show in aggregate drop-down.
89128
*/
90129
aggregateList?: IPivotAggregator[];
91-
// Enables/Disables a particular value from pivot aggregation.
130+
/** Enables/Disables a particular value from pivot aggregation. */
92131
enabled: boolean;
93-
// Allow conditionally styling of the IgxPivotGrid cells
132+
/** Allow conditionally styling of the IgxPivotGrid cells. */
94133
styles?: any;
95-
// Enables a data type specific template of the cells
134+
/** Enables a data type specific template of the cells */
96135
dataType?: GridColumnDataType;
97-
// Applies display format to cell values.
136+
/** Applies display format to cell values. */
98137
formatter?: (value: any, rowData?: any) => any;
99138
}
100139

140+
/** Interface describing the Pivot data keys used for data generation.
141+
* Can be used for custom remote scenarios where the data is pre-populated.
142+
*/
101143
export interface IPivotKeys {
144+
/** Field that stores children for hierarchy building. */
102145
children: string;
146+
/** Field that stores reference to the original data records. */
103147
records: string;
148+
/** Field that stores aggregation values. */
104149
aggregations: string;
150+
/** Field that stores dimension level based on its hierarchy. */
105151
level: string;
152+
/** Separator used when generating the unique column field values. */
106153
columnDimensionSeparator: string;
154+
/** Separator used when generating the unique row field values. */
107155
rowDimensionSeparator: string;
108156
}
109157

158+
/** The dimension types - Row, Column or Filter. */
110159
export enum PivotDimensionType {
111160
Row,
112161
Column,
113162
Filter
114163
}
115164

165+
/** Interface describing the pivot dimension data.
166+
* Contains additional information needed to render dimension headers.
167+
*/
116168
export interface IPivotDimensionData {
169+
/** Associated column definition. */
117170
column: ColumnType;
171+
/** Associated dimension definition. */
118172
dimension: IPivotDimension;
173+
/** List of previous dimension groups. */
119174
prevDimensions: IPivotDimension[];
175+
/** Whether this a child dimension. */
120176
isChild?: boolean;
121177
}
178+
179+
export interface PivotRowHeaderGroupType {
180+
rowIndex: number;
181+
parent: any;
182+
header: any;
183+
headerID: string;
184+
grid: any;
185+
}

0 commit comments

Comments
 (0)