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

6
package-lock.json generated
View File

@ -1676,9 +1676,9 @@
}
},
"@poweredsoft/data": {
"version": "0.0.30",
"resolved": "https://registry.npmjs.org/@poweredsoft/data/-/data-0.0.30.tgz",
"integrity": "sha512-lKojW+yCKPSrdohqhuoEUTo196Z1cHs+SkOZ9N43N7MUcbIR0SA6Uz6k4QZtbmbXmR5AvDKPrDp37nqPXGZFYA==",
"version": "0.0.35",
"resolved": "https://registry.npmjs.org/@poweredsoft/data/-/data-0.0.35.tgz",
"integrity": "sha512-od4w5sorQmV/M74yHXn/xTwh6YdoYBzq79bS8F/BHBuoE2FEuY0o8JD5rime4gKqtClFvBD5O9k4aqlpNNdkpw==",
"requires": {
"tslib": "^1.9.0"
}

View File

@ -24,7 +24,7 @@
"@angular/platform-browser-dynamic": "~9.1.4",
"@angular/router": "~9.1.4",
"@ng-select/ng-select": "^4.0.1",
"@poweredsoft/data": "0.0.30",
"@poweredsoft/data": "0.0.35",
"@poweredsoft/ngx-data": "0.0.22",
"@poweredsoft/ngx-data-apollo": "0.0.10",
"apollo-angular": "^1.8.0",

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"

View File

@ -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())