Skip to content

feat(elements): Add excel and csv exporters to elements. #15611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 19.2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ export var registerConfig = [
{ name: "pinnedColumnsCount" },
{ name: "transactions" },
{ name: "lastSearchInfo" },
{ name: "type" },
{ name: "filteredData" },
{ name: "filteredSortedData" },
{ name: "validation" },
Expand Down Expand Up @@ -549,6 +550,7 @@ export var registerConfig = [
additionalProperties: [
{ name: "foreignKey" },
{ name: "selectedCells" },
{ name: "type" },
{ name: "gridAPI", writable: true },
{ name: "navigation", writable: true },
{ name: "shouldGenerate", writable: true },
Expand Down Expand Up @@ -733,8 +735,10 @@ export var registerConfig = [
],
additionalProperties: [
{ name: "dimensionsSortingExpressions" },
{ name: "type" },
{ name: "navigation", writable: true },
{ name: "allDimensions" },
{ name: "visibleRowDimensions", writable: true },
{ name: "rowList" },
{ name: "dataRowList" },
{ name: "lastSearchInfo" },
Expand Down Expand Up @@ -860,6 +864,7 @@ export var registerConfig = [
],
additionalProperties: [
{ name: "rowIslandAPI", writable: true },
{ name: "type" },
{ name: "gridAPI", writable: true },
{ name: "navigation", writable: true },
{ name: "shouldGenerate", writable: true },
Expand Down
5 changes: 3 additions & 2 deletions projects/igniteui-angular-elements/src/analyzer/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ export function isMethod(symbol: ts.Symbol): boolean {
}

export function isPublic(symbol: ts.Symbol) {
const tags = new Set(['hidden', 'internal']);
const nonPublicTags = new Set(['hidden', 'internal']);
const elementsShowTags = new Set(['exportElements']);
if (!(symbol && symbol.valueDeclaration)) return false;
if ((ts.getCombinedModifierFlags(symbol.valueDeclaration) & ts.ModifierFlags.Public) !== ts.ModifierFlags.None) {
return !symbol.getJsDocTags().some(({ name }) => tags.has(name));
return !symbol.getJsDocTags().some(({ name }) => nonPublicTags.has(name)) || symbol.getJsDocTags().some(({ name }) => elementsShowTags.has(name));
}
return false;
}
Expand Down
10 changes: 10 additions & 0 deletions projects/igniteui-angular-elements/src/lib/csv-exporter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { IgxCsvExporterOptions, IgxCsvExporterService } from 'igniteui-angular';
import { IgcNgElement } from '../app/custom-strategy';

export class IgcCsvExporterService extends IgxCsvExporterService {
public override export(grid: any, options: IgxCsvExporterOptions): void {
const elementGrid = grid as IgcNgElement;
const gridRef = (elementGrid.ngElementStrategy as any)?.componentRef?.instance;
super.export(gridRef, options);
}
}
10 changes: 10 additions & 0 deletions projects/igniteui-angular-elements/src/lib/excel-exporter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { IgxExcelExporterOptions, IgxExcelExporterService } from 'igniteui-angular';
import { IgcNgElement } from '../app/custom-strategy';

export class IgcExcelExporterService extends IgxExcelExporterService {
public override export(grid: any, options: IgxExcelExporterOptions): void {
const elementGrid = grid as IgcNgElement;
const gridRef = (elementGrid.ngElementStrategy as any)?.componentRef?.instance;
super.export(gridRef, options);
}
}
10 changes: 10 additions & 0 deletions projects/igniteui-angular-elements/src/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import { IgxPivotDateDimension } from 'projects/igniteui-angular/src/lib/grids/p
import { PivotDimensionType } from 'projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.interface';
import { IgxDateSummaryOperand, IgxNumberSummaryOperand, IgxSummaryOperand, IgxTimeSummaryOperand } from 'projects/igniteui-angular/src/lib/grids/summaries/grid-summary';
import { HorizontalAlignment, VerticalAlignment } from 'projects/igniteui-angular/src/lib/services/overlay/utilities';
import { IgxExcelExporterOptions } from 'igniteui-angular/src/lib/services/excel/excel-exporter-options';
import { CsvFileTypes, IgxCsvExporterOptions } from 'igniteui-angular/src/lib/services/csv/csv-exporter-options';
import { IgcExcelExporterService } from './lib/excel-exporter';
import { IgcCsvExporterService } from './lib/csv-exporter';


/** Export Public API, TODO: reorganize, Generate all w/ renames? */
Expand Down Expand Up @@ -54,4 +58,10 @@ export {
// overlay position settings (used in grids, paginator, toolbar)
HorizontalAlignment,
VerticalAlignment,

IgxExcelExporterOptions as IgcExcelExporterOptions,
IgxCsvExporterOptions as IgcCsvExporterOptions,
IgcExcelExporterService,
IgcCsvExporterService,
CsvFileTypes
}
Original file line number Diff line number Diff line change
Expand Up @@ -3038,7 +3038,7 @@ export abstract class IgxGridBaseDirective implements GridType,
*/
public EMPTY_DATA = [];

/** @hidden @internal */
/** @hidden @internal @exportElements */
public get type(): GridType["type"] {
return 'flat';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export abstract class IgxHierarchicalGridBaseDirective extends IgxGridBaseDirect
@Output()
public dataPreLoad = new EventEmitter<IForOfState>();

/** @hidden @internal */
/** @hidden @internal @exportElements */
public override get type(): GridType["type"] {
return 'hierarchical';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
public get pivotKeys() {
return this.pivotConfiguration.pivotKeys || DEFAULT_PIVOT_KEYS;
}
/** @hidden @internal */
/** @hidden @internal @exportElements */
public override get type(): GridType["type"] {
return 'pivot';
}
Expand Down Expand Up @@ -1318,7 +1318,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
return this.pivotConfiguration.rows?.filter(x => x.enabled) || [];
}

/** @hidden @internal */
/** @hidden @internal @exportElements */
public set visibleRowDimensions(value: IPivotDimension[]) {
this._visibleRowDimensions = value;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IgxExporterOptionsBase } from '../exporter-common/exporter-options-base';

/* csSuppress */
/**
* Objects of this class are used to configure the CSV exporting process.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import { CharSeparatedValueData } from './char-separated-value-data';
import { CsvFileTypes, IgxCsvExporterOptions } from './csv-exporter-options';
import { IBaseEventArgs } from '../../core/utils';

/* csSuppress */
export interface ICsvExportEndedEventArgs extends IBaseEventArgs {
csvData?: string;
}

/* csSuppress */
/**
* **Ignite UI for Angular CSV Exporter Service** -
* [Documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/exporter-csv)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IgxExporterOptionsBase } from '../exporter-common/exporter-options-base';

/* csSuppress */
/**
* Objects of this class are used to configure the Excel exporting process.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ import { WorksheetData } from './worksheet-data';
import { IBaseEventArgs } from '../../core/utils';
import { WorksheetFile } from './excel-files';

/* csSuppress */
export interface IExcelExportEndedEventArgs extends IBaseEventArgs {
xlsx?: Object
}

const EXCEL_MAX_ROWS = 1048576;
const EXCEL_MAX_COLS = 16384;

/* csSuppress */
/**
* **Ignite UI for Angular Excel Exporter Service** -
* [Documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/exporter_excel.html)
Expand Down
Loading