Skip to content

Commit

Permalink
Fixed #1288
Browse files Browse the repository at this point in the history
  • Loading branch information
Çağatay Çivici committed Nov 13, 2016
1 parent 7eae901 commit 58e851f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 34 deletions.
4 changes: 3 additions & 1 deletion components/button/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export class Button implements AfterViewInit, OnDestroy {
@Input() icon: string;

@Input() iconPos: string = 'left';

@Input() cornerStyleClass: string = 'ui-corner-all';

public _label: string;

Expand Down Expand Up @@ -82,7 +84,7 @@ export class Button implements AfterViewInit, OnDestroy {
}

getStyleClass(): string {
let styleClass = 'ui-button ui-widget ui-state-default ui-corner-all';
let styleClass = 'ui-button ui-widget ui-state-default ' + this.cornerStyleClass;
if(this.icon) {
if(this.label != null && this.label != undefined) {
if(this.iconPos == 'left')
Expand Down
39 changes: 6 additions & 33 deletions components/splitbutton/splitbutton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,15 @@ import {NgModule,Component,ElementRef,OnInit,OnDestroy,Input,Output,EventEmitter
import {CommonModule} from '@angular/common';
import {DomHandler} from '../dom/domhandler';
import {MenuItem} from '../common/api';
import {ButtonModule} from '../button/button';
import {Router} from '@angular/router';

@Component({
selector: 'p-splitButton',
template: `
<div #container [ngClass]="{'ui-splitbutton ui-buttonset ui-widget':true,'ui-state-disabled':disabled}" [ngStyle]="style" [class]="styleClass">
<button #defaultbtn type="button" class="ui-button ui-widget ui-state-default ui-corner-left"
[ngClass]="{'ui-button-text-only':(!icon&&label),'ui-button-icon-only':(icon&&!label),
'ui-button-text-icon-left':(icon&&label&&iconPos=='left'),'ui-button-text-icon-right':(icon&&label&&iconPos=='right'),
'ui-state-hover':hoverDefaultBtn&&!disabled,'ui-state-focus':focusDefaultBtn&&!disabled,'ui-state-active':activeDefaultBtn&&!disabled}"
(mouseenter)="hoverDefaultBtn=true" (mouseleave)="hoverDefaultBtn=false" (focus)="focusDefaultBtn=true" (blur)="focusDefaultBtn=false"
(mousedown)="activeDefaultBtn=true" (mouseup)="activeDefaultBtn=false" (click)="onDefaultButtonClick($event)"
[disabled]="disabled">
<span *ngIf="icon" [ngClass]="'ui-button-icon-left ui-c fa fa-fw'" [class]="icon"></span>
<span class="ui-button-text ui-c">{{label}}</span>
</button>
<button class="ui-splitbutton-menubutton ui-button ui-widget ui-state-default ui-button-icon-only ui-corner-right" type="button"
[ngClass]="{'ui-state-hover':hoverDropdown&&!disabled,'ui-state-focus':focusDropdown&&!disabled,'ui-state-active':activeDropdown&&!disabled}"
(mouseenter)="hoverDropdown=true" (mouseleave)="hoverDropdown=false" (focus)="focusDropdown=true" (blur)="focusDropdown=false"
(mousedown)="activeDropdown=true" (mouseup)="activeDropdown=false" (click)="onDropdownClick($event,menu,container)"
[disabled]="disabled">
<span class="ui-button-icon-left ui-c fa fa-fw fa-caret-down"></span>
<span class="ui-button-text ui-c">ui-button</span>
</button>
<button #defaultbtn type="button" pButton [icon]="icon" [label]="label" cornerStyleClass="ui-corner-left" (click)="onDefaultButtonClick($event)"></button>
<button type="button" pButton class="ui-splitbutton-menubutton" icon="fa-caret-down" cornerStyleClass="ui-corner-right" (click)="onDropdownClick($event,menu,container)"></button>
<div #menu [ngClass]="'ui-menu ui-menu-dynamic ui-widget ui-widget-content ui-corner-all ui-helper-clearfix ui-shadow'" [style.display]="menuVisible ? 'block' : 'none'"
[ngStyle]="menuStyle" [class]="menuStyleClass">
<ul class="ui-menu-list ui-helper-reset">
Expand Down Expand Up @@ -65,19 +50,7 @@ export class SplitButton implements OnInit,OnDestroy {
@Input() menuStyleClass: string;

@Input() disabled: boolean;

public hoverDefaultBtn: boolean;

public focusDefaultBtn: boolean;

public activeDefaultBtn: boolean;

public hoverDropdown: boolean;

public focusDropdown: boolean;

public activeDropdown: boolean;


public hoveredItem: any;

public menuVisible: boolean = false;
Expand Down Expand Up @@ -135,8 +108,8 @@ export class SplitButton implements OnInit,OnDestroy {
}

@NgModule({
imports: [CommonModule],
exports: [SplitButton],
imports: [CommonModule,ButtonModule],
exports: [SplitButton,ButtonModule],
declarations: [SplitButton]
})
export class SplitButtonModule { }

0 comments on commit 58e851f

Please sign in to comment.