Skip to content

Commit

Permalink
Merge pull request #54 from edcarroll/develop
Browse files Browse the repository at this point in the history
v0.6.2 into master
  • Loading branch information
edcarroll authored Apr 1, 2017
2 parents b9ffd1a + 7b04fec commit e62b6e7
Show file tree
Hide file tree
Showing 25 changed files with 764 additions and 647 deletions.
32 changes: 19 additions & 13 deletions components/checkbox/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,38 @@ import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms';
selector: 'sui-checkbox',
exportAs: 'suiCheckbox',
template: `
<input class="hidden" type="checkbox" [attr.name]="name" [attr.checked]="checkedAttribute" [attr.disabled]="isDisabledAttribute" [(ngModel)]="checked">
<input class="hidden" type="checkbox" [attr.name]="name" [attr.checked]="checkedAttribute" [attr.disabled]="isDisabledAttribute" [(ngModel)]="isChecked">
<label>
<ng-content></ng-content>
</label>
`
})
export class SuiCheckbox {
@HostBinding('class.ui')
@HostBinding('class.checkbox') classes = true;
@HostBinding('class.checkbox')
private _classes = true;

@Input() public name:string;
@Input()
public name:string;

@HostBinding('class.checked')
private checked:boolean = false;
public isChecked:boolean = false;

@Output() public checkChange:EventEmitter<boolean> = new EventEmitter<boolean>(false);
@Output()
public checkChange:EventEmitter<boolean> = new EventEmitter<boolean>(false);

@Input()
public isDisabled:boolean = false;

@Input() public isDisabled:boolean = false;
@HostBinding('class.read-only')
@Input() public isReadonly:boolean = false;
@Input()
public isReadonly:boolean = false;

private get checkedAttribute():string {
return this.checked ? "" : null;
public get checkedAttribute():string {
return this.isChecked ? "" : null;
}

private get isDisabledAttribute():string {
public get isDisabledAttribute():string {
return this.isDisabled ? "disabled" : null;
}

Expand All @@ -42,13 +48,13 @@ export class SuiCheckbox {
}

public toggle():void {
this.checked = !this.checked;
this.checkChange.emit(this.checked);
this.isChecked = !this.isChecked;
this.checkChange.emit(this.isChecked);
}

public writeValue(value:boolean) {
setTimeout(() => {
this.checked = value;
this.isChecked = value;
});
}
}
Expand Down
34 changes: 21 additions & 13 deletions components/checkbox/radiobutton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms';
[attr.name]="name"
[attr.checked]="checkedAttribute"
[attr.disabled]="isDisabledAttribute"
[ngModel]="checked"
[ngModel]="isChecked"
(ngModel)="currentValue = value">
<label>
<ng-content></ng-content>
Expand All @@ -20,27 +20,35 @@ import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms';
export class SuiRadioButton {
@HostBinding('class.ui')
@HostBinding('class.radio')
@HostBinding('class.checkbox') classes = true;
@HostBinding('class.checkbox')
private _classes = true;

@Input() public name:string;
@Input() public value:any = "";
@Input()
public name:string;

@Input()
public value:any = "";

@Input()
public isDisabled:boolean = false;

@Input() public isDisabled:boolean = false;
@HostBinding('class.read-only')
@Input() public isReadonly:boolean = false;
@Input()
public isReadonly:boolean = false;

@HostBinding('class.checked')
private checked:boolean = false;
public isChecked:boolean = false;

private currentValue:any;
public currentValue:any;

@Output() public currentValueChange:EventEmitter<any> = new EventEmitter<boolean>(false);
@Output()
public currentValueChange:EventEmitter<any> = new EventEmitter<boolean>(false);

private get checkedAttribute():string {
return this.checked ? "" : null;
public get checkedAttribute():string {
return this.isChecked ? "" : null;
}

private get isDisabledAttribute():string {
public get isDisabledAttribute():string {
return this.isDisabled ? "disabled" : null;
}

Expand All @@ -56,7 +64,7 @@ export class SuiRadioButton {
public update():void {
//This is a horrible hack - need to rewrite!
setTimeout(() => {
this.checked = this.currentValue == this.value;
this.isChecked = this.currentValue == this.value;
});
}

Expand Down
4 changes: 2 additions & 2 deletions components/message/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export class SuiMessage {

private transition:TransitionController = new TransitionController();

private isDismissed:boolean = false;
public isDismissed:boolean = false;

private dismiss():void {
public dismiss():void {
this.transition.animate(new Transition("fade", 300, TransitionDirection.Out, () => {
this.isDismissed = true;
this.onDismiss.emit(this);
Expand Down
16 changes: 11 additions & 5 deletions components/progress/progress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {Component, Input, HostBinding} from '@angular/core';
})
export class SuiProgress {
@HostBinding('class.ui')
@HostBinding('class.progress') classes = true;
@HostBinding('class.progress')
private _classes = true;

@HostBinding('class.success')
private get reachedMaximum() {
Expand All @@ -26,9 +27,14 @@ export class SuiProgress {
private unscaledValue:number = 0;
private _maximum:number = 100;

@Input() public autoSuccess:boolean = true;
@Input() public progress:boolean = true;
@Input() public precision:number = 0;
@Input()
public autoSuccess:boolean = true;

@Input()
public progress:boolean = true;

@Input()
public precision:number = 0;

@Input()
public set value(value:any) {
Expand Down Expand Up @@ -64,7 +70,7 @@ export class SuiProgress {
}

@HostBinding('attr.data-percent')
private get percentage():string {
public get percentage():string {
return this._value.toString();
}

Expand Down
8 changes: 6 additions & 2 deletions components/rating/rating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,20 @@ export class SuiRating {
public set max(value:any) {
this._max = parseInt(value);
}
private get icons() {

public get icons() {
return Array(this._max);
}

@Output() public valueChange:EventEmitter<number> = new EventEmitter<number>(false);
@Output()
public valueChange:EventEmitter<number> = new EventEmitter<number>(false);

private _hoveredIndex:number = -1;

private mouseover(i:number) {
this._hoveredIndex = i;
}

@HostListener('mouseout')
private mouseout() {
this._hoveredIndex = -1;
Expand Down
2 changes: 1 addition & 1 deletion components/select/multi-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {KeyCode} from '../util/util';
<!-- Query input -->
<input [hidden]="!isSearchable" class="search" type="text" autocomplete="off" [(ngModel)]="query" (keydown)="onQueryInputKeydown($event)" #queryInput>
<!-- Placeholder text -->
<div *ngIf="!selectedOption" class="default text" [class.filtered]="!!query">{{ placeholder }}</div>
<div class="default text" [class.filtered]="!!query">{{ placeholder }}</div>
<!-- Select dropdown menu -->
<div class="menu" suiDropdownMenu [menuAutoSelectFirst]="true">
<ng-content></ng-content>
Expand Down
2 changes: 1 addition & 1 deletion components/select/select-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export abstract class SuiSelectBase<T, U> implements AfterContentInit {

// Keep track of all of the rendered select options. (Rendered by the user using *ngFor).
@ContentChildren(SuiSelectOption, { descendants: true })
private _renderedOptions:QueryList<SuiSelectOption<T>>;
protected _renderedOptions:QueryList<SuiSelectOption<T>>;

// Keep track of all of the subscriptions to the selected events on the rendered options.
private _renderedSubscriptions:Subscription[];
Expand Down
8 changes: 6 additions & 2 deletions components/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ export class SuiSelect<T, U> extends SuiSelectBase<T, U> {
this.searchService.updateQueryDelayed("");

this.drawSelectedOption();
// Adds the active property to the items.
this.onAvailableOptionsRendered();

// Automatically refocus the search input for better keyboard accessibility.
this.focusInput();
Expand All @@ -97,6 +95,7 @@ export class SuiSelect<T, U> extends SuiSelectBase<T, U> {
(this.searchService.itemLookup<U>(value) as Promise<T>)
.then(r => {
this.selectedOption = r;

this.drawSelectedOption();
});
return;
Expand All @@ -119,6 +118,11 @@ export class SuiSelect<T, U> extends SuiSelectBase<T, U> {
}

private drawSelectedOption() {
// Updates the active class on the newly selected option.
if (this._renderedOptions) {
this.onAvailableOptionsRendered();
}

if (this.selectedOption && this.optionTemplate) {
this.drawTemplate(this._optionTemplateSibling, this.selectedOption);
}
Expand Down
4 changes: 2 additions & 2 deletions demo/src/app/components/codeblock/codeblock.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export class CodeblockComponent implements AfterViewInit {
@Input()
public src:string;

private html:string;
public html:string;

private languageClass:any = {};
public languageClass:any = {};

constructor(private changeDetectorRef:ChangeDetectorRef) {}

Expand Down
2 changes: 1 addition & 1 deletion demo/src/app/components/example/example.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Component, Input} from '@angular/core';
styleUrls: ['./example.component.css']
})
export class ExampleComponent {
private detail:boolean = false;
public detail:boolean = false;

@Input()
public code:string;
Expand Down
Loading

0 comments on commit e62b6e7

Please sign in to comment.