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": { "@poweredsoft/data": {
"version": "0.0.30", "version": "0.0.35",
"resolved": "https://registry.npmjs.org/@poweredsoft/data/-/data-0.0.30.tgz", "resolved": "https://registry.npmjs.org/@poweredsoft/data/-/data-0.0.35.tgz",
"integrity": "sha512-lKojW+yCKPSrdohqhuoEUTo196Z1cHs+SkOZ9N43N7MUcbIR0SA6Uz6k4QZtbmbXmR5AvDKPrDp37nqPXGZFYA==", "integrity": "sha512-od4w5sorQmV/M74yHXn/xTwh6YdoYBzq79bS8F/BHBuoE2FEuY0o8JD5rime4gKqtClFvBD5O9k4aqlpNNdkpw==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }

View File

@ -24,7 +24,7 @@
"@angular/platform-browser-dynamic": "~9.1.4", "@angular/platform-browser-dynamic": "~9.1.4",
"@angular/router": "~9.1.4", "@angular/router": "~9.1.4",
"@ng-select/ng-select": "^4.0.1", "@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": "0.0.22",
"@poweredsoft/ngx-data-apollo": "0.0.10", "@poweredsoft/ngx-data-apollo": "0.0.10",
"apollo-angular": "^1.8.0", "apollo-angular": "^1.8.0",

View File

@ -1,9 +1,10 @@
{ {
"name": "@poweredsoft/ngx-cdk-ui", "name": "@poweredsoft/ngx-cdk-ui",
"version": "0.0.12", "version": "0.0.13",
"peerDependencies": { "peerDependencies": {
"@angular/common": "^9.1.9", "@angular/common": "^9.1.9",
"@angular/core": "^9.1.9" "@angular/core": "^9.1.9",
"@poweredsoft/data": "^0.0.35"
}, },
"dependencies": { "dependencies": {
"tslib": "^1.10.0" "tslib": "^1.10.0"

View File

@ -12,15 +12,22 @@ export class DsValidationErrorComponent implements OnInit, OnDestroy {
@Input() dataSource: IDataSource<any>; @Input() dataSource: IDataSource<any>;
@Input() field: string; @Input() field: string;
validationErrorsSub: Subscription; validationErrorsSub: Subscription;
commandStartedSub: Subscription;
latestErrors: string[] = []; latestErrors: string[] = [];
constructor() { } constructor() { }
ngOnDestroy(): void { ngOnDestroy(): void {
this.validationErrorsSub?.unsubscribe(); this.validationErrorsSub?.unsubscribe();
this.commandStartedSub?.unsubscribe();
} }
ngOnInit(): void { ngOnInit(): void {
this.commandStartedSub = this.dataSource.commandStarted$.subscribe(e => {
this.latestErrors = [];
});
this.validationErrorsSub = this.dataSource.validationError$.subscribe(validationErrors => { this.validationErrorsSub = this.dataSource.validationError$.subscribe(validationErrors => {
this.latestErrors = Object.keys(validationErrors.errors) this.latestErrors = Object.keys(validationErrors.errors)
.filter(t => t.toLowerCase() == this.field?.toLowerCase()) .filter(t => t.toLowerCase() == this.field?.toLowerCase())