Skip to content

Commit

Permalink
Fixed #8193 Tooltip for Multiselect
Browse files Browse the repository at this point in the history
  • Loading branch information
yigitfindikli committed Oct 2, 2019
1 parent 6f5f9af commit 3acd60b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
13 changes: 11 additions & 2 deletions src/app/components/multiselect/multiselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { SharedModule, PrimeTemplate, Footer, Header } from '../common/shared';
import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';
import { ScrollingModule } from '@angular/cdk/scrolling';
import { FilterUtils } from '../utils/filterutils';
import {TooltipModule} from '../tooltip/tooltip';

export const MULTISELECT_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
Expand Down Expand Up @@ -77,7 +78,7 @@ export class MultiSelectItem {
<input #in type="text" readonly="readonly" [attr.id]="inputId" [attr.name]="name" (focus)="onInputFocus($event)" (blur)="onInputBlur($event)"
[disabled]="disabled" [attr.tabindex]="tabindex" (keydown)="onKeydown($event)">
</div>
<div class="ui-multiselect-label-container" [title]="valuesAsString">
<div class="ui-multiselect-label-container" [pTooltip]="tooltip" [tooltipPosition]="tooltipPosition" [positionStyle]="tooltipPositionStyle" [tooltipStyleClass]="tooltipStyleClass">
<span class="ui-multiselect-label ui-corner-all">
<ng-container *ngIf="!selectedItemsTemplate">{{valuesAsString}}</ng-container>
<ng-container *ngTemplateOutlet="selectedItemsTemplate; context: {$implicit: value}"></ng-container>
Expand Down Expand Up @@ -232,6 +233,14 @@ export class MultiSelect implements OnInit,AfterViewInit,AfterContentInit,AfterV

@Input() filterMatchMode: string = "contains";

@Input() tooltip: string = '';

@Input() tooltipPosition: string = 'right';

@Input() tooltipPositionStyle: string = 'absolute';

@Input() tooltipStyleClass: string;

@ViewChild('container', { static: false }) containerViewChild: ElementRef;

@ViewChild('filterInput', { static: false }) filterInputChild: ElementRef;
Expand Down Expand Up @@ -848,7 +857,7 @@ export class MultiSelect implements OnInit,AfterViewInit,AfterContentInit,AfterV
}

@NgModule({
imports: [CommonModule,SharedModule,ScrollingModule],
imports: [CommonModule,SharedModule,ScrollingModule, TooltipModule],
exports: [MultiSelect,SharedModule,ScrollingModule],
declarations: [MultiSelect,MultiSelectItem]
})
Expand Down
26 changes: 25 additions & 1 deletion src/app/showcase/components/multiselect/multiselectdemo.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<div class="content-section implementation">
<h3 class="first">Basic</h3>
<p-multiSelect [options]="cars" [(ngModel)]="selectedCars1" [panelStyle]="{minWidth:'12em'}"></p-multiSelect>
<p-multiSelect [options]="cars" [(ngModel)]="selectedCars1" [panelStyle]="{minWidth:'12em'}" tooltip="Choose Your Car"></p-multiSelect>
<p>Selected Cars: {{selectedCars1}}</p>

<h3>Templating</h3>
Expand Down Expand Up @@ -404,6 +404,30 @@ <h3>Properties</h3>
<td>null</td>
<td>Defines a string that labels the filter input.</td>
</tr>
<tr>
<td>tooltip</td>
<td>any</td>
<td>null</td>
<td>Advisory information to display in a tooltip on hover.</td>
</tr>
<tr>
<td>tooltipStyleClass</td>
<td>string</td>
<td>null</td>
<td>Style class of the tooltip.</td>
</tr>
<tr>
<td>tooltipPosition</td>
<td>string</td>
<td>top</td>
<td>Position of the tooltip, valid values are right, left, top and bottom.</td>
</tr>
<tr>
<td>tooltipPositionStyle</td>
<td>string</td>
<td>absolute</td>
<td>Type of CSS position.</td>
</tr>
</tbody>
</table>
</div>
Expand Down

0 comments on commit 3acd60b

Please sign in to comment.