Skip to content

Commit ec4865d

Browse files
committed
feat(compat): support Angular 13–17, add NgModule wrapper and refactor component
- Relax peerDependencies to ">=13.0.0 <18" - Convert [NgxSimpleDatatablesComponent] to non-standalone for Angular <=13 compatibility - Add [NgxSimpleDatatablesModule] declaring/exports the component - Export the module from [src/public-api.ts] - Update example app to import [NgxSimpleDatatablesModule] instead of the component - Build verified for the library BREAKING CHANGE: The component is no longer standalone. Consumers should import [NgxSimpleDatatablesModule](NgModule) instead of importing the component directly.
1 parent 9cd1930 commit ec4865d

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { Component } from "@angular/core";
22
import { RouterOutlet } from "@angular/router";
33
import { ColumnConfig } from "../../../ngx-simple-datatables/src/interfaces/column-config.interface";
44
import { CommonModule } from "@angular/common";
5-
import { NgxSimpleDatatablesComponent } from "../../../ngx-simple-datatables/src/public-api";
5+
import { NgxSimpleDatatablesModule } from "../../../ngx-simple-datatables/src/public-api";
66

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

projects/ngx-simple-datatables/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
"angular17"
2323
],
2424
"peerDependencies": {
25-
"@angular/common": "^17.3.0",
26-
"@angular/core": "^17.3.0"
25+
"@angular/common": ">=13.0.0 <18",
26+
"@angular/core": ">=13.0.0 <18"
2727
},
2828
"dependencies": {
2929
"tslib": "^2.3.0"

projects/ngx-simple-datatables/src/lib/ngx-simple-datatables.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ import { ColumnConfig, SortState } from "../interfaces/column-config.interface";
2121

2222
@Component({
2323
selector: "ngx-simple-datatables",
24-
standalone: true,
25-
imports: [CommonModule],
2624
templateUrl: "./ngx-simple-datatables.component.html",
2725
styleUrls: ["./ngx-simple-datatables.component.scss"],
2826
changeDetection: ChangeDetectionStrategy.OnPush,
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { NgModule } from '@angular/core';
2+
import { CommonModule } from '@angular/common';
3+
import { NgxSimpleDatatablesComponent } from './ngx-simple-datatables.component';
4+
5+
// NgModule wrapper to support Angular 14+ NgModule-based apps
6+
// This keeps the component standalone while enabling module-style imports.
7+
@NgModule({
8+
declarations: [NgxSimpleDatatablesComponent],
9+
imports: [CommonModule],
10+
exports: [NgxSimpleDatatablesComponent],
11+
})
12+
export class NgxSimpleDatatablesModule {}

projects/ngx-simple-datatables/src/public-api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44

55
export * from "./lib/ngx-simple-datatables.service";
66
export * from "./lib/ngx-simple-datatables.component";
7+
export * from "./lib/ngx-simple-datatables.module";

0 commit comments

Comments
 (0)