Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #13076: MatMenu component was broken since Angular Material upgrade #1960

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -201,148 +201,146 @@ <h5>
<th *matHeaderCellDef class="pastis-font-table-header pastis-col" mat-header-cell></th>
<td *matCellDef="let element; index as i" class="pastis-metadata-table-col-small" mat-cell>
<button
(click)="onButtonClicked(element.id, $event)"
(click)="onButtonClicked(element.id)"
*ngIf="isRowHovered(element.id)"
[center-mat-menu]="menuTrigger"
[matMenuTriggerFor]="menu"
[ngClass]="{
'pastis-btn-metadata-options-active': isButtonClicked(element.id, matDataSource.data[rowIndex]),
'pastis-btn-metadata-options': !isButtonClicked(element.id, matDataSource.data[rowIndex]),
'pastis-btn-metadata-options-active': isButtonClicked(element.id),
'pastis-btn-metadata-options': !isButtonClicked(element.id),
}"
disableRipple="true"
id="menuBtn"
mat-icon-button
>
<mat-icon
[ngClass]="{
'pastis-ico-menu-active': isButtonClicked(element.id, matDataSource.data[rowIndex]),
'pastis-ico-menu-inactive': !isButtonClicked(element.id, matDataSource.data[rowIndex]),
'pastis-ico-menu-active': isButtonClicked(element.id),
'pastis-ico-menu-inactive': !isButtonClicked(element.id),
}"
>
{{ isButtonClicked(element.id, matDataSource.data[rowIndex]) ? 'close' : 'more_horiz' }}
{{ isButtonClicked(element.id) ? 'close' : 'more_horiz' }}
</mat-icon>
</button>

<div #menuTrigger="matMenuTrigger" (menuClosed)="rowIndex = 100" (menuOpened)="rowIndex = i" [matMenuTriggerFor]="menu">
<mat-menu #menu="matMenu" [overlapTrigger]="false" class="pastis-menu-item-vitam">
<!-- Dupliquer-->
<mat-divider
*ngIf="isDuplicated(element.nomDuChamp) && this.profileService.profileMode === 'PA'"
style="border-top-color: #e0e0e0"
>
</mat-divider>
<button
(click)="onDuplicateNode(element.id)"
*ngIf="isDuplicated(element.nomDuChamp) && this.profileService.profileMode === 'PA'"
mat-menu-item
>
<mat-icon style="color: #757575">filter_none</mat-icon>
<span class="text normal">{{ 'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.DUPLIQUER' | translate }}</span>
</button>
<!-- @Attributs-->
<mat-divider
*ngIf="hasAttributes(element.nomDuChamp) && this.profileService.profileMode === 'PA'"
style="border-top-color: #e0e0e0"
></mat-divider>
<button
(click)="onEditAttributesClick(element.id)"
*ngIf="hasAttributes(element.nomDuChamp) && this.profileService.profileMode === 'PA'"
mat-menu-item
>
<span class="text normal">{{ 'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.ATTRIBUT_METADONNEE' | translate }}</span>
</button>
<mat-menu #menu="matMenu" (closed)="buttonClickedId = undefined" [overlapTrigger]="false" class="pastis-menu-item-vitam">
<!-- Dupliquer-->
<mat-divider
*ngIf="isDuplicated(element.nomDuChamp) && this.profileService.profileMode === 'PA'"
style="border-top-color: #e0e0e0"
>
</mat-divider>
<button
(click)="onDuplicateNode(element.id)"
*ngIf="isDuplicated(element.nomDuChamp) && this.profileService.profileMode === 'PA'"
mat-menu-item
>
<mat-icon style="color: #757575">filter_none</mat-icon>
<span class="text normal">{{ 'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.DUPLIQUER' | translate }}</span>
</button>
<!-- @Attributs-->
<mat-divider
*ngIf="hasAttributes(element.nomDuChamp) && this.profileService.profileMode === 'PA'"
style="border-top-color: #e0e0e0"
></mat-divider>
<button
(click)="onEditAttributesClick(element.id)"
*ngIf="hasAttributes(element.nomDuChamp) && this.profileService.profileMode === 'PA'"
mat-menu-item
>
<span class="text normal">{{ 'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.ATTRIBUT_METADONNEE' | translate }}</span>
</button>

<!-- Autoriser la présence de métadonnées non déclarées-->
<mat-divider
*ngIf="
isElementComplex(element.nomDuChamp) &&
this.profileService.profileMode === 'PUA' &&
isElementNameNotContentManagement(element.nomDuChamp)
"
style="border-top-color: #e0e0e0"
>
</mat-divider>
<mat-checkbox
*ngIf="
isElementComplex(element.nomDuChamp) &&
this.profileService.profileMode === 'PUA' &&
isElementNameNotContentManagement(element.nomDuChamp)
"
class="mat-menu-item"
(change)="changeAutorisation($event, element)"
[checked]="getNodeAdditionalProperties(element)"
<!-- Autoriser la présence de métadonnées non déclarées-->
<mat-divider
*ngIf="
isElementComplex(element.nomDuChamp) &&
this.profileService.profileMode === 'PUA' &&
isElementNameNotContentManagement(element.nomDuChamp)
"
style="border-top-color: #e0e0e0"
>
</mat-divider>
<mat-checkbox
*ngIf="
isElementComplex(element.nomDuChamp) &&
this.profileService.profileMode === 'PUA' &&
isElementNameNotContentManagement(element.nomDuChamp)
"
class="mat-menu-item"
(click)="toggleAutorisation(element)"
[checked]="getNodeAdditionalProperties(element)"
>
<span class="allow_presence_text"
>Autoriser la presence de <br />
métadonnées non déclarées</span
>
<span class="allow_presence_text"
>Autoriser la presence de <br />
métadonnées non déclarées</span
>
<div class="placement-tooltip">
<i
class="vitamui-icon vitamui-icon-info primary clickable"
matTooltip="Permet de modifier l’autorisation dans le manifeste de la présence de métadonnées non déclarées dans le PUA"
matTooltipClass="vitamui-tooltip"
style="font-size: 1.5em"
></i>
</div>
</mat-checkbox>
<div class="placement-tooltip">
<i
class="vitamui-icon vitamui-icon-info primary clickable"
matTooltip="Permet de modifier l’autorisation dans le manifeste de la présence de métadonnées non déclarées dans le PUA"
matTooltipClass="vitamui-tooltip"
style="font-size: 1.5em"
></i>
</div>
</mat-checkbox>

<!-- @Supprimer-->
<mat-divider *ngIf="isDeltable(element.nomDuChamp)" style="border-top-color: #e0e0e0"> </mat-divider>
<button (click)="onDeleteNode(element.id)" *ngIf="isDeltable(element.nomDuChamp)" mat-menu-item>
<mat-icon style="color: #757575">delete</mat-icon>
<span class="text normal">{{ 'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.SUPPRIMER' | translate }}</span>
</button>
<!-- @Supprimer-->
<mat-divider *ngIf="isDeltable(element.nomDuChamp)" style="border-top-color: #e0e0e0"> </mat-divider>
<button (click)="onDeleteNode(element.id)" *ngIf="isDeltable(element.nomDuChamp)" mat-menu-item>
<mat-icon style="color: #757575">delete</mat-icon>
<span class="text normal">{{ 'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.SUPPRIMER' | translate }}</span>
</button>

<!-- Contrôle de métadonées => PUA -->
<mat-divider
*ngIf="
this.profileService.profileMode === 'PUA' &&
!isElementComplex(element.nomDuChamp) &&
element.id === clickedNode.id &&
!isAppliedControl(element.id)
"
style="border-top-color: #e0e0e0"
>
</mat-divider>
<button
(click)="onControlClick(element.id)"
*ngIf="
this.profileService.profileMode === 'PUA' &&
!isElementComplex(element.nomDuChamp) &&
element.id === clickedNode.id &&
!isAppliedControl(element.id)
"
mat-menu-item
>
<mat-icon style="color: #757575"><i class="vitamui-icon vitamui-icon-ic24-PUA"></i></mat-icon>
<span class="text normal">{{ 'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.CONTROLE_METADONNEE' | translate }}</span>
</button>
<!-- Contrôle de métadonées => PUA -->
<mat-divider
*ngIf="
this.profileService.profileMode === 'PUA' &&
!isElementComplex(element.nomDuChamp) &&
element.id === clickedNode.id &&
!isAppliedControl(element.id)
"
style="border-top-color: #e0e0e0"
>
</mat-divider>
<button
(click)="onControlClick(element.id)"
*ngIf="
this.profileService.profileMode === 'PUA' &&
!isElementComplex(element.nomDuChamp) &&
element.id === clickedNode.id &&
!isAppliedControl(element.id)
"
mat-menu-item
>
<mat-icon style="color: #757575"><i class="vitamui-icon vitamui-icon-ic24-PUA"></i></mat-icon>
<span class="text normal">{{ 'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.CONTROLE_METADONNEE' | translate }}</span>
</button>

<!-- Edition des contres de nétadonnées -->
<mat-divider
*ngIf="
this.profileService.profileMode === 'PUA' &&
!isElementComplex(element.nomDuChamp) &&
element.id === clickedNode.id &&
isAppliedControl(element.id)
"
style="border-top-color: #e0e0e0"
>
</mat-divider>
<button
(click)="onEditControlClick(element.id)"
*ngIf="
this.profileService.profileMode === 'PUA' &&
!isElementComplex(element.nomDuChamp) &&
element.id === clickedNode.id &&
isAppliedControl(element.id)
"
mat-menu-item
>
<mat-icon style="color: #757575"><i class="vitamui-icon vitamui-icon-ic24-PUA"></i></mat-icon>
<span class="text normal">{{ 'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.EDITION_CONTROLE' | translate }}</span>
</button>
</mat-menu>
</div>
<!-- Edition des contres de nétadonnées -->
<mat-divider
*ngIf="
this.profileService.profileMode === 'PUA' &&
!isElementComplex(element.nomDuChamp) &&
element.id === clickedNode.id &&
isAppliedControl(element.id)
"
style="border-top-color: #e0e0e0"
>
</mat-divider>
<button
(click)="onEditControlClick(element.id)"
*ngIf="
this.profileService.profileMode === 'PUA' &&
!isElementComplex(element.nomDuChamp) &&
element.id === clickedNode.id &&
isAppliedControl(element.id)
"
mat-menu-item
>
<mat-icon style="color: #757575"><i class="vitamui-icon vitamui-icon-ic24-PUA"></i></mat-icon>
<span class="text normal">{{ 'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.EDITION_CONTROLE' | translate }}</span>
</button>
</mat-menu>
</td>
</ng-container>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,11 @@ dp-day-calendar .dp-day-calendar-container {
padding-bottom: 30px;
}

.cdk-overlay-connected-position-bounding-box:has(.pastis-menu-item-vitam) {
width: fit-content !important;
transform: translateX(calc(-50% + 20px));
}

.pastis-menu-item-vitam {
@extend .vitamui-menu-panel;
.mat-menu-item:hover:not([disabled]),
Expand Down
Loading