cdk-table-exporter
Advanced tools
Comparing version 0.0.5 to 0.0.6
{ | ||
"name": "cdk-table-exporter", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"author": "Halit Talha Türe", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -1,6 +0,9 @@ | ||
[](https://github.com/dwyl/goodparts "JavaScript The Good Parts") [](https://www.npmjs.com/package/cdk-table-exporter) | ||
# Angular Table Exporter (CdkTable Exporter) | ||
[](https://github.com/dwyl/goodparts "JavaScript The Good Parts") [](https://www.npmjs.com/package/cdk-table-exporter)  | ||
This project is mainly for making CdkTable components exportable as excel files. cdk-table-exporter facilitates the common functionalities for CdkTable implementations abstracting the behavior that can change among different CdkTable implementations, see [mat-table-exporter](https://www.npmjs.com/package/mat-table-exporter) for angular material table export. | ||
# CdkTable Table Exporter | ||
**!! If you are using angular material please use** [mat-table-exporter](https://www.npmjs.com/package/mat-table-exporter) | ||
This project facilitates the common functionalities for CdkTable implementations abstracting the behavior that can change among different CdkTable implementations, see [mat-table-exporter](https://www.npmjs.com/package/mat-table-exporter) for angular material table export. | ||
## Getting Started | ||
@@ -15,41 +18,13 @@ | ||
You can find more detail under the corresponding title of Usage section | ||
## Usage | ||
CdkTableExporter class defines the common functionality that an exporter directive should have. | ||
By extending it an implementing the abstract methods you will have an exporter of your own. | ||
Thus the usage is simply as follows: | ||
1- Generate a directive class | ||
2- Extend CdkTableExporter class implement the abstract methods | ||
Will be updated soon | ||
## API | ||
### CdkTableExporter | ||
| Input/Output | Property | Type | Description | | ||
| --- | --- | --- | --- | | ||
| `@Input` | cdkTable | `any` | Template-referance of CdkTable that's to be exported | | ||
| `@Input` | exporterButton | `any` | Template-referance of the button that's used to trigger the export | | ||
| `@Input` | sheetName | `string` | Template-referance of CdkTable that's to be exported | | ||
| `@Input` | fileName | `string` | Template-referance of CdkTable that's to be exported | | ||
| `@Input` | hiddenColumns | `Array<number>` | The indexes of the columns that are not wanted in the excel file | | ||
| `@Output` | exportStarted | `EventEmitter<void>` | Event that's fired when the export started | | ||
| `@Output` | exportCompleted | `EventEmitter<void>` | Event that's fired when the export completed | | ||
### JsonExporterService | ||
JsonExporterService is published in cdk-table-exporter project. CdkTableExporter employs this service, hence through inheritance MatTableExporterDirective does too. | ||
#### exportExcel Method | ||
Exports excel file by employing xlsx sheetjs | ||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| header | `any` | Any json object that holds the header information of the exported excel file aka the first row of the excel | | ||
| rows | `Array<any>` | Any json array that will be the rows of the exported excel | | ||
| fileName | `string` | Exported excel file's name | | ||
| sheetName | `string` | The name of the sheet that keeps the exported data | | ||
| hiddenColumns | `Array<string>` | Properties that are wanted to be hidden, i.e. id, createdDate, auditable properties etc. | | ||
## Licence | ||
Apache-2.0 |
185251
30