This commit is contained in:
David Lebee
2021-08-25 18:34:52 -04:00
parent 242e939b54
commit af5cdbb4bd
4 changed files with 14 additions and 6 deletions
+3 -2
View File
@@ -1,9 +1,10 @@
{
"name": "@poweredsoft/ngx-cdk-ui",
"version": "0.0.12",
"version": "0.0.13",
"peerDependencies": {
"@angular/common": "^9.1.9",
"@angular/core": "^9.1.9"
"@angular/core": "^9.1.9",
"@poweredsoft/data": "^0.0.35"
},
"dependencies": {
"tslib": "^1.10.0"
@@ -12,15 +12,22 @@ export class DsValidationErrorComponent implements OnInit, OnDestroy {
@Input() dataSource: IDataSource<any>;
@Input() field: string;
validationErrorsSub: Subscription;
commandStartedSub: Subscription;
latestErrors: string[] = [];
constructor() { }
ngOnDestroy(): void {
this.validationErrorsSub?.unsubscribe();
this.commandStartedSub?.unsubscribe();
}
ngOnInit(): void {
this.commandStartedSub = this.dataSource.commandStarted$.subscribe(e => {
this.latestErrors = [];
});
this.validationErrorsSub = this.dataSource.validationError$.subscribe(validationErrors => {
this.latestErrors = Object.keys(validationErrors.errors)
.filter(t => t.toLowerCase() == this.field?.toLowerCase())