Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
33c6299
Prototyping
jwshinjwshin Jun 29, 2017
366b4c3
Further work
jwshinjwshin Jun 30, 2017
d8e3075
Further prototyping
jwshinjwshin Jul 1, 2017
f94d966
Further prototyping
jwshinjwshin Jul 1, 2017
23bfd0c
Further work
jwshinjwshin Jul 5, 2017
63d141e
Adding event emitters
jwshinjwshin Jul 6, 2017
471df0f
Adding "selectedIndex" attribute to stepper and working on TemplateOu…
jwshinjwshin Jul 6, 2017
1d6ebb2
Prototyping
jwshinjwshin Jun 29, 2017
03e5849
Further work
jwshinjwshin Jun 30, 2017
c1cb73f
Further prototyping
jwshinjwshin Jul 1, 2017
e90c839
Further prototyping
jwshinjwshin Jul 1, 2017
992a07a
Further work
jwshinjwshin Jul 5, 2017
9e5720a
Adding event emitters
jwshinjwshin Jul 6, 2017
66bec54
Merge branch 'stepper1' of github.com:g1shin/material2 into stepper1
jwshinjwshin Jul 6, 2017
617c270
Template rendering and selectIndex control done.
jwshinjwshin Jul 6, 2017
42c1f14
Work in progress for accessibility
jwshinjwshin Jul 7, 2017
b879732
Added functionalities based on the tentative API doc.
jwshinjwshin Jul 7, 2017
f89b8bc
Refactor code for cdk-stepper and cdk-step
jwshinjwshin Jul 11, 2017
a529bf3
Add support for templated label
jwshinjwshin Jul 11, 2017
34ac69e
Added support for keyboard events and focus changes for accessibility.
jwshinjwshin Jul 13, 2017
aee0abf
Updated vertical stepper + added comments
jwshinjwshin Jul 13, 2017
fcb94ff
Merge remote-tracking branch 'upstream/master' into stepper2
jwshinjwshin Jul 13, 2017
5e9085f
Fix package-lock.json
jwshinjwshin Jul 13, 2017
f417435
Fix indention
jwshinjwshin Jul 13, 2017
36ad2cc
Changes made based on the review
jwshinjwshin Jul 14, 2017
836c0ac
Changes based on review - event properties, selectors, SPACE support,…
jwshinjwshin Jul 15, 2017
78c9eb5
Add select() for step component + refactor to avoid circular dependen…
jwshinjwshin Jul 18, 2017
26f73f9
API change based on review
jwshinjwshin Jul 19, 2017
a56e57f
Minor code clean up based on review.
jwshinjwshin Jul 20, 2017
3c1f4fd
Several name changes, etc based on review
jwshinjwshin Jul 21, 2017
0c3f7c4
Add to compatibility mode list and refactor to avoid circular dependency
jwshinjwshin Jul 21, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added functionalities based on the tentative API doc.
  • Loading branch information
jwshinjwshin committed Jul 7, 2017
commit b8797326cff4341fd9857bc3b0817df1e47fb4a3
8 changes: 4 additions & 4 deletions src/demo-app/stepper/stepper-demo.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<h2>Veritcal Stepper Demo</h2>
<mat-stepper [orientation]="'vertical'" [(selectedIndex)]="verticalActiveIndex">
<mat-step *ngFor="let step of steps" [label]="step.label"
[active]="step.active" [completed]="step.completed">
<mat-step *ngFor="let step of steps" [label]="step.label">
<div>{{step.content}}</div>
<div>optional {{step.optional}}</div>
<div>editable {{step.editable}}</div>
</mat-step>
</mat-stepper>

<h2>Horizontal Stepper Demo</h2>
<mat-stepper [orientation]="'horizontal'" [(selectedIndex)]="horizontalActiveIndex">
<mat-step *ngFor="let step of steps" [label]="step.label"
[active]="step.active" [completed]="step.completed">
<mat-step *ngFor="let step of steps" [label]="step.label">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indent 2

<div>{{step.content}}</div>
</mat-step>
</mat-stepper>
4 changes: 2 additions & 2 deletions src/demo-app/stepper/stepper-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class StepperDemo {
horizontalActiveIndex = 0;
steps = [
{label: 'Step 1', content: 'Content 1'},
{label: 'Step 2', content: 'Content 2'},
{label: 'Step 3', content: 'Content 3'},
{label: 'Step 2', content: 'Content 2', optional: true},
{label: 'Step 3', content: 'Content 3', editable: false},
];
}
32 changes: 20 additions & 12 deletions src/lib/stepper/step.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import {Component, ContentChild, Input, OnInit, TemplateRef, ViewChild, ViewContainerRef} from '@angular/core';
import {TemplatePortal} from '../core/portal/portal';
import {coerceBooleanProperty} from "@angular/cdk";

@Component({
moduleId: module.id,
Expand All @@ -20,30 +21,37 @@ export class MdStep {
// @ViewChild(PortalHostDirective) _portalHost: PortalHostDirective;

@Input()
label: string;

/** Whether the step is optional or not. */
@Input() optional: boolean = false;

/** Whether the step is editable or not. */
@Input() editable: boolean = true;

isLast: boolean = false;

/** Whether the step is active. */
get active() { return this._active; }
set active(value: boolean) {
this._active = value;
}
private _active: boolean = true;
private _active: boolean = false;

@Input()
label: string;
/** Whether the step has been selected. */
get selected(): boolean { return this._selected; }
set selected(value: boolean) {
this._selected = value;
}
private _selected: boolean = false;

@Input()
/** Whether the step has been completed. */
get completed() { return this._completed; }
set completed(value: boolean) {
this._completed = value;
}
private _completed: boolean = false;

isLast: boolean = false;

private _selected: boolean = false;
set selected(value: boolean) {
this._selected = value;
}
get selected(): boolean { return this._selected; }

// /** The portal that will be the hosted content of the step */
// private _contentPortal: TemplatePortal | null = null;
// get content(): TemplatePortal | null { return this._contentPortal; }
Expand Down
6 changes: 4 additions & 2 deletions src/lib/stepper/stepper.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<div *ngIf="orientation == 'vertical' && indexOf(step) == selectedIndex">
<ng-container [ngTemplateOutlet]="step.stepContent"></ng-container>
<div>
<button md-button (click)="nextStep()">Continue</button>
<button md-button (click)="previousStep()">Back</button>
<button md-button (click)="nextStep()">Next</button>
<button md-button>Cancel</button>
</div>
</div>
Expand All @@ -21,7 +22,8 @@
<div class="mat-stepper-horizontal" *ngIf="orientation == 'horizontal'">
<ng-container [ngTemplateOutlet]="selectedStep.stepContent">
<div>
<button md-button (click)="nextStep()">Continue</button>
<button md-button (click)="previousStep()">Back</button>
<button md-button (click)="nextStep()">Next</button>
<button md-button>Cancel</button>
</div>
</ng-container>
Expand Down
15 changes: 14 additions & 1 deletion src/lib/stepper/stepper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ export class MdStepper {

@ContentChildren(MdStep) _steps: QueryList<MdStep>;

/** Orientation of the stepper component. */
@Input()
get orientation() { return this._orientation; }
set orientation(value: string) {
this._orientation = value;
}
private _orientation: string;

/** The index of the active tab. */
/** The index of the currently selected step. */
@Input()
set selectedIndex(value: number) {
this._selectedIndex = value;
Expand All @@ -51,10 +52,15 @@ export class MdStepper {
get selectedIndex(): number { return this._selectedIndex; }
private _selectedIndex: number;

/** Optional input to support both linear and non-linear stepper component. */
@Input() linear: boolean = true;

/** Output to enable support for two-way binding on `[(selectedIndex)]` */
@Output() get selectedIndexChange(): Observable<number> {
return map.call(this.stepChangeEvent, event => event.index);
}

/** Event emitted when the selected step has changed. */
@Output() stepChangeEvent = new EventEmitter<MdStepChangeEvent>();

get selectedStep(): MdStep {
Expand All @@ -80,10 +86,17 @@ export class MdStepper {
}

nextStep(): void {
if (this._selectedIndex == this._steps.length - 1) { return; }
this._selectedIndex++;
this.stepChangeEvent.emit(this._emitStepChangeEvent());
}

previousStep(): void {
if (this._selectedIndex == 0) { return; }
this._selectedIndex--;
this.stepChangeEvent.emit(this._emitStepChangeEvent());
}

private _emitStepChangeEvent(): MdStepChangeEvent {
const event = new MdStepChangeEvent();
event.index = this._selectedIndex;
Expand Down