Commit 9aead9ef authored by LAVENIER's avatar LAVENIER
Browse files

Release v0.14.0

parent 704534e7
{
"name": "@sumaris-net/ngx-components",
"description": "SUMARiS Angular components",
"version": "0.13.17",
"version": "0.14.0",
"author": "contact@e-is.pro",
"license": "AGPL-3.0",
"readmeFilename": "README.md",
......
......@@ -57,7 +57,7 @@
<mat-error *ngIf="formControl.hasError('dateRange')" translate>ERROR.FIELD_NOT_VALID_DATE_RANGE</mat-error>
<mat-error *ngIf="!formControl.hasError('dateRange') && formControl.hasError('dateMaxDuration')" translate>ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION</mat-error>
<mat-error *ngIf="!formControl.hasError('dateRange') && formControl.hasError('dateMinDuration')" translate>ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION</mat-error>
<mat-error *ngIf="formControl.hasError('msg')">{{formControl.errors['msg']}}</mat-error>
<mat-error *ngIf="formControl.hasError('msg')">{{formControl.errors.msg}}</mat-error>
</mat-form-field>
<mat-datepicker #datePicker
......
......@@ -58,7 +58,7 @@
<mat-error *ngIf="formControl.hasError('dateRange')" translate>ERROR.FIELD_NOT_VALID_DATE_RANGE</mat-error>
<mat-error *ngIf="!formControl.hasError('dateRange') && formControl.hasError('dateMaxDuration')" translate>ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION</mat-error>
<mat-error *ngIf="!formControl.hasError('dateRange') && formControl.hasError('dateMinDuration')" translate>ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION</mat-error>
<mat-error *ngIf="formControl.hasError('msg')">{{formControl.errors['msg']}}</mat-error>
<mat-error *ngIf="formControl.hasError('msg')">{{formControl.errors.msg}}</mat-error>
<ng-content select="mat-error"></ng-content>
</mat-form-field>
......
......@@ -70,7 +70,7 @@
<mat-error *ngSwitchCase="'dateRange'" translate>ERROR.FIELD_NOT_VALID_DATE_RANGE</mat-error>
<mat-error *ngSwitchCase="'dateMaxDuration'" translate>ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION</mat-error>
<mat-error *ngSwitchCase="'dateMinDuration'" translate>ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION</mat-error>
<mat-error *ngSwitchCase="'msg'">{{formControl.errors.msg}}</mat-error>
<mat-error *ngSwitchCase="'msg'">{{(formControl.errors.msg?.key || formControl.errors.msg) | translate: formControl.errors.msg?.params}}</mat-error>
</ng-container>
<ng-content select="mat-error"></ng-content>
......
......@@ -334,6 +334,17 @@ export class SharedFormGroupValidators {
return null;
};
}
/**
* Same as compose, but keep only the first errors (instead of the union)
* @param validators
*/
first(validators: (ValidatorFn | null | undefined)[]): ValidationErrors | null {
return (control) => validators
.filter(isNotNil)
.map(validator => validator(control))
.find(isNotNil) || null;
}
}
// @dynamic
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment