diff --git a/.gitignore b/.gitignore index 0711527..ef22a83 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ # Node /node_modules +/projects/dynamic-form/node_modules npm-debug.log yarn-error.log diff --git a/angular.json b/angular.json index 3771445..d9398c1 100644 --- a/angular.json +++ b/angular.json @@ -133,75 +133,6 @@ } } } - }, - "generic-chart": { - "projectType": "library", - "root": "projects/generic-chart", - "sourceRoot": "projects/generic-chart/src", - "prefix": "lib", - "architect": { - "build": { - "builder": "@angular-devkit/build-angular:ng-packagr", - "options": { - "project": "projects/generic-chart/ng-package.json" - }, - "configurations": { - "production": { - "tsConfig": "projects/generic-chart/tsconfig.lib.prod.json" - }, - "development": { - "tsConfig": "projects/generic-chart/tsconfig.lib.json" - } - }, - "defaultConfiguration": "production" - }, - "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "tsConfig": "projects/generic-chart/tsconfig.spec.json", - "polyfills": [ - "zone.js", - "zone.js/testing" - ] - } - } - } - }, - "generic-table": { - "projectType": "library", - "root": "projects/generic-table", - "sourceRoot": "projects/generic-table/src", - "prefix": "lib", - "architect": { - "build": { - "builder": "@angular-devkit/build-angular:ng-packagr", - "options": { - "project": "projects/generic-table/ng-package.json" - }, - "configurations": { - "production": { - "tsConfig": "projects/generic-table/tsconfig.lib.prod.json" - }, - "development": { - "tsConfig": "projects/generic-table/tsconfig.lib.json" - } - }, - "defaultConfiguration": "production" - }, - "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "tsConfig": "projects/generic-table/tsconfig.spec.json", - "polyfills": [ - "zone.js", - "zone.js/testing" - ] - } - } - } } - }, - "cli": { - "analytics": false } } diff --git a/package-lock.json b/package-lock.json index d839fdd..6b096a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,6 @@ "@angular/platform-browser": "^17.3.4", "@angular/platform-browser-dynamic": "^17.3.4", "@angular/router": "^17.3.4", - "chart.js": "^4.4.6", "moment": "^2.30.1", "rxjs": "~7.5.0", "tslib": "^2.3.0", @@ -2993,11 +2992,6 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@kurkle/color": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.4.tgz", - "integrity": "sha512-M5UknZPHRu3DEDWoipU6sE8PdkZ6Z/S+v4dD+Ke8IaNlpdSQah50lz1KtcFBa2vsdOnwbbnxJwVM4wty6udA5w==" - }, "node_modules/@leichtgewicht/ip-codec": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz", @@ -5644,17 +5638,6 @@ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, - "node_modules/chart.js": { - "version": "4.4.6", - "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.6.tgz", - "integrity": "sha512-8Y406zevUPbbIBA/HRk33khEmQPk5+cxeflWE/2rx1NJsjVWMPw/9mSP9rxHP5eqi6LNoPBVMfZHxbwLSgldYA==", - "dependencies": { - "@kurkle/color": "^0.3.0" - }, - "engines": { - "pnpm": ">=8" - } - }, "node_modules/chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", diff --git a/package.json b/package.json index 20d2279..bf123f2 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,7 @@ "moment": "^2.30.1", "rxjs": "~7.5.0", "tslib": "^2.3.0", - "zone.js": "~0.14.4", - "chart.js": "^4.4.6" + "zone.js": "~0.14.4" }, "devDependencies": { "@angular-devkit/build-angular": "^17.3.4", diff --git a/projects/dynamic-form/package.json b/projects/dynamic-form/package.json index 0f1ec0a..fc04e11 100644 --- a/projects/dynamic-form/package.json +++ b/projects/dynamic-form/package.json @@ -1,6 +1,6 @@ { - "name": "@elevate/dynamic-form", - "version": "0.0.1", + "name": "elevate-dynamic-form", + "version": "0.0.15", "peerDependencies": { "@angular/common": "^17.3.4", "@angular/core": "^17.3.4", diff --git a/projects/dynamic-form/src/lib/components/main-form/main-form.component.html b/projects/dynamic-form/src/lib/components/main-form/main-form.component.html index e841ee6..3eba78e 100644 --- a/projects/dynamic-form/src/lib/components/main-form/main-form.component.html +++ b/projects/dynamic-form/src/lib/components/main-form/main-form.component.html @@ -43,6 +43,8 @@ [formControlName]="control?.name" [required]="control?.validators?.required" [compareWith]="compareWith" + (selectionChange)="onSelectChange($event, control)" + (focus)="onSelectFocus(control?.name)" > {{ option.label }} diff --git a/projects/dynamic-form/src/lib/components/main-form/main-form.component.ts b/projects/dynamic-form/src/lib/components/main-form/main-form.component.ts index cc3118a..6e9d3a0 100644 --- a/projects/dynamic-form/src/lib/components/main-form/main-form.component.ts +++ b/projects/dynamic-form/src/lib/components/main-form/main-form.component.ts @@ -1,4 +1,4 @@ -import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core'; +import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { ThemePalette } from '@angular/material/core'; import { MatDatepicker } from '@angular/material/datepicker'; @@ -63,10 +63,13 @@ export interface DynamicFormData { export class MainFormComponent implements OnInit { @Input() formJson: any; @Input() classFlex: any ; - @Input() language: any + @Input() language: any; + @Output() onChange = new EventEmitter<{ event: any, control: any }>(); + @Output() onFocus = new EventEmitter(); + myForm: FormGroup = this.fb.group({}); resources:any; - @ViewChild('subform') subform: MainFormComponent | undefined + @ViewChild('subform') subform: MainFormComponent | undefined; public showSpinners = true; public showSeconds = false; @@ -203,4 +206,11 @@ constructor(private fb: FormBuilder,public dialog: MatDialog) {} }); } + onSelectChange(event: any, control: any) { + this.onChange.emit({event, control}); + } + + onSelectFocus(controlName: any) { + this.onFocus.emit(controlName); + } } diff --git a/projects/dynamic-form/src/lib/pipes/language-translate.pipe.spec.ts b/projects/dynamic-form/src/lib/pipes/language-translate.pipe.spec.ts index cc2a1ef..aad17bf 100644 --- a/projects/dynamic-form/src/lib/pipes/language-translate.pipe.spec.ts +++ b/projects/dynamic-form/src/lib/pipes/language-translate.pipe.spec.ts @@ -5,4 +5,4 @@ describe('LanguageTranslatePipe', () => { const pipe = new LanguageTranslatePipe(); expect(pipe).toBeTruthy(); }); -}); +}); \ No newline at end of file diff --git a/projects/dynamic-form/src/lib/pipes/language-translate.pipe.ts b/projects/dynamic-form/src/lib/pipes/language-translate.pipe.ts index 8efd5ca..e83beac 100644 --- a/projects/dynamic-form/src/lib/pipes/language-translate.pipe.ts +++ b/projects/dynamic-form/src/lib/pipes/language-translate.pipe.ts @@ -19,4 +19,4 @@ export class LanguageTranslatePipe implements PipeTransform { return ''; } -} +} \ No newline at end of file diff --git a/projects/form-demo-app/src/app/app.component.html b/projects/form-demo-app/src/app/app.component.html index ced6daf..cbeec55 100644 --- a/projects/form-demo-app/src/app/app.component.html +++ b/projects/form-demo-app/src/app/app.component.html @@ -1,11 +1,6 @@
- - - - -
{{ message | languageTranslate:language }}
- - - +

Form Demo

+ +
\ No newline at end of file diff --git a/projects/form-demo-app/src/app/app.component.ts b/projects/form-demo-app/src/app/app.component.ts index 7dca7a8..c547ba5 100644 --- a/projects/form-demo-app/src/app/app.component.ts +++ b/projects/form-demo-app/src/app/app.component.ts @@ -9,9 +9,8 @@ import { MainFormComponent } from 'dynamic-form'; }) export class AppComponent { data:any= [] - @ViewChild('formLib') formLib: MainFormComponent | undefined - language = "en" - message = { en:"Message in english", hi: "अपना नाम दर्ज करें" } + @ViewChild('formLib') formLib: MainFormComponent | undefined; + language:string ="en"; constructor(){} diff --git a/projects/form-demo-app/src/app/app.module.ts b/projects/form-demo-app/src/app/app.module.ts index 0e8d2d0..285a331 100644 --- a/projects/form-demo-app/src/app/app.module.ts +++ b/projects/form-demo-app/src/app/app.module.ts @@ -1,16 +1,9 @@ import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { AppComponent } from './app.component'; -// import { MatButtonModule } from '@angular/material/button'; +import { DynamicFormModule } from 'dynamic-form'; +import { MatButtonModule } from '@angular/material/button'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { DynamicFormModule, LanguageTranslatePipe } from 'dynamic-form'; -import { MatTableModule } from '@angular/material/table'; -import { MatPaginatorModule } from '@angular/material/paginator'; -import { MatSortModule } from '@angular/material/sort'; -import { GenericChartModule } from 'dist/generic-chart'; -import { GenericTableModule } from 'dist/generic-table'; - - @NgModule({ declarations: [ @@ -19,14 +12,10 @@ import { GenericTableModule } from 'dist/generic-table'; imports: [ BrowserModule, DynamicFormModule, - BrowserAnimationsModule, - GenericChartModule, - GenericTableModule, - MatTableModule, - MatPaginatorModule, - MatSortModule + MatButtonModule, + BrowserAnimationsModule ], - providers: [LanguageTranslatePipe], + providers: [], bootstrap: [AppComponent] }) export class AppModule { } diff --git a/projects/generic-chart/README.md b/projects/generic-chart/README.md deleted file mode 100644 index 4b9e6e8..0000000 --- a/projects/generic-chart/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# GenericChart - -This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.3.0. - -## Code scaffolding - -Run `ng generate component component-name --project generic-chart` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project generic-chart`. -> Note: Don't forget to add `--project generic-chart` or else it will be added to the default project in your `angular.json` file. - -## Build - -Run `ng build generic-chart` to build the project. The build artifacts will be stored in the `dist/` directory. - -## Publishing - -After building your library with `ng build generic-chart`, go to the dist folder `cd dist/generic-chart` and run `npm publish`. - -## Running unit tests - -Run `ng test generic-chart` to execute the unit tests via [Karma](https://karma-runner.github.io). - -## Further help - -To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. diff --git a/projects/generic-chart/ng-package.json b/projects/generic-chart/ng-package.json deleted file mode 100644 index f797317..0000000 --- a/projects/generic-chart/ng-package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", - "dest": "../../dist/generic-chart", - "lib": { - "entryFile": "src/public-api.ts" - }, - "allowedNonPeerDependencies": [ - "chart.js" - ] -} \ No newline at end of file diff --git a/projects/generic-chart/package-lock.json b/projects/generic-chart/package-lock.json deleted file mode 100644 index 67ee13b..0000000 --- a/projects/generic-chart/package-lock.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "name": "generic-chart", - "version": "0.0.1", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "generic-chart", - "version": "0.0.1", - "dependencies": { - "tslib": "^2.3.0" - }, - "peerDependencies": { - "@angular/common": "^17.3.0", - "@angular/core": "^17.3.0", - "chart.js": "^4.4.6" - } - }, - "node_modules/@angular/common": { - "version": "17.3.12", - "resolved": "https://registry.npmjs.org/@angular/common/-/common-17.3.12.tgz", - "integrity": "sha512-vabJzvrx76XXFrm1RJZ6o/CyG32piTB/1sfFfKHdlH1QrmArb8It4gyk9oEjZ1IkAD0HvBWlfWmn+T6Vx3pdUw==", - "peer": true, - "dependencies": { - "tslib": "^2.3.0" - }, - "engines": { - "node": "^18.13.0 || >=20.9.0" - }, - "peerDependencies": { - "@angular/core": "17.3.12", - "rxjs": "^6.5.3 || ^7.4.0" - } - }, - "node_modules/@angular/core": { - "version": "17.3.12", - "resolved": "https://registry.npmjs.org/@angular/core/-/core-17.3.12.tgz", - "integrity": "sha512-MuFt5yKi161JmauUta4Dh0m8ofwoq6Ino+KoOtkYMBGsSx+A7dSm+DUxxNwdj7+DNyg3LjVGCFgBFnq4g8z06A==", - "peer": true, - "dependencies": { - "tslib": "^2.3.0" - }, - "engines": { - "node": "^18.13.0 || >=20.9.0" - }, - "peerDependencies": { - "rxjs": "^6.5.3 || ^7.4.0", - "zone.js": "~0.14.0" - } - }, - "node_modules/@kurkle/color": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.2.tgz", - "integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw==", - "peer": true - }, - "node_modules/chart.js": { - "version": "4.4.6", - "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.6.tgz", - "integrity": "sha512-8Y406zevUPbbIBA/HRk33khEmQPk5+cxeflWE/2rx1NJsjVWMPw/9mSP9rxHP5eqi6LNoPBVMfZHxbwLSgldYA==", - "peer": true, - "dependencies": { - "@kurkle/color": "^0.3.0" - }, - "engines": { - "pnpm": ">=8" - } - }, - "node_modules/rxjs": { - "version": "7.8.1", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", - "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", - "peer": true, - "dependencies": { - "tslib": "^2.1.0" - } - }, - "node_modules/tslib": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", - "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" - }, - "node_modules/zone.js": { - "version": "0.14.10", - "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.14.10.tgz", - "integrity": "sha512-YGAhaO7J5ywOXW6InXNlLmfU194F8lVgu7bRntUF3TiG8Y3nBK0x1UJJuHUP/e8IyihkjCYqhCScpSwnlaSRkQ==", - "peer": true - } - } -} diff --git a/projects/generic-chart/package.json b/projects/generic-chart/package.json deleted file mode 100644 index 15971c2..0000000 --- a/projects/generic-chart/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "generic-chart", - "version": "0.0.1", - "peerDependencies": { - "@angular/common": "^17.3.0", - "@angular/core": "^17.3.0", - "chart.js": "^4.4.6" - }, - "dependencies": { - "tslib": "^2.3.0" - }, - "sideEffects": false -} diff --git a/projects/generic-chart/src/lib/component/bar-chart/bar-chart.component.css b/projects/generic-chart/src/lib/component/bar-chart/bar-chart.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/projects/generic-chart/src/lib/component/bar-chart/bar-chart.component.html b/projects/generic-chart/src/lib/component/bar-chart/bar-chart.component.html deleted file mode 100644 index e63bdd2..0000000 --- a/projects/generic-chart/src/lib/component/bar-chart/bar-chart.component.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/projects/generic-chart/src/lib/component/bar-chart/bar-chart.component.spec.ts b/projects/generic-chart/src/lib/component/bar-chart/bar-chart.component.spec.ts deleted file mode 100644 index 2430ed8..0000000 --- a/projects/generic-chart/src/lib/component/bar-chart/bar-chart.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { BarChartComponent } from './bar-chart.component'; - -describe('BarChartComponent', () => { - let component: BarChartComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [BarChartComponent] - }) - .compileComponents(); - - fixture = TestBed.createComponent(BarChartComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/projects/generic-chart/src/lib/component/bar-chart/bar-chart.component.ts b/projects/generic-chart/src/lib/component/bar-chart/bar-chart.component.ts deleted file mode 100644 index 1de7ebf..0000000 --- a/projects/generic-chart/src/lib/component/bar-chart/bar-chart.component.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { Component, Input, AfterViewInit, ChangeDetectorRef, OnDestroy } from '@angular/core'; -import { Chart, registerables } from 'chart.js'; - -Chart.register(...registerables); - -@Component({ - selector: 'lib-bar-chart', - templateUrl: './bar-chart.component.html', - styleUrls: ['./bar-chart.component.css'] -}) -export class BarChartComponent implements AfterViewInit, OnDestroy { - @Input() data: any; - private chart: Chart | undefined; - - constructor(private cdr: ChangeDetectorRef) {} - - ngAfterViewInit() { - if (this.data) { - this.initializeChart(); - } - window.addEventListener('resize', this.onResize.bind(this)); - } - - ngOnChanges() { - if (this.chart) { - this.chart.destroy(); - } - - if (this.data) { - this.initializeChart(); - } - } - - ngOnDestroy() { - window.removeEventListener('resize', this.onResize.bind(this)); - } - - private initializeChart() { - const chartElement = document.getElementById('MyChart') as HTMLCanvasElement; - if (chartElement) { - this.chart = new Chart(chartElement, { - type: 'bar', - data: this.data, - options: { - responsive: true, - scales: { - x: {}, - y: { - beginAtZero: true - } - } - } - }); - this.cdr.detectChanges(); - } - } - - private onResize() { - if (this.chart) { - this.chart.resize(); - } - } -} diff --git a/projects/generic-chart/src/lib/component/chart/chart.component.css b/projects/generic-chart/src/lib/component/chart/chart.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/projects/generic-chart/src/lib/component/chart/chart.component.html b/projects/generic-chart/src/lib/component/chart/chart.component.html deleted file mode 100644 index 6f7e3cd..0000000 --- a/projects/generic-chart/src/lib/component/chart/chart.component.html +++ /dev/null @@ -1,4 +0,0 @@ -
- - -
diff --git a/projects/generic-chart/src/lib/component/chart/chart.component.spec.ts b/projects/generic-chart/src/lib/component/chart/chart.component.spec.ts deleted file mode 100644 index 94ee2aa..0000000 --- a/projects/generic-chart/src/lib/component/chart/chart.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ChartComponent } from './chart.component'; - -describe('ChartComponent', () => { - let component: ChartComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [ChartComponent] - }) - .compileComponents(); - - fixture = TestBed.createComponent(ChartComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/projects/generic-chart/src/lib/component/chart/chart.component.ts b/projects/generic-chart/src/lib/component/chart/chart.component.ts deleted file mode 100644 index 99ccb11..0000000 --- a/projects/generic-chart/src/lib/component/chart/chart.component.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { AfterViewInit } from '@angular/core'; -import { Component, Input } from '@angular/core'; -import { Chart, registerables } from 'chart.js'; - -Chart.register(...registerables); -@Component({ - selector: 'app-chart', - templateUrl: './chart.component.html', - styleUrl: './chart.component.css' -}) -export class ChartComponent{ - public data = { - labels: [ - "January", "February", "March", "April", "May", - "June", "July", "August", "September", "October", - "November", "December" - ], - datasets: [ - { - label: "Sessions Created", - data: [5, 8, 10, 12, 15, 9, 11, 14, 7, 10, 13, 16], - backgroundColor: "rgba(75, 192, 192, 0.6)", - borderColor: "rgba(75, 192, 192, 1)", - borderWidth: 1 - }, - { - label: "Sessions Attended", - data: [4, 7, 9, 10, 14, 8, 10, 12, 6, 9, 11, 15], - backgroundColor: "rgba(255, 159, 64, 0.6)", - borderColor: "rgba(255, 159, 64, 1)", - borderWidth: 1 - } - ] - }; - - -} - - diff --git a/projects/generic-chart/src/lib/component/line-chart/line-chart.component.css b/projects/generic-chart/src/lib/component/line-chart/line-chart.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/projects/generic-chart/src/lib/component/line-chart/line-chart.component.html b/projects/generic-chart/src/lib/component/line-chart/line-chart.component.html deleted file mode 100644 index ccf1cfd..0000000 --- a/projects/generic-chart/src/lib/component/line-chart/line-chart.component.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/projects/generic-chart/src/lib/component/line-chart/line-chart.component.spec.ts b/projects/generic-chart/src/lib/component/line-chart/line-chart.component.spec.ts deleted file mode 100644 index 38e0458..0000000 --- a/projects/generic-chart/src/lib/component/line-chart/line-chart.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { LineChartComponent } from './line-chart.component'; - -describe('LineChartComponent', () => { - let component: LineChartComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [LineChartComponent] - }) - .compileComponents(); - - fixture = TestBed.createComponent(LineChartComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/projects/generic-chart/src/lib/component/line-chart/line-chart.component.ts b/projects/generic-chart/src/lib/component/line-chart/line-chart.component.ts deleted file mode 100644 index efbe69b..0000000 --- a/projects/generic-chart/src/lib/component/line-chart/line-chart.component.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Component, Input, AfterViewInit, ChangeDetectorRef, OnChanges, SimpleChanges } from '@angular/core'; -import { Chart, registerables } from 'chart.js'; - -Chart.register(...registerables); - -@Component({ - selector: 'lib-line-chart', - templateUrl: './line-chart.component.html', - styleUrls: ['./line-chart.component.css'], -}) -export class LineChartComponent implements AfterViewInit, OnChanges { - @Input() data: any; - private chart: Chart | undefined; - - constructor(private cdr: ChangeDetectorRef) {} - - ngAfterViewInit() { - if (this.data) { - this.initializeChart(); - } - } - - ngOnChanges(changes: SimpleChanges) { - if (changes['data'] && !changes['data'].isFirstChange()) { - this.updateChart(); - } - } - private initializeChart() { - const chartElement = document.getElementById('line') as HTMLCanvasElement; - if (!chartElement) { - console.error('Chart element not found'); - return; - } - this.chart = new Chart(chartElement, { - type: 'line', - data: this.data, - options: { - responsive: true, - scales: { - x: {}, - y: { - beginAtZero: true, - }, - }, - }, - }); - this.cdr.detectChanges(); - } - - private updateChart() { - if (this.chart) { - this.chart.destroy(); - } - - this.initializeChart(); - } -} diff --git a/projects/generic-chart/src/lib/generic-chart.component.spec.ts b/projects/generic-chart/src/lib/generic-chart.component.spec.ts deleted file mode 100644 index 0df88d9..0000000 --- a/projects/generic-chart/src/lib/generic-chart.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { GenericChartComponent } from './generic-chart.component'; - -describe('GenericChartComponent', () => { - let component: GenericChartComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [GenericChartComponent] - }) - .compileComponents(); - - fixture = TestBed.createComponent(GenericChartComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/projects/generic-chart/src/lib/generic-chart.component.ts b/projects/generic-chart/src/lib/generic-chart.component.ts deleted file mode 100644 index 0f13db9..0000000 --- a/projects/generic-chart/src/lib/generic-chart.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'lib-generic-chart', - template: ``, - styles: `` -}) -export class GenericChartComponent { - -} diff --git a/projects/generic-chart/src/lib/generic-chart.module.ts b/projects/generic-chart/src/lib/generic-chart.module.ts deleted file mode 100644 index abd687a..0000000 --- a/projects/generic-chart/src/lib/generic-chart.module.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { NO_ERRORS_SCHEMA, NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { ChartComponent } from './component/chart/chart.component'; -import { GenericChartComponent } from './generic-chart.component'; -import { BarChartComponent } from './component/bar-chart/bar-chart.component'; -import { LineChartComponent } from './component/line-chart/line-chart.component'; - -@NgModule({ - declarations: [ - ChartComponent, - GenericChartComponent, - BarChartComponent, - LineChartComponent - ], - imports: [ - CommonModule, - ], - schemas:[NO_ERRORS_SCHEMA], - exports:[ChartComponent, LineChartComponent, BarChartComponent] -}) -export class GenericChartModule {} diff --git a/projects/generic-chart/src/lib/generic-chart.service.spec.ts b/projects/generic-chart/src/lib/generic-chart.service.spec.ts deleted file mode 100644 index d7942d4..0000000 --- a/projects/generic-chart/src/lib/generic-chart.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { GenericChartService } from './generic-chart.service'; - -describe('GenericChartService', () => { - let service: GenericChartService; - - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(GenericChartService); - }); - - it('should be created', () => { - expect(service).toBeTruthy(); - }); -}); diff --git a/projects/generic-chart/src/lib/generic-chart.service.ts b/projects/generic-chart/src/lib/generic-chart.service.ts deleted file mode 100644 index 9587e9e..0000000 --- a/projects/generic-chart/src/lib/generic-chart.service.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Injectable } from '@angular/core'; - -@Injectable({ - providedIn: 'root' -}) -export class GenericChartService { - - constructor() { } -} diff --git a/projects/generic-chart/src/public-api.ts b/projects/generic-chart/src/public-api.ts deleted file mode 100644 index d16129d..0000000 --- a/projects/generic-chart/src/public-api.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Public API Surface of generic-chart - */ - -export * from './lib/generic-chart.service'; -export * from './lib/generic-chart.component'; -export * from './lib/generic-chart.module' -export * from './lib/component/chart/chart.component'; -export * from './lib/component/bar-chart/bar-chart.component' -export * from './lib/component/line-chart/line-chart.component' \ No newline at end of file diff --git a/projects/generic-chart/tsconfig.lib.json b/projects/generic-chart/tsconfig.lib.json deleted file mode 100644 index 543fd47..0000000 --- a/projects/generic-chart/tsconfig.lib.json +++ /dev/null @@ -1,14 +0,0 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "../../out-tsc/lib", - "declaration": true, - "declarationMap": true, - "inlineSources": true, - "types": [] - }, - "exclude": [ - "**/*.spec.ts" - ] -} diff --git a/projects/generic-chart/tsconfig.lib.prod.json b/projects/generic-chart/tsconfig.lib.prod.json deleted file mode 100644 index 06de549..0000000 --- a/projects/generic-chart/tsconfig.lib.prod.json +++ /dev/null @@ -1,10 +0,0 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ -{ - "extends": "./tsconfig.lib.json", - "compilerOptions": { - "declarationMap": false - }, - "angularCompilerOptions": { - "compilationMode": "partial" - } -} diff --git a/projects/generic-chart/tsconfig.spec.json b/projects/generic-chart/tsconfig.spec.json deleted file mode 100644 index ce7048b..0000000 --- a/projects/generic-chart/tsconfig.spec.json +++ /dev/null @@ -1,14 +0,0 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "../../out-tsc/spec", - "types": [ - "jasmine" - ] - }, - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] -} diff --git a/projects/generic-table/README.md b/projects/generic-table/README.md deleted file mode 100644 index 5e066b4..0000000 --- a/projects/generic-table/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# GenericTable - -This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.3.0. - -## Code scaffolding - -Run `ng generate component component-name --project generic-table` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project generic-table`. -> Note: Don't forget to add `--project generic-table` or else it will be added to the default project in your `angular.json` file. - -## Build - -Run `ng build generic-table` to build the project. The build artifacts will be stored in the `dist/` directory. - -## Publishing - -After building your library with `ng build generic-table`, go to the dist folder `cd dist/generic-table` and run `npm publish`. - -## Running unit tests - -Run `ng test generic-table` to execute the unit tests via [Karma](https://karma-runner.github.io). - -## Further help - -To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. diff --git a/projects/generic-table/ng-package.json b/projects/generic-table/ng-package.json deleted file mode 100644 index 45224e9..0000000 --- a/projects/generic-table/ng-package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", - "dest": "../../dist/generic-table", - "lib": { - "entryFile": "src/public-api.ts" - } -} \ No newline at end of file diff --git a/projects/generic-table/package.json b/projects/generic-table/package.json deleted file mode 100644 index 898f630..0000000 --- a/projects/generic-table/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "generic-table", - "version": "0.0.1", - "peerDependencies": { - "@angular/common": "^17.3.0", - "@angular/core": "^17.3.0" - }, - "dependencies": { - "tslib": "^2.3.0" - }, - "sideEffects": false -} diff --git a/projects/generic-table/src/lib/comoponent/table/table.component.css b/projects/generic-table/src/lib/comoponent/table/table.component.css deleted file mode 100644 index f1a7d14..0000000 --- a/projects/generic-table/src/lib/comoponent/table/table.component.css +++ /dev/null @@ -1,20 +0,0 @@ -.header-container { - display: flex; - flex-direction: column; - align-items: flex-start; - } - - .header-label { - font-weight: bold; - margin-bottom: 4px; - } - - .header-input { - width: 100%; - margin-top: 4px; - } - - - .mat-sort-header-arrow{ - top:-35px !important - } diff --git a/projects/generic-table/src/lib/comoponent/table/table.component.html b/projects/generic-table/src/lib/comoponent/table/table.component.html deleted file mode 100644 index d649df1..0000000 --- a/projects/generic-table/src/lib/comoponent/table/table.component.html +++ /dev/null @@ -1,32 +0,0 @@ -
- - - - - - - - -
-
- {{ getHeaderLabel(column) }} - - - - - - - {{ option.label }} - - - -
-
{{ element[column] }}
- -
\ No newline at end of file diff --git a/projects/generic-table/src/lib/comoponent/table/table.component.spec.ts b/projects/generic-table/src/lib/comoponent/table/table.component.spec.ts deleted file mode 100644 index a2015da..0000000 --- a/projects/generic-table/src/lib/comoponent/table/table.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { TableComponent } from './table.component'; - -describe('TableComponent', () => { - let component: TableComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [TableComponent] - }) - .compileComponents(); - - fixture = TestBed.createComponent(TableComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/projects/generic-table/src/lib/comoponent/table/table.component.ts b/projects/generic-table/src/lib/comoponent/table/table.component.ts deleted file mode 100644 index 0c99434..0000000 --- a/projects/generic-table/src/lib/comoponent/table/table.component.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core'; -import { MatTableDataSource } from '@angular/material/table'; -import { MatPaginator } from '@angular/material/paginator'; -import { MatSort } from '@angular/material/sort'; - -@Component({ - selector: 'lib-table', - templateUrl: './table.component.html', - styleUrls: ['./table.component.css'] -}) -export class TableComponent implements OnInit, AfterViewInit { - dataSource = new MatTableDataSource(); - displayedColumns: string[] = []; - columns = [ - { key: 'id', label: 'Id', searchable: true, filterable: false }, - { key: 'name1', label: 'Name', searchable: true, filterable: false }, - { key: 'age', label: 'Age', searchable: false, filterable: true }, - { key: 'department', label: 'Department Name', searchable: false, filterable: true }, - { key: 'salaryAmount', label: 'Salary Amount', searchable: false, filterable: true }, - ]; - - data = [ - { id: 'abc', name1: 'Alice', age: 25, department: 'Engineering', salaryAmount: 2500 }, - { id: 2, name1: 'Bob', age: 30, department: 'Marketing', salaryAmount: 3000 }, - { id: 3, name1: 'Charlie', age: 35, department: 'HR', salaryAmount: 2800 }, - { id: 4, name1: 'Dave', age: 28, department: 'Finance', salaryAmount: 3200 }, - ]; - - options =[{label:'Lable 1', value:'label1'}, {label:'Lable 1', value:'label1'}] - - @ViewChild(MatPaginator) paginator!: MatPaginator; - @ViewChild(MatSort) sort!: MatSort; - - ngOnInit(): void { - this.initializeTable(this.data); - } - - ngAfterViewInit(): void { - this.dataSource.paginator = this.paginator; - this.dataSource.sort = this.sort; - } - - initializeTable(data: any[]): void { - this.dataSource.data = data; - this.displayedColumns = Object.keys(data[0]); - } - - getHeaderLabel(columnKey: string): string { - const column = this.columns.find(col => col.key === columnKey); - return column ? column.label : columnKey; - } - - filteredData = [...this.data]; - - onSearch(event: any, key: string) { - const value = event.target.value.toLowerCase(); - this.filteredData = this.data.filter((item:any) => - item[key].toString().toLowerCase().includes(value) - ); - } - - onFilter(event: any, key: string) { - const value = event.target.value; - this.filteredData = value - ? this.data.filter((item:any) => item[key].toString() === value) - : [...this.data]; - } - - getFilterOptions(key: string) { - return [{label:'Lable 1', value:'label1'}, {label:'Lable 1', value:'label1'}]; - } - - isSearchable(columnKey : string){ - const column = this.columns.find(col => col.key === columnKey); - return column?.searchable - } - isFilterable(columnKey : string){ - const column = this.columns.find(col => col.key === columnKey); - return column?.filterable - } -} \ No newline at end of file diff --git a/projects/generic-table/src/lib/generic-table.component.spec.ts b/projects/generic-table/src/lib/generic-table.component.spec.ts deleted file mode 100644 index 1caaa14..0000000 --- a/projects/generic-table/src/lib/generic-table.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { GenericTableComponent } from './generic-table.component'; - -describe('GenericTableComponent', () => { - let component: GenericTableComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [GenericTableComponent] - }) - .compileComponents(); - - fixture = TestBed.createComponent(GenericTableComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/projects/generic-table/src/lib/generic-table.component.ts b/projects/generic-table/src/lib/generic-table.component.ts deleted file mode 100644 index 77230c8..0000000 --- a/projects/generic-table/src/lib/generic-table.component.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'lib-generic-table', - template: ` -

- generic-table works! -

- `, - styles: `` -}) -export class GenericTableComponent { - -} diff --git a/projects/generic-table/src/lib/generic-table.module.ts b/projects/generic-table/src/lib/generic-table.module.ts deleted file mode 100644 index f67be6f..0000000 --- a/projects/generic-table/src/lib/generic-table.module.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { NO_ERRORS_SCHEMA, NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { GenericTableComponent } from './generic-table.component'; -import {TableComponent} from './comoponent/table/table.component' -import { MatTableModule } from '@angular/material/table'; -import { MatPaginatorModule } from '@angular/material/paginator'; -import { MatSortModule } from '@angular/material/sort'; -import {MatSelectModule} from '@angular/material/select'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; -import { MatOptionModule } from '@angular/material/core'; -@NgModule({ - declarations: [ - GenericTableComponent, - TableComponent, - ], - imports: [ - CommonModule, - MatTableModule, - MatPaginatorModule, - MatSortModule, - MatSelectModule, - MatFormFieldModule, - MatInputModule, - MatOptionModule - ], - schemas:[NO_ERRORS_SCHEMA], - exports:[GenericTableComponent,TableComponent] -}) -export class GenericTableModule {} diff --git a/projects/generic-table/src/lib/generic-table.service.spec.ts b/projects/generic-table/src/lib/generic-table.service.spec.ts deleted file mode 100644 index 9aaeac8..0000000 --- a/projects/generic-table/src/lib/generic-table.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { GenericTableService } from './generic-table.service'; - -describe('GenericTableService', () => { - let service: GenericTableService; - - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(GenericTableService); - }); - - it('should be created', () => { - expect(service).toBeTruthy(); - }); -}); diff --git a/projects/generic-table/src/lib/generic-table.service.ts b/projects/generic-table/src/lib/generic-table.service.ts deleted file mode 100644 index 00250e7..0000000 --- a/projects/generic-table/src/lib/generic-table.service.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Injectable } from '@angular/core'; - -@Injectable({ - providedIn: 'root' -}) -export class GenericTableService { - - constructor() { } -} diff --git a/projects/generic-table/src/public-api.ts b/projects/generic-table/src/public-api.ts deleted file mode 100644 index a34cca9..0000000 --- a/projects/generic-table/src/public-api.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Public API Surface of generic-table - */ - -export * from './lib/generic-table.service'; -export * from './lib/generic-table.component'; -export * from './lib/generic-table.module'; -export * from './lib/comoponent/table/table.component'; - - diff --git a/projects/generic-table/tsconfig.lib.json b/projects/generic-table/tsconfig.lib.json deleted file mode 100644 index 543fd47..0000000 --- a/projects/generic-table/tsconfig.lib.json +++ /dev/null @@ -1,14 +0,0 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "../../out-tsc/lib", - "declaration": true, - "declarationMap": true, - "inlineSources": true, - "types": [] - }, - "exclude": [ - "**/*.spec.ts" - ] -} diff --git a/projects/generic-table/tsconfig.lib.prod.json b/projects/generic-table/tsconfig.lib.prod.json deleted file mode 100644 index 06de549..0000000 --- a/projects/generic-table/tsconfig.lib.prod.json +++ /dev/null @@ -1,10 +0,0 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ -{ - "extends": "./tsconfig.lib.json", - "compilerOptions": { - "declarationMap": false - }, - "angularCompilerOptions": { - "compilationMode": "partial" - } -} diff --git a/projects/generic-table/tsconfig.spec.json b/projects/generic-table/tsconfig.spec.json deleted file mode 100644 index ce7048b..0000000 --- a/projects/generic-table/tsconfig.spec.json +++ /dev/null @@ -1,14 +0,0 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "../../out-tsc/spec", - "types": [ - "jasmine" - ] - }, - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] -}