Skip to content

Commit e4e1d07

Browse files
authored
Merge pull request #2 from rinturaj/release
Release
2 parents 045f842 + 5584935 commit e4e1d07

File tree

3 files changed

+58
-49
lines changed

3 files changed

+58
-49
lines changed

.github/workflows/npm-publish.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@ name: Publish to NPM
22

33
on:
44
push:
5-
branches: [release]
5+
branches: [master]
66
# Only trigger on changes to library files
77
paths:
8-
- 'projects/ngx-simple-datatable/**'
9-
- 'package.json'
10-
- 'ng-package.json'
11-
- 'tsconfig.lib.json'
8+
- "projects/**"
9+
- "package.json"
10+
- "ng-package.json"
11+
- "tsconfig.lib.json"
1212

1313
jobs:
1414
build-and-publish:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
18-
18+
1919
- name: Use Node.js
2020
uses: actions/setup-node@v4
2121
with:
22-
node-version: '20.x'
23-
registry-url: 'https://registry.npmjs.org'
24-
22+
node-version: "20.x"
23+
registry-url: "https://registry.npmjs.org"
24+
2525
- name: Install dependencies
2626
run: npm ci
27-
27+
2828
- name: Build library
2929
run: npm run build:lib
30-
30+
3131
- name: Publish to NPM
3232
run: |
3333
cd dist/ngx-simple-datatable

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
A lightweight, high-performance Angular data table component with features like virtual scrolling, column freezing, and customizable templates.
44

5+
## Demo [NgxSimpleDatatable](https://ngx-simple-datatable.stackblitz.io/)
6+
57
![NgxSimpleDatatable Screenshot](projects/ngx-simple-datatable/assets/image.png)
68

79
## Features

projects/ngx-simple-datatable/README.md

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# NgxSimpleDatatable
22

33
A lightweight, high-performance Angular data table component with features like virtual scrolling, column freezing, and customizable templates.
4+
.
45

56
## Features
67

@@ -23,33 +24,34 @@ npm install ngx-simple-datatable --save
2324
1. Import the module in your `app.module.ts`:
2425

2526
```typescript
26-
import { NgxSimpleDatatableModule } from 'ngx-simple-datatable';
27+
import { NgxSimpleDatatableModule } from "ngx-simple-datatable";
2728

2829
@NgModule({
2930
imports: [
3031
// ... other imports
31-
NgxSimpleDatatableModule
32-
]
32+
NgxSimpleDatatableModule,
33+
],
3334
})
34-
export class AppModule { }
35+
export class AppModule {}
3536
```
3637

3738
2. Use the component in your template:
3839

3940
```html
40-
<ngx-simple-datatable
41-
[columns]="columns"
41+
<ngx-simple-datatable
42+
[columns]="columns"
4243
[data]="data"
4344
[rowHeight]="40"
44-
[headerHeight]="50">
45+
[headerHeight]="50"
46+
>
4547
</ngx-simple-datatable>
4648
```
4749

4850
3. Define your columns and data in your component:
4951

5052
```typescript
51-
import { Component } from '@angular/core';
52-
import { ColumnConfig } from 'ngx-simple-datatable';
53+
import { Component } from "@angular/core";
54+
import { ColumnConfig } from "ngx-simple-datatable";
5355

5456
interface UserData {
5557
id: number;
@@ -59,21 +61,26 @@ interface UserData {
5961
}
6062

6163
@Component({
62-
selector: 'app-root',
63-
templateUrl: './app.component.html',
64-
styleUrls: ['./app.component.css']
64+
selector: "app-root",
65+
templateUrl: "./app.component.html",
66+
styleUrls: ["./app.component.css"],
6567
})
6668
export class AppComponent {
6769
columns: ColumnConfig[] = [
68-
{ field: 'id', header: 'ID', width: '80px', freeze: 'left' },
69-
{ field: 'name', header: 'Name', width: '200px', sortable: true },
70-
{ field: 'email', header: 'Email', width: '250px' },
71-
{ field: 'status', header: 'Status', width: '120px' }
70+
{ field: "id", header: "ID", width: "80px", freeze: "left" },
71+
{ field: "name", header: "Name", width: "200px", sortable: true },
72+
{ field: "email", header: "Email", width: "250px" },
73+
{ field: "status", header: "Status", width: "120px" },
7274
];
7375

7476
data: UserData[] = [
75-
{ id: 1, name: 'John Doe', email: '[email protected]', status: 'Active' },
76-
{ id: 2, name: 'Jane Smith', email: '[email protected]', status: 'Inactive' },
77+
{ id: 1, name: "John Doe", email: "[email protected]", status: "Active" },
78+
{
79+
id: 2,
80+
name: "Jane Smith",
81+
82+
status: "Inactive",
83+
},
7784
// ... more data
7885
];
7986
}
@@ -103,16 +110,16 @@ Use Angular templates to customize cell content:
103110
<ng-template #cellTemplate let-row="row" let-column="column">
104111
<ng-container [ngSwitch]="column.field">
105112
<ng-container *ngSwitchCase="'status'">
106-
<span [ngClass]="{
113+
<span
114+
[ngClass]="{
107115
'status-active': row[column.field] === 'Active',
108116
'status-inactive': row[column.field] !== 'Active'
109-
}">
117+
}"
118+
>
110119
{{ row[column.field] }}
111120
</span>
112121
</ng-container>
113-
<ng-container *ngSwitchDefault>
114-
{{ row[column.field] }}
115-
</ng-container>
122+
<ng-container *ngSwitchDefault> {{ row[column.field] }} </ng-container>
116123
</ng-container>
117124
</ng-template>
118125
</ngx-simple-datatable>
@@ -154,24 +161,24 @@ Customize the table appearance using CSS custom properties:
154161

155162
### Inputs
156163

157-
| Input | Type | Description |
158-
|-------|------|-------------|
159-
| `[columns]` | `ColumnConfig[]` | Array of column configurations |
160-
| `[data]` | `any[]` | Array of data to display |
161-
| `[rowHeight]` | `number` | Height of each row in pixels |
162-
| `[headerHeight]` | `number` | Height of the header row in pixels |
163-
| `[bufferSize]` | `number` | Number of rows to render outside viewport for smooth scrolling |
164+
| Input | Type | Description |
165+
| ---------------- | ---------------- | -------------------------------------------------------------- |
166+
| `[columns]` | `ColumnConfig[]` | Array of column configurations |
167+
| `[data]` | `any[]` | Array of data to display |
168+
| `[rowHeight]` | `number` | Height of each row in pixels |
169+
| `[headerHeight]` | `number` | Height of the header row in pixels |
170+
| `[bufferSize]` | `number` | Number of rows to render outside viewport for smooth scrolling |
164171

165172
### Column Configuration
166173

167-
| Property | Type | Description |
168-
|----------|------|-------------|
169-
| `field` | `string` | Property name in the data object |
170-
| `header` | `string` | Column header text |
171-
| `width` | `string | number` | Column width (px or %) |
172-
| `freeze` | `'left' | 'right'` | Freeze column position |
173-
| `sortable` | `boolean` | Whether the column is sortable |
174-
| `sortFn` | `(a: any, b: any) => number` | Custom sort function |
174+
| Property | Type | Description |
175+
| ---------- | ---------------------------- | -------------------------------- | ---------------------- |
176+
| `field` | `string` | Property name in the data object |
177+
| `header` | `string` | Column header text |
178+
| `width` | `string | number` | Column width (px or %) |
179+
| `freeze` | `'left' | 'right'` | Freeze column position |
180+
| `sortable` | `boolean` | Whether the column is sortable |
181+
| `sortFn` | `(a: any, b: any) => number` | Custom sort function |
175182

176183
## Styling
177184

0 commit comments

Comments
 (0)