Skip to content

Commit f417435

Browse files
committed
Fix indention
1 parent 5e9085f commit f417435

File tree

16 files changed

+216
-217
lines changed

16 files changed

+216
-217
lines changed

src/cdk/stepper/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import {CdkStep} from './step';
1313
import {CdkStepLabel} from './step-label';
1414
import {PortalModule} from '../portal';
1515
@NgModule({
16-
imports: [CommonModule, PortalModule],
17-
exports: [CdkStep, CdkStepper, CdkStepLabel],
18-
declarations: [CdkStep, CdkStepper, CdkStepLabel]
16+
imports: [CommonModule, PortalModule],
17+
exports: [CdkStep, CdkStepper, CdkStepLabel],
18+
declarations: [CdkStep, CdkStepper, CdkStepLabel]
1919
})
2020
export class CdkStepperModule {}
2121

src/cdk/stepper/step-label.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
import {Directive, TemplateRef, ViewContainerRef} from '@angular/core';
1010
import {TemplatePortalDirective} from '../portal';
1111
@Directive({
12-
selector: '[cdk-step-label]',
12+
selector: '[cdk-step-label]',
1313
})
1414
export class CdkStepLabel extends TemplatePortalDirective {
15-
constructor(templateRef: TemplateRef<any>, viewContainerRef: ViewContainerRef) {
16-
super(templateRef, viewContainerRef);
17-
}
15+
constructor(templateRef: TemplateRef<any>, viewContainerRef: ViewContainerRef) {
16+
super(templateRef, viewContainerRef);
17+
}
1818
}

src/cdk/stepper/step.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<ng-template><ng-content></ng-content></ng-template>
1+
<ng-template><ng-content></ng-content></ng-template>

src/cdk/stepper/step.ts

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,50 +7,50 @@
77
*/
88

99
import {
10-
Component, ContentChild, Directive, Input, OnInit, TemplateRef, ViewChild,
11-
ViewContainerRef
10+
Component, ContentChild, Directive, Input, OnInit, TemplateRef, ViewChild,
11+
ViewContainerRef
1212
} from '@angular/core';
1313
import {CdkStepLabel} from './step-label';
1414

1515
@Component({
16-
selector: '[cdk-step]',
17-
templateUrl: 'step.html',
16+
selector: '[cdk-step]',
17+
templateUrl: 'step.html',
1818
})
1919
export class CdkStep {
20-
@ContentChild(CdkStepLabel) stepLabel: CdkStepLabel;
21-
@ViewChild(TemplateRef) content: TemplateRef<any>;
22-
23-
/** Label of the step. */
24-
@Input()
25-
label: string;
26-
27-
/** Whether the step is optional or not. */
28-
@Input() optional: boolean = false;
29-
30-
/** Whether the step is editable or not. */
31-
@Input() editable: boolean = true;
32-
33-
/** Whether the step is the last one in the list. */
34-
isLast: boolean = false;
35-
36-
// /** Whether the step is active. */
37-
// get active() { return this._active; }
38-
// set active(value: boolean) {
39-
// this._active = value;
40-
// }
41-
// private _active: boolean = false;
42-
43-
/** Whether the step has been selected. */
44-
get selected(): boolean { return this._selected; }
45-
set selected(value: boolean) {
46-
this._selected = value;
47-
}
48-
private _selected: boolean = false;
49-
50-
/** Whether the step has been completed. */
51-
get completed() { return this._completed; }
52-
set completed(value: boolean) {
53-
this._completed = value;
54-
}
55-
private _completed: boolean = false;
20+
@ContentChild(CdkStepLabel) stepLabel: CdkStepLabel;
21+
@ViewChild(TemplateRef) content: TemplateRef<any>;
22+
23+
/** Label of the step. */
24+
@Input()
25+
label: string;
26+
27+
/** Whether the step is optional or not. */
28+
@Input() optional: boolean = false;
29+
30+
/** Whether the step is editable or not. */
31+
@Input() editable: boolean = true;
32+
33+
/** Whether the step is the last one in the list. */
34+
isLast: boolean = false;
35+
36+
// /** Whether the step is active. */
37+
// get active() { return this._active; }
38+
// set active(value: boolean) {
39+
// this._active = value;
40+
// }
41+
// private _active: boolean = false;
42+
43+
/** Whether the step has been selected. */
44+
get selected(): boolean { return this._selected; }
45+
set selected(value: boolean) {
46+
this._selected = value;
47+
}
48+
private _selected: boolean = false;
49+
50+
/** Whether the step has been completed. */
51+
get completed() { return this._completed; }
52+
set completed(value: boolean) {
53+
this._completed = value;
54+
}
55+
private _completed: boolean = false;
5656
}

src/cdk/stepper/stepper.ts

Lines changed: 123 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
*/
88

99
import {
10-
Component, ContentChildren, EventEmitter, Input, Output, QueryList, OnInit,
11-
AfterViewChecked, AfterViewInit, Directive, ElementRef, ViewChild, ViewChildren
10+
Component, ContentChildren, EventEmitter, Input, Output, QueryList, OnInit,
11+
AfterViewChecked, AfterViewInit, Directive, ElementRef, ViewChild, ViewChildren
1212
} from '@angular/core';
1313
import {CdkStep} from './step';
1414
import {Observable} from 'rxjs/Observable';
@@ -20,134 +20,134 @@ let nextId = 0;
2020

2121
/** Change event emitted on focus or selection changes. */
2222
export class CdkStepEvent {
23-
index: number;
24-
step: CdkStep;
23+
index: number;
24+
step: CdkStep;
2525
}
2626

2727
@Directive({
28-
selector: '[cdkStepper]',
29-
host: {
30-
'(keydown)': '_onKeydown($event)'
31-
},
28+
selector: '[cdkStepper]',
29+
host: {
30+
'(keydown)': '_onKeydown($event)'
31+
},
3232
})
3333
export class CdkStepper {
34-
@ContentChildren(CdkStep) _steps: QueryList<CdkStep>;
35-
36-
@ViewChildren('stepHeader') _stepHeader: QueryList<ElementRef>;
37-
38-
/** The index of the currently selected step. */
39-
@Input()
40-
set selectedIndex(value: number) {
41-
this._selectedIndex = value;
42-
}
43-
get selectedIndex(): number { return this._selectedIndex; }
44-
private _selectedIndex: number;
45-
46-
/** Optional input to support both linear and non-linear stepper component. */
47-
@Input() linear: boolean = true;
48-
49-
/** Output to enable support for two-way binding on `[(selectedIndex)]` */
50-
@Output() get selectedIndexChange(): Observable<number> {
51-
return map.call(this.stepEvent, event => event.index);
52-
}
53-
54-
// @Output() get focusIndexChange(): Observable<number> {
55-
// return map.call(this.focusChange, event => event.index);
56-
// }
57-
58-
/** Event emitted when the selected step has changed. */
59-
@Output() stepEvent = new EventEmitter<CdkStepEvent>();
60-
61-
/** Event emitted when the focused step has changed. */
62-
@Output() focusChange = new EventEmitter<CdkStepEvent>();
63-
64-
/** The step that is currently selected. */
65-
get selectedStep(): CdkStep {
66-
return this._steps.toArray()[this._selectedIndex];
67-
}
68-
private _selectedStep: CdkStep;
69-
70-
/** The index of the step that the focus is currently on. */
71-
get focusIndex(): number {return this._focusIndex; }
72-
private _focusIndex: number = 0;
73-
74-
private _groupId: number;
75-
76-
constructor() {
77-
this._groupId = nextId++;
78-
}
79-
80-
/** Selects and focuses the provided step. */
81-
selectStep(step: CdkStep): void {
82-
let stepsArray = this._steps.toArray();
83-
this._selectedIndex = stepsArray.indexOf(step);
84-
this.stepEvent.emit(this._emitStepEvent(this._selectedIndex));
85-
this._focusIndex = this._selectedIndex;
86-
this._setStepFocus();
87-
}
88-
89-
/** Selects and focuses the next step in list. */
90-
nextStep(): void {
91-
if (this._selectedIndex == this._steps.length - 1) { return; }
92-
this._selectedIndex++;
93-
this.stepEvent.emit(this._emitStepEvent(this._selectedIndex));
94-
this._focusIndex = this._selectedIndex;
95-
this._setStepFocus();
96-
}
97-
98-
/** Selects and focuses the previous step in list. */
99-
previousStep(): void {
100-
if (this._selectedIndex == 0) { return; }
101-
this._selectedIndex--;
102-
this.stepEvent.emit(this._emitStepEvent(this._selectedIndex));
103-
this._focusIndex = this._selectedIndex;
104-
this._setStepFocus();
105-
}
106-
107-
/** Returns a unique id for each step label element. */
108-
_getStepLabelId(i: number): string {
109-
return `mat-step-label-${this._groupId}-${i}`;
110-
}
111-
112-
/** Returns a unique id for each step content element. */
113-
_getStepContentId(i: number): string {
114-
return `mat-step-content-${this._groupId}-${i}`;
115-
}
116-
117-
private _emitStepEvent(index: number): CdkStepEvent {
118-
const event = new CdkStepEvent();
119-
event.index = index;
120-
event.step = this._steps.toArray()[this._selectedIndex];
121-
this._selectedStep = event.step;
122-
return event;
123-
}
124-
125-
_onKeydown(event: KeyboardEvent) {
126-
switch (event.keyCode) {
127-
case RIGHT_ARROW:
128-
if (this._focusIndex != this._steps.length - 1) {
129-
this._focusIndex++;
130-
this._setStepFocus();
131-
}
132-
break;
133-
case LEFT_ARROW:
134-
if (this._focusIndex != 0) {
135-
this._focusIndex--;
136-
this._setStepFocus();
137-
}
138-
break;
139-
case ENTER:
140-
this._selectedIndex = this._focusIndex;
141-
this._emitStepEvent(this._selectedIndex);
142-
break;
34+
@ContentChildren(CdkStep) _steps: QueryList<CdkStep>;
35+
36+
@ViewChildren('stepHeader') _stepHeader: QueryList<ElementRef>;
37+
38+
/** The index of the currently selected step. */
39+
@Input()
40+
set selectedIndex(value: number) {
41+
this._selectedIndex = value;
42+
}
43+
get selectedIndex(): number { return this._selectedIndex; }
44+
private _selectedIndex: number;
45+
46+
/** Optional input to support both linear and non-linear stepper component. */
47+
@Input() linear: boolean = true;
48+
49+
/** Output to enable support for two-way binding on `[(selectedIndex)]` */
50+
@Output() get selectedIndexChange(): Observable<number> {
51+
return map.call(this.stepEvent, event => event.index);
52+
}
53+
54+
// @Output() get focusIndexChange(): Observable<number> {
55+
// return map.call(this.focusChange, event => event.index);
56+
// }
57+
58+
/** Event emitted when the selected step has changed. */
59+
@Output() stepEvent = new EventEmitter<CdkStepEvent>();
60+
61+
/** Event emitted when the focused step has changed. */
62+
@Output() focusChange = new EventEmitter<CdkStepEvent>();
63+
64+
/** The step that is currently selected. */
65+
get selectedStep(): CdkStep {
66+
return this._steps.toArray()[this._selectedIndex];
67+
}
68+
private _selectedStep: CdkStep;
69+
70+
/** The index of the step that the focus is currently on. */
71+
get focusIndex(): number {return this._focusIndex; }
72+
private _focusIndex: number = 0;
73+
74+
private _groupId: number;
75+
76+
constructor() {
77+
this._groupId = nextId++;
78+
}
79+
80+
/** Selects and focuses the provided step. */
81+
selectStep(step: CdkStep): void {
82+
let stepsArray = this._steps.toArray();
83+
this._selectedIndex = stepsArray.indexOf(step);
84+
this.stepEvent.emit(this._emitStepEvent(this._selectedIndex));
85+
this._focusIndex = this._selectedIndex;
86+
this._setStepFocus();
87+
}
88+
89+
/** Selects and focuses the next step in list. */
90+
nextStep(): void {
91+
if (this._selectedIndex == this._steps.length - 1) { return; }
92+
this._selectedIndex++;
93+
this.stepEvent.emit(this._emitStepEvent(this._selectedIndex));
94+
this._focusIndex = this._selectedIndex;
95+
this._setStepFocus();
96+
}
97+
98+
/** Selects and focuses the previous step in list. */
99+
previousStep(): void {
100+
if (this._selectedIndex == 0) { return; }
101+
this._selectedIndex--;
102+
this.stepEvent.emit(this._emitStepEvent(this._selectedIndex));
103+
this._focusIndex = this._selectedIndex;
104+
this._setStepFocus();
105+
}
106+
107+
/** Returns a unique id for each step label element. */
108+
_getStepLabelId(i: number): string {
109+
return `mat-step-label-${this._groupId}-${i}`;
110+
}
111+
112+
/** Returns a unique id for each step content element. */
113+
_getStepContentId(i: number): string {
114+
return `mat-step-content-${this._groupId}-${i}`;
115+
}
116+
117+
private _emitStepEvent(index: number): CdkStepEvent {
118+
const event = new CdkStepEvent();
119+
event.index = index;
120+
event.step = this._steps.toArray()[this._selectedIndex];
121+
this._selectedStep = event.step;
122+
return event;
123+
}
124+
125+
_onKeydown(event: KeyboardEvent) {
126+
switch (event.keyCode) {
127+
case RIGHT_ARROW:
128+
if (this._focusIndex != this._steps.length - 1) {
129+
this._focusIndex++;
130+
this._setStepFocus();
143131
}
144-
if (event.keyCode != TAB) {
145-
event.preventDefault();
132+
break;
133+
case LEFT_ARROW:
134+
if (this._focusIndex != 0) {
135+
this._focusIndex--;
136+
this._setStepFocus();
146137
}
138+
break;
139+
case ENTER:
140+
this._selectedIndex = this._focusIndex;
141+
this._emitStepEvent(this._selectedIndex);
142+
break;
147143
}
148-
149-
_setStepFocus() {
150-
this._stepHeader.toArray()[this._focusIndex].nativeElement.focus();
151-
this.focusChange.emit(this._emitStepEvent(this._selectedIndex));
144+
if (event.keyCode != TAB) {
145+
event.preventDefault();
152146
}
147+
}
148+
149+
_setStepFocus() {
150+
this._stepHeader.toArray()[this._focusIndex].nativeElement.focus();
151+
this.focusChange.emit(this._emitStepEvent(this._selectedIndex));
152+
}
153153
}

src/demo-app/stepper/stepper-demo.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ <h2>Horizontal Stepper Demo</h2>
55
<input mdInput placeholder="Answer" [(ngModel)]="step.content">
66
</md-input-container>
77
</mat-step>
8-
</mat-horizontal-stepper>
8+
</mat-horizontal-stepper>

0 commit comments

Comments
 (0)