Skip to content

Commit

Permalink
Mapping dropdown fix (#558)
Browse files Browse the repository at this point in the history
Mapping dropdown fix
  • Loading branch information
DhaaraniCIT authored Feb 15, 2024
1 parent 3653c25 commit 04c8709
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ <h5 *ngIf="(formControllerName === 'reimbursableExportType' || formControllerNam
(onHide)="clearSearch()"
[emptyFilterMessage]="isOptionSearchInProgress ? 'Searching...' : 'No results found'"
[dropdownIcon]="isOptionSearchInProgress ? 'pi pi-spinner pi-spin' : 'pi pi-chevron-down ' + brandingConfig.brandId">
<ng-template let-options pTemplate="item">
<div #textElement
[ngStyle]="{'white-space': 'nowrap', 'overflow': 'hidden', 'text-overflow': 'ellipsis', 'max-width': '16rem'}"
[pTooltip]="isOverflowing(textElement) ? options.value: null" tooltipPosition="top">
{{options.value}}
</div>
</ng-template>
<ng-template *ngIf="!isAdvanceSearchEnabled" pTemplate="filter" let-dropdownOptions="options">
<app-search [form]="form" [placeholder]="'Search'" [styleClasses]="'tw-w-[100%] tw-h-dropdown-option-height tw-bg-white'" (handleSimpleSearch)="simpleSearch($event)"></app-search>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
(onChange)="save(mapping, $event); getDropdownValue(mapping)"
[filter]="true"
filterBy="value">
<ng-template let-options pTemplate="item">
<div #textElement
[ngStyle]="{'white-space': 'nowrap', 'overflow': 'hidden', 'text-overflow': 'ellipsis', 'max-width': '16rem'}"
[pTooltip]="isOverflowing(textElement) ? options.value: null" tooltipPosition="top">
{{options.value}}
</div>
</ng-template>
<ng-template pTemplate="filter" let-options="options">
<app-search [form]="form" [placeholder]="'Search'" [styleClasses]="'tw-w-[100%] tw-h-dropdown-option-height tw-bg-white'" (handleSimpleSearch)="simpleSearch($event)"></app-search>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ export class GenericMappingTableComponent implements OnInit {
private workspaceService: WorkspaceService
) { }

isOverflowing(element: any): boolean {
return element.offsetWidth < element.scrollWidth;
}

tableDropdownWidth() {
const element = document.querySelector('.p-dropdown-panel.p-component.ng-star-inserted') as HTMLElement;
if (element) {
Expand Down
2 changes: 1 addition & 1 deletion src/assets/sprites/sprite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ p {

.p-dropdown-panel .p-dropdown-items .p-dropdown-item,
.p-dropdown-panel .p-dropdown-items .p-dropdown-item.p-highlight {
@apply tw-h-dropdown-option-height tw-py-8-px tw-pl-14-px tw-text-14-px tw-rounded-4-px #{!important};
@apply tw-h-dropdown-option-height tw-flex tw-items-center tw-py-8-px tw-pl-14-px tw-text-14-px tw-rounded-4-px #{!important};
}

.p-dropdown.p-focus {
Expand Down

0 comments on commit 04c8709

Please sign in to comment.