Skip to content

Commit 0a6622e

Browse files
authored
Merge pull request #14185 from IgniteUI/skrastev/pivot-row-header
2 parents cdb0598 + f884a3e commit 0a6622e

27 files changed

+653
-78
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ All notable changes for each version of this project will be documented in this
1010
- Now accept the following custom `inputFormat` options, as Angular's DatePipe:
1111
- Fractional seconds: S, SS, SSS.
1212
- Period (Am/Pm): a, aa, aaa, aaaa, aaaaa
13+
- `IgxPivotGrid`
14+
- Added templatable row dimension headers displayed on the top, above all row headers.
15+
- Replace the `showPivotConfigurationUI` property with `pivotUI` property, adding ability now to enable/disable the configuration UI and/or the new row dimension headers.
16+
- Added `sortable` property for each IPivotDimension.
1317

1418
## 17.2.0
1519
### New Features

projects/igniteui-angular/migrations/migration-collection.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@
186186
"version": "17.2.3",
187187
"description": "Updates Ignite UI for Angular from v17.2.2 to v17.2.3",
188188
"factory": "./update-17_2_3"
189+
},
190+
"migration-38": {
191+
"version": "18.0.0",
192+
"description": "Updates Ignite UI for Angular from v17.2.x to v18.0.0",
193+
"factory": "./update-18_0_0"
189194
}
190195
}
191196
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "../../common/schema/binding.schema.json",
3+
"changes": [
4+
{
5+
"name": "showPivotConfigurationUI",
6+
"replaceWith": "pivotUI",
7+
"valueTransform": "pivotConfigurationUI_to_pivotUI",
8+
"owner": {
9+
"selector": "igx-pivot-grid",
10+
"type": "component"
11+
}
12+
}
13+
]
14+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import * as path from 'path';
2+
3+
import { EmptyTree } from '@angular-devkit/schematics';
4+
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
5+
6+
const version = '18.0.0';
7+
8+
describe(`Update to ${version}`, () => {
9+
let appTree: UnitTestTree;
10+
const schematicRunner = new SchematicTestRunner('ig-migrate', path.join(__dirname, '../migration-collection.json'));
11+
12+
const configJson = {
13+
projects: {
14+
testProj: {
15+
root: '/',
16+
sourceRoot: '/testSrc'
17+
}
18+
},
19+
schematics: {
20+
'@schematics/angular:component': {
21+
prefix: 'appPrefix'
22+
}
23+
}
24+
};
25+
26+
beforeEach(() => {
27+
appTree = new UnitTestTree(new EmptyTree());
28+
appTree.create('/angular.json', JSON.stringify(configJson));
29+
});
30+
31+
const migrationName = 'migration-38';
32+
33+
it('should replace PivotGrid property `showPivotConfigurationUI` with `pivotUI`', async () => {
34+
appTree.create(`/testSrc/appPrefix/component/test.component.html`,
35+
`
36+
<igx-pivot-grid [showPivotConfigurationUI]="false"></igx-pivot-grid>
37+
`
38+
);
39+
40+
const tree = await schematicRunner.runSchematic(migrationName, { shouldInvokeLS: false }, appTree);
41+
42+
expect(tree.readContent('/testSrc/appPrefix/component/test.component.html')).toEqual(
43+
`
44+
<igx-pivot-grid [pivotUI]="{ showConfiguration: false }"></igx-pivot-grid>
45+
`
46+
);
47+
});
48+
49+
it('should replace PivotGrid property `showPivotConfigurationUI` with `pivotUI`', async () => {
50+
appTree.create(`/testSrc/appPrefix/component/test.component.html`,
51+
`
52+
<igx-pivot-grid [showPivotConfigurationUI]="testProp"></igx-pivot-grid>
53+
`
54+
);
55+
56+
const tree = await schematicRunner.runSchematic(migrationName, { shouldInvokeLS: false }, appTree);
57+
58+
expect(tree.readContent('/testSrc/appPrefix/component/test.component.html')).toEqual(
59+
`
60+
<igx-pivot-grid [pivotUI]="{ showConfiguration: testProp }"></igx-pivot-grid>
61+
`
62+
);
63+
});
64+
});
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Rule, SchematicContext, Tree } from "@angular-devkit/schematics";
2+
import { BoundPropertyObject, InputPropertyType, UpdateChanges } from "../common/UpdateChanges";
3+
4+
const version = "18.0.0";
5+
6+
export default (): Rule => async (host: Tree, context: SchematicContext) => {
7+
context.logger.info(
8+
`Applying migration for Ignite UI for Angular to version ${version}`,
9+
);
10+
const update = new UpdateChanges(__dirname, host, context);
11+
12+
update.addValueTransform('pivotConfigurationUI_to_pivotUI', (args: BoundPropertyObject): void => {
13+
args.bindingType = InputPropertyType.EVAL;
14+
15+
switch (args.value) {
16+
case 'true':
17+
args.value = '{ showConfiguration: true }';
18+
break;
19+
case 'false':
20+
args.value = '{ showConfiguration: false }';
21+
break;
22+
default:
23+
args.value = `{ showConfiguration: ${args.value} }`;
24+
}
25+
});
26+
27+
update.applyChanges();
28+
};

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3049,6 +3049,15 @@
30493049
border-bottom: 0;
30503050
}
30513051

3052+
%igx-grid__tr-pivot--small-row-area {
3053+
height: var(--header-size);
3054+
align-items: flex-end;
3055+
3056+
border-inline-start: 0;
3057+
border-inline-end: 0;
3058+
border-bottom: var-get($theme, 'header-border-width') var-get($theme, 'header-border-style') var-get($theme, 'header-border-color');
3059+
}
3060+
30523061
%igx-grid__tr-pivot--filter-container {
30533062
display: flex;
30543063
flex-direction: column;
@@ -3106,6 +3115,33 @@
31063115
align-items: center;
31073116
}
31083117
}
3118+
3119+
igx-pivot-row-header-group {
3120+
padding-left: pad-inline(
3121+
map.get($grid-header-padding-inline, 'compact'),
3122+
map.get($grid-header-padding-inline, 'cosy'),
3123+
map.get($grid-header-padding-inline, 'comfortable')
3124+
);
3125+
3126+
igx-pivot-row-dimension-header {
3127+
align-items: center;
3128+
3129+
.igx-grid-th__icons {
3130+
padding-right: pad-inline(
3131+
map.get($grid-header-padding-inline, 'compact'),
3132+
map.get($grid-header-padding-inline, 'cosy'),
3133+
map.get($grid-header-padding-inline, 'comfortable')
3134+
);
3135+
}
3136+
}
3137+
3138+
&:last-of-type {
3139+
igx-pivot-row-dimension-header {
3140+
border-inline-end: 0;
3141+
}
3142+
}
3143+
}
31093144
}
3145+
31103146
// Pivot grid END
31113147
}

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { ISortingExpression, ISortingStrategy, SortingDirection } from '../../da
3535
import { IGridGroupingStrategy, IGridSortingStrategy } from './strategy';
3636
import { IForOfState, IgxGridForOfDirective } from '../../directives/for-of/for_of.directive';
3737
import { OverlaySettings } from '../../services/overlay/utilities';
38-
import { IDimensionsChange, IPivotConfiguration, IPivotDimension, IPivotKeys, IPivotValue, IValuesChange, PivotDimensionType } from '../pivot-grid/pivot-grid.interface';
38+
import { IDimensionsChange, IPivotConfiguration, IPivotDimension, IPivotKeys, IPivotValue, IValuesChange, PivotDimensionType, IPivotUISettings } from '../pivot-grid/pivot-grid.interface';
3939
import { IDataCloneStrategy } from '../../data-operations/data-clone-strategy';
4040
import { FormControl, FormGroup, ValidationErrors } from '@angular/forms';
4141
import { IgxGridValidationService } from '../grid/grid-validation.service';
@@ -1233,7 +1233,7 @@ export interface PivotGridType extends GridType {
12331233
*/
12341234
allDimensions: IPivotDimension[],
12351235
/** Specifies whether to show the pivot configuration UI in the grid. */
1236-
showPivotConfigurationUI: boolean;
1236+
pivotUI: IPivotUISettings;
12371237
/** @hidden @internal */
12381238
columnDimensions: IPivotDimension[];
12391239
/** @hidden @internal */
@@ -1276,12 +1276,15 @@ export interface PivotGridType extends GridType {
12761276
dimensionsChange: EventEmitter<IDimensionsChange>;
12771277
/** Emits an event when the values in the pivot grid change. */
12781278
valuesChange: EventEmitter<IValuesChange>;
1279+
/** Emits an event when the a dimension is sorted. */
1280+
dimensionsSortingExpressionsChange: EventEmitter<ISortingExpression[]>;
12791281
/** @hidden @internal */
12801282
pivotKeys: IPivotKeys;
12811283
hasMultipleValues: boolean;
12821284
excelStyleFilterMaxHeight: string;
12831285
excelStyleFilterMinHeight: string;
12841286
valueChipTemplate: TemplateRef<any>;
1287+
rowDimensionHeaderTemplate: TemplateRef<IgxColumnTemplateContext>;
12851288
}
12861289

12871290
export interface GridSVGIcon {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<ng-container *ngIf="!column.columnGroup">
1919
<div class="igx-grid-th__icons">
2020
<ng-container *ngIf="column.sortable && !disabled">
21-
<div class="sort-icon"
21+
<div #sortIconContainer class="sort-icon"
2222
[attr.data-sortIndex]="(grid.sortingOptions.mode === 'single' && grid.sortingExpressions.length <=1) ? null : column.field | sortingIndex:grid.sortingExpressions"
2323
(pointerdown)="onPointerDownIndicator($event)" (click)="onSortingIconClick($event)">
2424
<ng-container *ngTemplateOutlet="sortIconTemplate; context: { $implicit: this }"></ng-container>

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ export class IgxGridHeaderComponent implements DoCheck, OnDestroy {
5353
@ViewChild('defaultSortHeaderIconTemplate', { read: TemplateRef, static: true })
5454
protected defaultSortHeaderIconTemplate;
5555

56+
/**
57+
* @hidden
58+
*/
59+
@ViewChild('sortIconContainer', { read: ElementRef })
60+
protected sortIconContainer: ElementRef;
61+
5662
/**
5763
* Returns the `aria-selected` of the header.
5864
*/
@@ -194,7 +200,7 @@ export class IgxGridHeaderComponent implements DoCheck, OnDestroy {
194200
}
195201

196202
public sortDirection = SortingDirection.None;
197-
private _destroy$ = new Subject<boolean>();
203+
protected _destroy$ = new Subject<boolean>();
198204

199205
constructor(
200206
@Inject(IGX_GRID_BASE) public grid: GridType,

projects/igniteui-angular/src/lib/grids/pivot-grid/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Below is the list of all inputs that are specific to the pivot-grid look/behavio
7979
|Name|Type|Description|
8080
|--- |--- |--- |
8181
|`pivotConfiguration`|IPivotConfiguration|Gets/Sets the pivot configuration with all related dimensions and values.|
82-
|`showPivotConfigurationUI`|boolean|Gets/Sets the pivot configuration ui for the pivot grid - chips and their corresponding containers for row, filter, column dimensions and values|
82+
|`pivotUI`|IPivotUISettings|Gets/Sets whether to show the ui for the pivot grid configuration - chips and their corresponding containers for row, filter, column dimensions and values. Also enables/disabled row dimension headers.|
8383
|`defaultExpandState`| boolean | Gets/Sets the default expand state for all rows. |
8484

8585
Note that the pivot-grid extends base igx-grid, so most of the @Input properties make sense and work in the pivot-grid as well. Keep in mind that due to some specifics, not all grid features and @Input properties will work.

0 commit comments

Comments
 (0)