Skip to content

Commit 177bb28

Browse files
authored
Merge branch 'master' into simeonoff/merge-sassdocs
2 parents f07ab82 + d7a0e52 commit 177bb28

25 files changed

+1980
-51
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ All notable changes for each version of this project will be documented in this
77
### New Features
88
- `igxGrid` - exposing new Input properties:
99

10+
- Parameters in grid templates now have types for their context. This can also cause issues if the app is in strict template mode and uses the wrong type. References to the template that may require conversion:
11+
* - `IgxColumnComponent` - `ColumnType` (for example the column parameter in `igxFilterCellTemplate`)
12+
* - `IgxGridCell` - `CellType` (for example the cell parameter in `igxCell` template)
13+
1014
- `excelStyleHeaderIconTemplate` - Gets/Sets the excel style header icon.
1115
- `groupRowTemplate` - Gets/Sets the template reference for the group row.
1216
- `headSelectorTemplate` - Gets/Sets the header row selector template.
@@ -26,6 +30,10 @@ All notable changes for each version of this project will be documented in this
2630
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
2731
- **Behavioral Change** - When editing a row, `rowChangesCount` and `hiddenColumnsCount`would be displayed.
2832

33+
- `IgxExcelExporterService`
34+
- Added support for exporting grid summaries.
35+
- Columns of type `currency` will be formatted as currency in Excel based on grid's locale. Locale currency different than `USD`, `EUR`, `GBP`, `CNY` or `JPY` will result in exporting the column as number instead.
36+
2937
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`, `IgxPivotGrid`
3038
- Adding `Image` column data type
3139

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ export interface ColumnType extends FieldType {
222222
getGridTemplate(isRow: boolean): string;
223223
toggleVisibility(value?: boolean): void;
224224
populateVisibleIndexes?(): void;
225+
pin(index?: number): boolean;
226+
unpin(index?: number): boolean;
225227
}
226228

227229
export interface IGridFormGroupCreatedEventArgs {

projects/igniteui-angular/src/lib/grids/public_api.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ export * from './grid-base.directive';
1313
export * from './grid.common';
1414
export * from './grid-public-row';
1515
export * from './grid-public-cell';
16-
export { CellType, RowType, IGX_GRID_BASE, ValidationStatus, IGridFormGroupCreatedEventArgs, IGridValidationState, IGridValidationStatusEventArgs, IRecordValidationState, IFieldValidationState } from './common/grid.interface';
16+
export {
17+
CellType, RowType, IGX_GRID_BASE, ValidationStatus, IGridFormGroupCreatedEventArgs, IGridValidationState, IGridValidationStatusEventArgs, IRecordValidationState, IFieldValidationState, ColumnType,
18+
IgxGridMasterDetailContext, IgxGroupByRowTemplateContext, IgxGridTemplateContext, IgxGridRowTemplateContext, IgxGridRowDragGhostContext, IgxGridEmptyTemplateContext, IgxGridRowEditTemplateContext,
19+
IgxGridRowEditTextTemplateContext, IgxGridRowEditActionsTemplateContext, IgxGridHeaderTemplateContext, IgxColumnTemplateContext, IgxCellTemplateContext, IgxGroupByRowSelectorTemplateContext,
20+
IgxHeadSelectorTemplateContext, IgxSummaryTemplateContext
21+
} from './common/grid.interface';
1722
export * from './summaries/grid-summary';
1823
export * from './grid-common.module';
1924
export * from './grid.rowEdit.directive';

projects/igniteui-angular/src/lib/services/excel/excel-exporter-grid.spec.ts

Lines changed: 102 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ import {
1818
MultiColumnHeadersExportComponent,
1919
GridWithEmptyColumnsComponent,
2020
ColumnsAddedOnInitComponent,
21-
GridWithThreeLevelsOfMultiColumnHeadersAndTwoRowsExportComponent
21+
GridWithThreeLevelsOfMultiColumnHeadersAndTwoRowsExportComponent,
22+
GroupedGridWithSummariesComponent,
23+
GridCurrencySummariesComponent
2224
} from '../../test-utils/grid-samples.spec';
2325
import { SampleTestData } from '../../test-utils/sample-test-data.spec';
2426
import { first } from 'rxjs/operators';
2527
import { DefaultSortingStrategy, SortingDirection } from '../../data-operations/sorting-strategy';
2628
import { IgxStringFilteringOperand } from '../../data-operations/filtering-condition';
2729
import { configureTestSuite } from '../../test-utils/configure-suite';
28-
import { IgxTreeGridPrimaryForeignKeyComponent } from '../../test-utils/tree-grid-components.spec';
30+
import { IgxTreeGridPrimaryForeignKeyComponent, IgxTreeGridSummariesKeyComponent } from '../../test-utils/tree-grid-components.spec';
2931
import { IgxTreeGridModule, IgxTreeGridComponent } from '../../grids/tree-grid/public_api';
3032
import { IgxNumberFilteringOperand } from '../../data-operations/filtering-condition';
3133
import { UIInteractions, wait } from '../../test-utils/ui-interactions.spec';
@@ -34,7 +36,8 @@ import { FilteringExpressionsTree } from '../../data-operations/filtering-expres
3436
import { FilteringLogic } from '../../data-operations/filtering-expression.interface';
3537
import { IgxHierarchicalGridExportComponent,
3638
IgxHierarchicalGridMultiColumnHeaderIslandsExportComponent,
37-
IgxHierarchicalGridMultiColumnHeadersExportComponent
39+
IgxHierarchicalGridMultiColumnHeadersExportComponent,
40+
IgxHierarchicalGridSummariesExportComponent
3841
} from '../../test-utils/hierarchical-grid-components.spec';
3942
import { IgxHierarchicalGridModule,
4043
IgxHierarchicalGridComponent,
@@ -68,7 +71,11 @@ describe('Excel Exporter', () => {
6871
IgxHierarchicalGridMultiColumnHeaderIslandsExportComponent,
6972
GridWithThreeLevelsOfMultiColumnHeadersAndTwoRowsExportComponent,
7073
IgxPivotGridMultipleRowComponent,
71-
IgxPivotGridTestComplexHierarchyComponent
74+
IgxPivotGridTestComplexHierarchyComponent,
75+
IgxTreeGridSummariesKeyComponent,
76+
IgxHierarchicalGridSummariesExportComponent,
77+
GroupedGridWithSummariesComponent,
78+
GridCurrencySummariesComponent
7279
],
7380
imports: [IgxGridModule, IgxTreeGridModule, IgxHierarchicalGridModule, IgxPivotGridModule, NoopAnimationsModule]
7481
}).compileComponents();
@@ -1211,6 +1218,97 @@ describe('Excel Exporter', () => {
12111218
});
12121219
});
12131220

1221+
1222+
describe('', () => {
1223+
let fix;
1224+
let grid: any;
1225+
1226+
beforeEach(waitForAsync(() => {
1227+
options = createExportOptions('GirdSummariesExcelExport', 50);
1228+
}));
1229+
1230+
it('should export grid with summaries based on summaryCalculationMode', async () => {
1231+
fix = TestBed.createComponent(GroupedGridWithSummariesComponent);
1232+
fix.detectChanges();
1233+
await wait(300);
1234+
1235+
grid = fix.componentInstance.grid;
1236+
grid.summaryCalculationMode = 'rootLevelOnly';
1237+
1238+
await exportAndVerify(grid, options, actualData.exportGridWithSummaries);
1239+
1240+
(grid as IgxGridComponent).groupBy({ fieldName: 'Shipped', dir: SortingDirection.Asc, ignoreCase: false });
1241+
(grid as IgxGridComponent).groupBy({ fieldName: 'City', dir: SortingDirection.Asc, ignoreCase: false });
1242+
(grid as IgxGridComponent).groupBy({ fieldName: 'ContactTitle', dir: SortingDirection.Asc, ignoreCase: false });
1243+
1244+
fix.detectChanges();
1245+
1246+
await exportAndVerify(grid, options, actualData.exportGroupedGridWithSummariesRootLevelOnly);
1247+
1248+
grid.summaryCalculationMode = 'childLevelsOnly';
1249+
fix.detectChanges();
1250+
1251+
await exportAndVerify(grid, options, actualData.exportGroupedGridWithSummariesChildLevelsOnly);
1252+
1253+
grid.summaryCalculationMode = 'rootAndChildLevels';
1254+
fix.detectChanges();
1255+
1256+
await exportAndVerify(grid, options, actualData.exportGroupedGridWithSummariesRootAndChildLevels);
1257+
});
1258+
1259+
it('should export tree grid with summaries', async () => {
1260+
fix = TestBed.createComponent(IgxTreeGridSummariesKeyComponent);
1261+
fix.detectChanges();
1262+
await wait(300);
1263+
grid = fix.componentInstance.treeGrid;
1264+
1265+
grid.toggleRow(grid.getRowByIndex(2).key);
1266+
grid.toggleRow(grid.getRowByIndex(0).key);
1267+
grid.toggleRow(grid.getRowByIndex(3).key);
1268+
fix.detectChanges();
1269+
1270+
await exportAndVerify(grid, options, actualData.exportTreeGridWithSummaries);
1271+
});
1272+
1273+
it('should export hierarchical grid with summaries', async () => {
1274+
fix = TestBed.createComponent(IgxHierarchicalGridSummariesExportComponent);
1275+
fix.detectChanges();
1276+
await wait(300);
1277+
grid = fix.componentInstance.hGrid;
1278+
1279+
const firstRow = grid.gridAPI.get_row_by_index(0) as IgxHierarchicalRowComponent;
1280+
const secondRow = grid.gridAPI.get_row_by_index(1) as IgxHierarchicalRowComponent;
1281+
1282+
UIInteractions.simulateClickAndSelectEvent(firstRow.expander);
1283+
fix.detectChanges();
1284+
expect(firstRow.expanded).toBe(true);
1285+
1286+
let childGrids = grid.gridAPI.getChildGrids(false);
1287+
1288+
const firstChildGrid = childGrids[0];
1289+
const firstChildRow = firstChildGrid.gridAPI.get_row_by_index(0) as IgxHierarchicalRowComponent;
1290+
1291+
UIInteractions.simulateClickAndSelectEvent(firstChildRow.expander);
1292+
fix.detectChanges();
1293+
expect(firstChildRow.expanded).toBe(true);
1294+
1295+
UIInteractions.simulateClickAndSelectEvent(secondRow.expander);
1296+
fix.detectChanges();
1297+
expect(secondRow.expanded).toBe(true);
1298+
1299+
childGrids = grid.gridAPI.getChildGrids(false);
1300+
1301+
const thirdChildGrid = childGrids[1];
1302+
const thirdChildRow = thirdChildGrid.gridAPI.get_row_by_index(0) as IgxHierarchicalRowComponent;
1303+
1304+
UIInteractions.simulateClickAndSelectEvent(thirdChildRow.expander);
1305+
fix.detectChanges();
1306+
expect(thirdChildRow.expanded).toBe(true);
1307+
1308+
await exportAndVerify(grid, options, actualData.exportHierarchicalGridWithSummaries);
1309+
});
1310+
});
1311+
12141312
describe('', () => {
12151313
let fix;
12161314
let grid: IgxPivotGridComponent;

projects/igniteui-angular/src/lib/services/excel/excel-exporter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ExcelElementsFactory } from './excel-elements-factory';
55
import { ExcelFolderTypes } from './excel-enums';
66
import { IgxExcelExporterOptions } from './excel-exporter-options';
77
import { IExcelFolder } from './excel-interfaces';
8-
import { ExportRecordType, IExportRecord, IgxBaseExporter, DEFAULT_OWNER, HeaderType } from '../exporter-common/base-export-service';
8+
import { ExportRecordType, IExportRecord, IgxBaseExporter, DEFAULT_OWNER, HeaderType, GRID_LEVEL_COL } from '../exporter-common/base-export-service';
99
import { ExportUtilities } from '../exporter-common/export-utilities';
1010
import { WorksheetData } from './worksheet-data';
1111
import { IBaseEventArgs } from '../../core/utils';
@@ -114,7 +114,7 @@ export class IgxExcelExporterService extends IgxBaseExporter {
114114
defaultOwner = this._ownersMap.get(firstDataElement.owner);
115115
} else {
116116
defaultOwner = this._ownersMap.get(DEFAULT_OWNER);
117-
const columns = defaultOwner.columns.filter(col => !col.skip && col.headerType === HeaderType.ColumnHeader);
117+
const columns = defaultOwner.columns.filter(col => col.field !== GRID_LEVEL_COL && !col.skip && col.headerType === HeaderType.ColumnHeader);
118118

119119
columnWidths = defaultOwner.columnWidths;
120120
indexOfLastPinnedColumn = defaultOwner.indexOfLastPinnedColumn;
@@ -126,7 +126,7 @@ export class IgxExcelExporterService extends IgxBaseExporter {
126126

127127
defaultOwner = this._ownersMap.get(ownersKeys[0]);
128128
columnWidths = defaultOwner.columnWidths;
129-
columnCount = defaultOwner.columns.filter(col => !col.skip && col.headerType === HeaderType.ColumnHeader).length;
129+
columnCount = defaultOwner.columns.filter(col => col.field !== GRID_LEVEL_COL && !col.skip && col.headerType === HeaderType.ColumnHeader).length;
130130
}
131131

132132
const worksheetData =

0 commit comments

Comments
 (0)