Skip to content

Commit e44e2ce

Browse files
authored
Merge pull request #7069 from IgniteUI/revert-6972-mkirova/row-pinning-export-to-excel
Revert "Row pinning + export to excel"
2 parents 7825bcd + d4fc0de commit e44e2ce

File tree

7 files changed

+8
-66
lines changed

7 files changed

+8
-66
lines changed

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,17 +214,6 @@ describe('Excel Exporter', () => {
214214
await wrapper.verifyDataFilesContent(actualData.gridJobTitleIdFrozen, 'Not all pinned columns are frozen in the export!');
215215
});
216216

217-
it('should honor all pinned rows.', async() => {
218-
const result = await TestMethods.createGridAndPinRow(0, 2);
219-
const fix = result.fixture;
220-
const grid = result.grid;
221-
222-
const wrapper = await getExportedData(grid, options);
223-
wrapper.verifyStructure();
224-
await wrapper.verifyPinRowData('<pane ySplit="3" topLeftCell="A4" activePane="topRight" state="frozen"/>',
225-
'Not all pinned rows are frozen in the export!');
226-
});
227-
228217
it('should honor applied sorting.', async () => {
229218
const fix = TestBed.createComponent(GridIDNameJobTitleComponent);
230219
fix.detectChanges();

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ export class IgxExcelExporterService extends IgxBaseExporter {
7777
}
7878
}
7979

80-
const worksheetData = new WorksheetData(data, options, this._indexOfLastPinnedColumn,
81-
this._indexOfLastPinnedRow, this._sort, this._isTreeGrid);
80+
const worksheetData = new WorksheetData(data, options, this._indexOfLastPinnedColumn, this._sort, this._isTreeGrid);
8281
this._xlsx = new JSZip();
8382

8483
const rootFolder = ExcelElementsFactory.getExcelFolder(ExcelFolderTypes.RootExcelFolder);

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

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -116,23 +116,12 @@ export class WorksheetFile implements IExcelFile {
116116

117117
cols.push('</cols>');
118118

119-
const hasFrozenElements = !worksheetData.options.ignorePinning &&
120-
(worksheetData.indexOfLastPinnedColumn !== -1 || worksheetData.indexOfLastPinnedRow !== -1);
121-
122-
if (hasFrozenElements) {
123-
const hasFrozenCols = !worksheetData.options.ignoreColumnsOrder && worksheetData.indexOfLastPinnedColumn !== -1;
124-
const hasFrozenRows = worksheetData.indexOfLastPinnedRow !== -1;
125-
126-
const frozenColumnCount = hasFrozenCols ? worksheetData.indexOfLastPinnedColumn + 1 : null;
127-
const frozenRowCount = hasFrozenRows ? worksheetData.indexOfLastPinnedRow + 2 : null;
128-
129-
const frozenColumn = !hasFrozenCols ? 'A' : ExcelStrings.getExcelColumn(frozenColumnCount);
130-
const firstCell = frozenColumn + (frozenRowCount + 1);
131-
132-
const xSplit = hasFrozenCols ? `xSplit="${frozenColumnCount}" ` : '';
133-
const ySplit = hasFrozenRows ? `ySplit="${frozenRowCount}" ` : '';
134-
const xySplit = (xSplit + ySplit).trim();
135-
freezePane = `<pane ${xySplit} topLeftCell="${firstCell}" activePane="topRight" state="frozen"/>`;
119+
if (worksheetData.indexOfLastPinnedColumn !== -1 &&
120+
!worksheetData.options.ignorePinning &&
121+
!worksheetData.options.ignoreColumnsOrder) {
122+
const frozenColumnCount = worksheetData.indexOfLastPinnedColumn + 1;
123+
const firstCell = ExcelStrings.getExcelColumn(frozenColumnCount) + '1';
124+
freezePane = `<pane xSplit="${frozenColumnCount}" topLeftCell="${firstCell}" activePane="topRight" state="frozen"/>`;
136125
}
137126
}
138127
const hasTable = !worksheetData.isEmpty && worksheetData.options.exportAsTable;

projects/igniteui-angular/src/lib/services/excel/jszip-verification-wrapper.spec.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,6 @@ export class JSZipWrapper {
141141
});
142142
}
143143

144-
public async verifyPinRowData(pinData: string, message = '') {
145-
let result;
146-
await this.readDataFiles().then(() => {
147-
result = this.dataFilesContent[1];
148-
expect(result.fileContent.indexOf(pinData) !== -1).toBeTruthy(message);
149-
});
150-
}
151-
152144
/* Verifies the contents of all files and asserts the result.
153145
Optionally, a message can be passed in, which, if specified, will be shown in the beginning of the comparison result. */
154146
public async verifyFilesContent(expectedData: IFileContent[], message = '') {

projects/igniteui-angular/src/lib/services/excel/worksheet-data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class WorksheetData {
1111
private _isSpecialData: boolean;
1212

1313
constructor(private _data: any[], public options: IgxExcelExporterOptions, public indexOfLastPinnedColumn,
14-
public indexOfLastPinnedRow, public sort: any, public isTreeGridData = false) {
14+
public sort: any, public isTreeGridData = false) {
1515
this.initializeData();
1616
}
1717

projects/igniteui-angular/src/lib/services/exporter-common/base-export-service.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ export abstract class IgxBaseExporter {
7272

7373
protected _isTreeGrid = false;
7474
protected _indexOfLastPinnedColumn = -1;
75-
protected _indexOfLastPinnedRow = -1;
7675
protected _sort = null;
7776

7877
/**
@@ -290,14 +289,6 @@ export abstract class IgxBaseExporter {
290289
}
291290
}
292291

293-
if (grid.hasPinnedRecords) {
294-
295-
const pinnedRecs = data.filter(x => grid.isRecordPinned(x));
296-
const unpinnedRecs = data.filter(x => !grid.isRecordPinned(x));
297-
data = [ ...pinnedRecs, ... unpinnedRecs];
298-
this._indexOfLastPinnedRow = pinnedRecs.length - 1;
299-
}
300-
301292
return data;
302293
}
303294

@@ -316,7 +307,6 @@ export abstract class IgxBaseExporter {
316307
private resetDefaults() {
317308
this._columnList = [];
318309
this._indexOfLastPinnedColumn = -1;
319-
this._indexOfLastPinnedRow = -1;
320310
this._sort = null;
321311
this.flatRecords = [];
322312
}

projects/igniteui-angular/src/lib/services/exporter-common/test-methods.spec.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,4 @@ export class TestMethods {
5050
return { fixture: fix, grid: myGrid };
5151
}
5252

53-
54-
/* Creates an instance of GridDeclarationComponent and pins the rows with the specified indices. */
55-
public static async createGridAndPinRow(...rowIndices: any[]) {
56-
const fix = TestBed.createComponent(GridIDNameJobTitleComponent);
57-
fix.detectChanges();
58-
await wait(16);
59-
60-
const myGrid = fix.componentInstance.grid;
61-
62-
// Pin columns
63-
rowIndices.forEach((i) => {
64-
myGrid.getRowByIndex(i).pin();
65-
});
66-
67-
return { fixture: fix, grid: myGrid };
68-
}
69-
7053
}

0 commit comments

Comments
 (0)