Skip to content

Commit a3674b8

Browse files
committed
feat(elements): Add excel and csv exporters to elements.
1 parent 141ca8c commit a3674b8

File tree

12 files changed

+48
-6
lines changed

12 files changed

+48
-6
lines changed

projects/igniteui-angular-elements/src/analyzer/elements.config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ export var registerConfig = [
262262
{ name: "pinnedColumnsCount" },
263263
{ name: "transactions" },
264264
{ name: "lastSearchInfo" },
265+
{ name: "type" },
265266
{ name: "filteredData" },
266267
{ name: "filteredSortedData" },
267268
{ name: "validation" },
@@ -549,6 +550,7 @@ export var registerConfig = [
549550
additionalProperties: [
550551
{ name: "foreignKey" },
551552
{ name: "selectedCells" },
553+
{ name: "type" },
552554
{ name: "gridAPI", writable: true },
553555
{ name: "navigation", writable: true },
554556
{ name: "shouldGenerate", writable: true },
@@ -733,8 +735,10 @@ export var registerConfig = [
733735
],
734736
additionalProperties: [
735737
{ name: "dimensionsSortingExpressions" },
738+
{ name: "type" },
736739
{ name: "navigation", writable: true },
737740
{ name: "allDimensions" },
741+
{ name: "visibleRowDimensions", writable: true },
738742
{ name: "rowList" },
739743
{ name: "dataRowList" },
740744
{ name: "lastSearchInfo" },
@@ -860,6 +864,7 @@ export var registerConfig = [
860864
],
861865
additionalProperties: [
862866
{ name: "rowIslandAPI", writable: true },
867+
{ name: "type" },
863868
{ name: "gridAPI", writable: true },
864869
{ name: "navigation", writable: true },
865870
{ name: "shouldGenerate", writable: true },

projects/igniteui-angular-elements/src/analyzer/utils.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ export function isMethod(symbol: ts.Symbol): boolean {
7171
}
7272

7373
export function isPublic(symbol: ts.Symbol) {
74-
const tags = new Set(['hidden', 'internal']);
74+
const nonPublicTags = new Set(['hidden', 'internal']);
75+
const elementsShowTags = new Set(['exportElements']);
7576
if (!(symbol && symbol.valueDeclaration)) return false;
7677
if ((ts.getCombinedModifierFlags(symbol.valueDeclaration) & ts.ModifierFlags.Public) !== ts.ModifierFlags.None) {
77-
return !symbol.getJsDocTags().some(({ name }) => tags.has(name));
78+
return !symbol.getJsDocTags().some(({ name }) => nonPublicTags.has(name)) || symbol.getJsDocTags().some(({ name }) => elementsShowTags.has(name));
7879
}
7980
return false;
8081
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { IgxCsvExporterOptions, IgxCsvExporterService } from 'igniteui-angular';
2+
import { IgcNgElement } from '../app/custom-strategy';
3+
4+
export class IgcCsvExporterService extends IgxCsvExporterService {
5+
public override export(grid: any, options: IgxCsvExporterOptions): void {
6+
const elementGrid = grid as IgcNgElement;
7+
const gridRef = (elementGrid.ngElementStrategy as any)?.componentRef?.instance;
8+
super.export(gridRef, options);
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { IgxExcelExporterOptions, IgxExcelExporterService } from 'igniteui-angular';
2+
import { IgcNgElement } from '../app/custom-strategy';
3+
4+
export class IgcExcelExporterService extends IgxExcelExporterService {
5+
public override export(grid: any, options: IgxExcelExporterOptions): void {
6+
const elementGrid = grid as IgcNgElement;
7+
const gridRef = (elementGrid.ngElementStrategy as any)?.componentRef?.instance;
8+
super.export(gridRef, options);
9+
}
10+
}

projects/igniteui-angular-elements/src/public_api.ts

+10
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import { IgxPivotDateDimension } from 'projects/igniteui-angular/src/lib/grids/p
1212
import { PivotDimensionType } from 'projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.interface';
1313
import { IgxDateSummaryOperand, IgxNumberSummaryOperand, IgxSummaryOperand, IgxTimeSummaryOperand } from 'projects/igniteui-angular/src/lib/grids/summaries/grid-summary';
1414
import { HorizontalAlignment, VerticalAlignment } from 'projects/igniteui-angular/src/lib/services/overlay/utilities';
15+
import { IgxExcelExporterOptions } from 'igniteui-angular/src/lib/services/excel/excel-exporter-options';
16+
import { CsvFileTypes, IgxCsvExporterOptions } from 'igniteui-angular/src/lib/services/csv/csv-exporter-options';
17+
import { IgcExcelExporterService } from './lib/excel-exporter';
18+
import { IgcCsvExporterService } from './lib/csv-exporter';
1519

1620

1721
/** Export Public API, TODO: reorganize, Generate all w/ renames? */
@@ -54,4 +58,10 @@ export {
5458
// overlay position settings (used in grids, paginator, toolbar)
5559
HorizontalAlignment,
5660
VerticalAlignment,
61+
62+
IgxExcelExporterOptions as IgcExcelExporterOptions,
63+
IgxCsvExporterOptions as IgcCsvExporterOptions,
64+
IgcExcelExporterService,
65+
IgcCsvExporterService,
66+
CsvFileTypes
5767
}

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3036,7 +3036,7 @@ export abstract class IgxGridBaseDirective implements GridType,
30363036
*/
30373037
public EMPTY_DATA = [];
30383038

3039-
/** @hidden @internal */
3039+
/** @hidden @internal @exportElements */
30403040
public get type(): GridType["type"] {
30413041
return 'flat';
30423042
}

projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid-base.directive.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export abstract class IgxHierarchicalGridBaseDirective extends IgxGridBaseDirect
9292
@Output()
9393
public dataPreLoad = new EventEmitter<IForOfState>();
9494

95-
/** @hidden @internal */
95+
/** @hidden @internal @exportElements */
9696
public override get type(): GridType["type"] {
9797
return 'hierarchical';
9898
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
649649
public get pivotKeys() {
650650
return this.pivotConfiguration.pivotKeys || DEFAULT_PIVOT_KEYS;
651651
}
652-
/** @hidden @internal */
652+
/** @hidden @internal @exportElements */
653653
public override get type(): GridType["type"] {
654654
return 'pivot';
655655
}
@@ -1315,7 +1315,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
13151315
return this.pivotConfiguration.rows?.filter(x => x.enabled) || [];
13161316
}
13171317

1318-
/** @hidden @internal */
1318+
/** @hidden @internal @exportElements */
13191319
public set visibleRowDimensions(value: IPivotDimension[]) {
13201320
this._visibleRowDimensions = value;
13211321
}

projects/igniteui-angular/src/lib/services/csv/csv-exporter-options.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { IgxExporterOptionsBase } from '../exporter-common/exporter-options-base';
22

3+
/* csSuppress */
34
/**
45
* Objects of this class are used to configure the CSV exporting process.
56
*/

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

+2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ import { CharSeparatedValueData } from './char-separated-value-data';
55
import { CsvFileTypes, IgxCsvExporterOptions } from './csv-exporter-options';
66
import { IBaseEventArgs } from '../../core/utils';
77

8+
/* csSuppress */
89
export interface ICsvExportEndedEventArgs extends IBaseEventArgs {
910
csvData?: string;
1011
}
1112

13+
/* csSuppress */
1214
/**
1315
* **Ignite UI for Angular CSV Exporter Service** -
1416
* [Documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/exporter-csv)

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

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { IgxExporterOptionsBase } from '../exporter-common/exporter-options-base';
22

3+
/* csSuppress */
34
/**
45
* Objects of this class are used to configure the Excel exporting process.
56
*/

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

+2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ import { WorksheetData } from './worksheet-data';
1111
import { IBaseEventArgs } from '../../core/utils';
1212
import { WorksheetFile } from './excel-files';
1313

14+
/* csSuppress */
1415
export interface IExcelExportEndedEventArgs extends IBaseEventArgs {
1516
xlsx?: Object
1617
}
1718

1819
const EXCEL_MAX_ROWS = 1048576;
1920
const EXCEL_MAX_COLS = 16384;
2021

22+
/* csSuppress */
2123
/**
2224
* **Ignite UI for Angular Excel Exporter Service** -
2325
* [Documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/exporter_excel.html)

0 commit comments

Comments
 (0)