Skip to content

Commit

Permalink
Fixed #774
Browse files Browse the repository at this point in the history
  • Loading branch information
Çağatay Çivici committed Aug 24, 2016
1 parent 64ecb5c commit 07db34a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/selectbutton/selectbutton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const SELECTBUTTON_VALUE_ACCESSOR: Provider = new Provider(NG_VALUE_ACCESSOR, {
template: `
<div [ngClass]="'ui-selectbutton ui-buttonset ui-widget ui-corner-all ui-buttonset-' + options.length" (mouseleave)="hoveredItem=null" [ngStyle]="style" [class]="styleClass">
<div *ngFor="let option of options;" class="ui-button ui-widget ui-state-default ui-button-text-only"
[ngClass]="{'ui-state-hover': hoveredItem == option,'ui-state-active':isSelected(option)}"
[ngClass]="{'ui-state-hover': (hoveredItem==option)&&!disabled,'ui-state-active':isSelected(option), 'ui-state-disabled':disabled}"
(mouseenter)="hoveredItem=option" (click)="onItemClick($event,option)">
<span class="ui-button-text ui-c">{{option.label}}</span>
</div>
Expand All @@ -33,6 +33,8 @@ export class SelectButton implements ControlValueAccessor {

@Input() styleClass: string;

@Input() disabled: boolean;

@Output() onChange: EventEmitter<any> = new EventEmitter();

value: any;
Expand All @@ -56,6 +58,10 @@ export class SelectButton implements ControlValueAccessor {
}

onItemClick(event, option: SelectItem) {
if(this.disabled) {
return;
}

if(this.multiple) {
let itemIndex = this.findItemIndex(option);
if(itemIndex != -1)
Expand Down
6 changes: 6 additions & 0 deletions showcase/demo/selectbutton/selectbuttondemo.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ <h3>Attributes</h3>
<td>null</td>
<td>Style class of the component.</td>
</tr>
<tr>
<td>disabled</td>
<td>boolean</td>
<td>false</td>
<td>When present, it specifies that the element should be disabled.</td>
</tr>
</tbody>
</table>
</div>
Expand Down

0 comments on commit 07db34a

Please sign in to comment.