Skip to content

Commit ad1486b

Browse files
authored
Merge pull request #5 from rinturaj/development
[Version Update] 2.0.0
2 parents c9721a8 + f0eaaf6 commit ad1486b

28 files changed

+151
-216
lines changed

.github/workflows/npm-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030

3131
- name: Publish to NPM
3232
run: |
33-
cd dist/ngx-simple-datatable
33+
cd dist/ngx-simple-datatables
3434
npm publish --access public
3535
env:
3636
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

README.md

Lines changed: 24 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
# NgxSimpleDatatable
1+
# NgxSimpleDatatables
22

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

5-
6-
7-
![NgxSimpleDatatable Screenshot](projects/ngx-simple-datatable/assets/image.png)
5+
![NgxSimpleDatatables Screenshot](/projects/ngx-simple-datatables/assets/image.png)
86

97
## Features
108

@@ -27,12 +25,12 @@ npm install ngx-simple-datatables --save
2725
1. Import the module in your `app.module.ts`:
2826

2927
```typescript
30-
import { NgxSimpleDatatableModule } from "ngx-simple-datatables";
28+
import { NgxSimpleDatatablesModule } from "ngx-simple-datatables";
3129

3230
@NgModule({
3331
imports: [
3432
// ... other imports
35-
NgxSimpleDatatableModule,
33+
NgxSimpleDatatablesModule,
3634
],
3735
})
3836
export class AppModule {}
@@ -41,13 +39,13 @@ export class AppModule {}
4139
2. Use the component in your template:
4240

4341
```html
44-
<ngx-simple-datatable
42+
<ngx-simple-datatables
4543
[columns]="columns"
4644
[data]="data"
47-
[rowHeight]="40"
48-
[headerHeight]="50"
45+
[rowHeight]="26"
46+
[headerHeight]="26"
4947
>
50-
</ngx-simple-datatable>
48+
</ngx-simple-datatables>
5149
```
5250

5351
3. Define your columns and data in your component:
@@ -136,7 +134,7 @@ columns: ColumnConfig[] = [
136134
Use Angular templates to customize cell content:
137135

138136
```html
139-
<ngx-simple-datatable [columns]="columns" [data]="data">
137+
<ngx-simple-datatables [columns]="columns" [data]="data">
140138
<ng-template #cellTemplate let-row="row" let-column="column">
141139
<ng-container [ngSwitch]="column.field">
142140
<ng-container *ngSwitchCase="'status'">
@@ -152,23 +150,23 @@ Use Angular templates to customize cell content:
152150
<ng-container *ngSwitchDefault> {{ row[column.field] }} </ng-container>
153151
</ng-container>
154152
</ng-template>
155-
</ngx-simple-datatable>
153+
</ngx-simple-datatables>
156154
```
157155

158156
### Custom Header Templates
159157

160158
Customize header appearance and behavior:
161159

162160
```html
163-
<ngx-simple-datatable [columns]="columns" [data]="data">
161+
<ngx-simple-datatables [columns]="columns" [data]="data">
164162
<ng-template #headerTemplate let-column="column">
165163
<div class="custom-header">
166164
<i class="fas fa-info-circle" [title]="column.header"></i>
167165
<span>{{ column.header }}</span>
168166
<i class="fas fa-sort" *ngIf="column.sortable"></i>
169167
</div>
170168
</ng-template>
171-
</ngx-simple-datatable>
169+
</ngx-simple-datatables>
172170
```
173171

174172
### Theming
@@ -230,52 +228,28 @@ Customize the table appearance using CSS custom properties:
230228

231229
### Column Configuration
232230

233-
| Property | Type | Description |
234-
| ---------- | ---------------------------- | -------------------------------- | ---------------------- |
235-
| `field` | `string` | Property name in the data object |
236-
| `header` | `string` | Column header text |
237-
| `width` | `string | number` | Column width (px or %) |
238-
| `freeze` | `'left' | 'right'` | Freeze column position |
239-
| `sortable` | `boolean` | Whether the column is sortable |
240-
| `sortFn` | `(a: any, b: any) => number` | Custom sort function |
241-
242-
## Styling
243-
244-
You can customize the table appearance by overriding the following CSS custom properties:
245-
246-
```css
247-
.dynamic-table-container {
248-
--ngx-simple-dt-bg: #ffffff;
249-
--ngx-simple-dt-border: 1px solid #e0e0e0;
250-
--ngx-simple-dt-border-radius: 8px;
251-
--ngx-simple-dt-box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
252-
--ngx-simple-dt-transition: all 0.2s ease-in-out;
253-
}
254-
255-
.table-header {
256-
--ngx-simple-dt-header-bg: #f8f9fa;
257-
--ngx-simple-dt-header-hover-bg: #e9ecef;
258-
--ngx-simple-dt-header-border: 1px solid #e0e0e0;
259-
--ngx-simple-dt-header-text: #495057;
260-
--ngx-simple-dt-header-height: 48px;
261-
--ngx-simple-dt-header-font-weight: 600;
262-
--ngx-simple-dt-header-padding: 0 16px;
263-
}
264-
```
231+
| Property | Type | Description | details |
232+
| ---------- | ---------------------------- | -------------------------------- | ------------ |
233+
| `field` | `string` | Property name in the data object | string |
234+
| `header` | `string` | Column header text | string |
235+
| `width` | `string \| number` | Column width (px or %) | |
236+
| `freeze` | `'left' \| 'right'` | Freeze column position | |
237+
| `sortable` | `boolean` | Whether the column is sortable | true / false |
238+
| `sortFn` | `(a: any, b: any) => number` | Custom sort function | function |
265239

266240
## Development
267241

268-
Run `ng build ngx-simple-datatable` to build the library. The build artifacts will be stored in the `dist/` directory.
242+
Run `ng build ngx-simple-datatables` to build the library. The build artifacts will be stored in the `dist/` directory.
269243

270244
## Publishing
271245

272-
After building your library with `ng build ngx-simple-datatable`, go to the dist folder `cd dist/ngx-simple-datatable` and run `npm publish`.
246+
After building your library with `ng build ngx-simple-datatables`, go to the dist folder `cd dist/ngx-simple-datatables` and run `npm publish`.
273247

274-
After building your library with `ng build ngx-simple-datatable`, go to the dist folder `cd dist/ngx-simple-datatable` and run `npm publish`.
248+
After building your library with `ng build ngx-simple-datatables`, go to the dist folder `cd dist/ngx-simple-datatables` and run `npm publish`.
275249

276250
## Running unit tests
277251

278-
Run `ng test ngx-simple-datatable` to execute the unit tests via [Karma](https://karma-runner.github.io).
252+
Run `ng test ngx-simple-datatables` to execute the unit tests via [Karma](https://karma-runner.github.io).
279253

280254
## Further help
281255

angular.json

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,32 @@
33
"version": 1,
44
"newProjectRoot": "projects",
55
"projects": {
6-
"ngx-simple-datatable": {
6+
"ngx-simple-datatables": {
77
"projectType": "library",
8-
"root": "projects/ngx-simple-datatable",
9-
"sourceRoot": "projects/ngx-simple-datatable/src",
8+
"root": "projects/ngx-simple-datatables",
9+
"sourceRoot": "projects/ngx-simple-datatables/src",
1010
"prefix": "lib",
1111
"architect": {
1212
"build": {
1313
"builder": "@angular-devkit/build-angular:ng-packagr",
1414
"options": {
15-
"project": "projects/ngx-simple-datatable/ng-package.json"
15+
"project": "projects/ngx-simple-datatables/ng-package.json"
1616
},
1717
"configurations": {
1818
"production": {
19-
"tsConfig": "projects/ngx-simple-datatable/tsconfig.lib.prod.json"
19+
"tsConfig": "projects/ngx-simple-datatables/tsconfig.lib.prod.json"
2020
},
2121
"development": {
22-
"tsConfig": "projects/ngx-simple-datatable/tsconfig.lib.json"
22+
"tsConfig": "projects/ngx-simple-datatables/tsconfig.lib.json"
2323
}
2424
},
2525
"defaultConfiguration": "production"
2626
},
2727
"test": {
2828
"builder": "@angular-devkit/build-angular:karma",
2929
"options": {
30-
"tsConfig": "projects/ngx-simple-datatable/tsconfig.spec.json",
31-
"polyfills": [
32-
"zone.js",
33-
"zone.js/testing"
34-
]
30+
"tsConfig": "projects/ngx-simple-datatables/tsconfig.spec.json",
31+
"polyfills": ["zone.js", "zone.js/testing"]
3532
}
3633
}
3734
}
@@ -49,17 +46,13 @@
4946
"outputPath": "dist/example-app",
5047
"index": "projects/example-app/src/index.html",
5148
"browser": "projects/example-app/src/main.ts",
52-
"polyfills": [
53-
"zone.js"
54-
],
49+
"polyfills": ["zone.js"],
5550
"tsConfig": "projects/example-app/tsconfig.app.json",
5651
"assets": [
5752
"projects/example-app/src/favicon.ico",
5853
"projects/example-app/src/assets"
5954
],
60-
"styles": [
61-
"projects/example-app/src/styles.css"
62-
],
55+
"styles": ["projects/example-app/src/styles.css"],
6356
"scripts": [],
6457
"server": "projects/example-app/src/main.server.ts",
6558
"prerender": true,
@@ -112,18 +105,13 @@
112105
"test": {
113106
"builder": "@angular-devkit/build-angular:karma",
114107
"options": {
115-
"polyfills": [
116-
"zone.js",
117-
"zone.js/testing"
118-
],
108+
"polyfills": ["zone.js", "zone.js/testing"],
119109
"tsConfig": "projects/example-app/tsconfig.spec.json",
120110
"assets": [
121111
"projects/example-app/src/favicon.ico",
122112
"projects/example-app/src/assets"
123113
],
124-
"styles": [
125-
"projects/example-app/src/styles.css"
126-
],
114+
"styles": ["projects/example-app/src/styles.css"],
127115
"scripts": []
128116
}
129117
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"name": "ngx-simple-datatable-workspace",
3-
"version": "1.17.0",
2+
"name": "ngx-simple-datatables-workspace",
3+
"version": "2.0.0",
44
"scripts": {
55
"ng": "ng",
66
"start": "ng serve",
7-
"start:lib": "ng build ngx-simple-datatable --watch",
8-
"build:lib": "ng build ngx-simple-datatable",
7+
"start:lib": "ng build ngx-simple-datatables --watch",
8+
"build:lib": "ng build ngx-simple-datatables",
99
"build": "ng build",
1010
"watch": "ng build --watch --configuration development",
1111
"test": "ng test",

projects/example-app/src/app/app.component.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
<div class="app-container">
22
<h1>Dynamic Table Example</h1>
33
<div class="table-wrapper">
4-
<ngx-simple-datatable [columns]="columns" [data]="data" [rowHeight]="26" [headerHeight]="26">
4+
<ngx-simple-datatables [columns]="columns" [data]="data" [rowHeight]="26" [headerHeight]="26">
55
<ng-template #headerTemplate let-column="column">
6-
76
<span class="custom-header">{{ column?.header }}</span>
8-
9-
107
</ng-template>
118
<ng-template #cellTemplate let-row="row" let-column="column">
129
<div [ngSwitch]="column.field">
@@ -22,7 +19,7 @@ <h1>Dynamic Table Example</h1>
2219
</div>
2320

2421
</ng-template>
25-
</ngx-simple-datatable>
22+
</ngx-simple-datatables>
2623

2724
</div>
2825
</div>

projects/example-app/src/app/app.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { Component } from "@angular/core";
22
import { RouterOutlet } from "@angular/router";
3-
import { NgxSimpleDatatableComponent } from "ngx-simple-datatable";
4-
import { ColumnConfig } from "../../../ngx-simple-datatable/src/interfaces/column-config.interface";
3+
import { ColumnConfig } from "../../../ngx-simple-datatables/src/interfaces/column-config.interface";
54
import { CommonModule } from "@angular/common";
5+
import { NgxSimpleDatatablesModule } from "../../../ngx-simple-datatables/src/public-api";
66

77
@Component({
88
selector: "app-root",
99
standalone: true,
10-
imports: [NgxSimpleDatatableComponent, CommonModule],
10+
imports: [NgxSimpleDatatablesModule, CommonModule],
1111
templateUrl: "./app.component.html",
1212
styleUrl: "./app.component.css",
1313
})

projects/ngx-simple-datatable/src/lib/ngx-simple-datatable.component.spec.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

projects/ngx-simple-datatable/src/lib/ngx-simple-datatable.service.spec.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

projects/ngx-simple-datatable/src/lib/ngx-simple-datatable.service.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)