Skip to content
Snippets Groups Projects
Commit a8c0cd16 authored by AUBRY JEAN-PASCAL's avatar AUBRY JEAN-PASCAL
Browse files

fix: add optional chaining(?) to manage undefined id case in setValue() and...

fix: add optional chaining(?) to manage undefined id case in setValue() and rename cancelValue function() to emptySelectedList
Refs #637
parent 3f7817ae
No related branches found
No related tags found
2 merge requests!252release: version 4.18.0,!236Resolve "Vérificateur: la vérification ne devrait pas être possible quand aucune espèce n'est sélectionnée"
Pipeline #150147 passed
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</mat-option> </mat-option>
</mat-select> </mat-select>
<button mat-button *ngIf="showClearButton" matSuffix mat-icon-button aria-label="Clear" <button mat-button *ngIf="showClearButton" matSuffix mat-icon-button aria-label="Clear"
(click)="cancelValue($event)"> (click)="emptySelectedList($event)">
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>
</button> </button>
<div *ngIf="enableHelpButton" class="overlap-select"> <div *ngIf="enableHelpButton" class="overlap-select">
......
...@@ -59,15 +59,14 @@ export class SelectFieldLineComponent implements OnInit { ...@@ -59,15 +59,14 @@ export class SelectFieldLineComponent implements OnInit {
return this._select.getValue(); return this._select.getValue();
} }
public onValueChange($event) { public onValueChange($event: any) {
this.selectedValue = $event.value this.selectedValue = $event.value
this.valueChanged.emit(this.selectedValue) this.valueChanged.emit(this.selectedValue)
} }
public cancelValue($event): any { public emptySelectedList($event:any) {
this.selectedValue = []; this.selectedValue = [];
this.valueChanged.emit(this.selectedValue) this.valueChanged.emit(this.selectedValue)
// this.validChange.emit(false)
$event.stopPropagation(); $event.stopPropagation();
} }
......
...@@ -82,7 +82,7 @@ export abstract class SelectField extends Field { ...@@ -82,7 +82,7 @@ export abstract class SelectField extends Field {
|| ( || (
!Array.isArray(previousSelectedEntry) !Array.isArray(previousSelectedEntry)
&& !Array.isArray(v) && !Array.isArray(v)
&& previousSelectedEntry.id !== v.id && previousSelectedEntry?.id !== v?.id
) )
|| ( || (
Array.isArray(previousSelectedEntry) Array.isArray(previousSelectedEntry)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment