forked from angular/components
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(datepicker): merge datepicker branch into master (angular#4404)
- Loading branch information
1 parent
1ec88e0
commit 141fe87
Showing
63 changed files
with
5,281 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<h2>Options</h2> | ||
<p> | ||
<md-checkbox [(ngModel)]="touch">Use touch UI</md-checkbox> | ||
<md-checkbox [(ngModel)]="filterOdd">Filter odd months and dates</md-checkbox> | ||
<md-checkbox [(ngModel)]="yearView">Start in year view</md-checkbox> | ||
</p> | ||
<p> | ||
<md-input-container> | ||
<input mdInput [mdDatepicker]="minDatePicker" [(ngModel)]="minDate" placeholder="Min date"> | ||
<button mdSuffix [mdDatepickerToggle]="minDatePicker"></button> | ||
</md-input-container> | ||
<md-datepicker #minDatePicker [touchUi]="touch"></md-datepicker> | ||
<md-input-container> | ||
<input mdInput [mdDatepicker]="maxDatePicker" [(ngModel)]="maxDate" placeholder="Max date"> | ||
<button mdSuffix [mdDatepickerToggle]="maxDatePicker"></button> | ||
</md-input-container> | ||
<md-datepicker #maxDatePicker [touchUi]="touch"></md-datepicker> | ||
</p> | ||
<p> | ||
<md-input-container> | ||
<input mdInput [mdDatepicker]="startAtPicker" [(ngModel)]="startAt" placeholder="Start at date"> | ||
<button mdSuffix [mdDatepickerToggle]="startAtPicker"></button> | ||
</md-input-container> | ||
<md-datepicker #startAtPicker [touchUi]="touch"></md-datepicker> | ||
</p> | ||
|
||
<h2>Result</h2> | ||
|
||
<p> | ||
<button [mdDatepickerToggle]="resultPicker"></button> | ||
<md-input-container> | ||
<input mdInput | ||
#resultPickerModel="ngModel" | ||
[mdDatepicker]="resultPicker" | ||
[(ngModel)]="date" | ||
[min]="minDate" | ||
[max]="maxDate" | ||
[mdDatepickerFilter]="filterOdd ? dateFilter : null" | ||
placeholder="Pick a date"> | ||
<md-error *ngIf="resultPickerModel.hasError('mdDatepickerMin')">Too early!</md-error> | ||
<md-error *ngIf="resultPickerModel.hasError('mdDatepickerMax')">Too late!</md-error> | ||
<md-error *ngIf="resultPickerModel.hasError('mdDatepickerFilter')">Date unavailable!</md-error> | ||
</md-input-container> | ||
<md-datepicker | ||
#resultPicker | ||
[touchUi]="touch" | ||
[startAt]="startAt" | ||
[startView]="yearView ? 'year' : 'month'"> | ||
</md-datepicker> | ||
</p> | ||
<p> | ||
<input [mdDatepicker]="resultPicker2" | ||
[(ngModel)]="date" | ||
[min]="minDate" | ||
[max]="maxDate" | ||
[mdDatepickerFilter]="filterOdd ? dateFilter : null" | ||
placeholder="Pick a date"> | ||
<button [mdDatepickerToggle]="resultPicker2"></button> | ||
<md-datepicker | ||
#resultPicker2 | ||
[touchUi]="touch" | ||
[startAt]="startAt" | ||
[startView]="yearView ? 'year' : 'month'"> | ||
</md-datepicker> | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
md-calendar { | ||
width: 300px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {Component} from '@angular/core'; | ||
|
||
|
||
@Component({ | ||
moduleId: module.id, | ||
selector: 'datepicker-demo', | ||
templateUrl: 'datepicker-demo.html', | ||
styleUrls: ['datepicker-demo.css'], | ||
}) | ||
export class DatepickerDemo { | ||
touch: boolean; | ||
filterOdd: boolean; | ||
yearView: boolean; | ||
minDate: Date; | ||
maxDate: Date; | ||
startAt: Date; | ||
date: Date; | ||
dateFilter = (date: Date) => date.getMonth() % 2 == 1 && date.getDate() % 2 == 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<h1>Single Expansion Panel</h1> | ||
<md-expansion-panel class="md-expansion-demo-width" #myPanel> | ||
<md-expansion-panel-header> | ||
<span class="title">Panel Title</span> | ||
<span class="description">This is a panel description.</span> | ||
</md-expansion-panel-header> | ||
This is the content text that makes sense here. | ||
<div md-action-row> | ||
<button md-button (click)="myPanel.expanded = false">CANCEL</button> | ||
<button md-button>SAVE</button> | ||
</div> | ||
</md-expansion-panel> | ||
<br> | ||
<h1>Accordion</h1> | ||
<div> | ||
<p>Accordion Options</p> | ||
<div> | ||
<md-slide-toggle [(ngModel)]="multi">Allow Multi Expansion</md-slide-toggle> | ||
<md-slide-toggle [(ngModel)]="showToggle">Show Indicators</md-slide-toggle> | ||
<md-slide-toggle [(ngModel)]="showPanel3">Show Panel 3</md-slide-toggle> | ||
</div> | ||
<p>Accordion Style</p> | ||
<md-radio-group [(ngModel)]="displayMode"> | ||
<md-radio-button value="default">Default</md-radio-button> | ||
<md-radio-button value="flat">Flat</md-radio-button> | ||
</md-radio-group> | ||
<p>Accordion Panel(s)</p> | ||
<div> | ||
<md-checkbox [(ngModel)]="panel1.expanded">Panel 1</md-checkbox> | ||
<md-checkbox [(ngModel)]="panel2.expanded">Panel 2</md-checkbox> | ||
</div> | ||
</div> | ||
<br> | ||
<div cdk-accordion [displayMode]="displayMode" [multi]="multi" | ||
class="md-expansion-demo-width"> | ||
<md-expansion-panel #panel1 [showToggle]="showToggle"> | ||
<md-expansion-panel-header> | ||
Section 1 | ||
</md-expansion-panel-header> | ||
<p>This is the content text that makes sense here.</p> | ||
</md-expansion-panel> | ||
<md-expansion-panel #panel2 [showToggle]="showToggle"> | ||
<md-expansion-panel-header> | ||
Section 2 | ||
</md-expansion-panel-header> | ||
<p>This is the content text that makes sense here.</p> | ||
</md-expansion-panel> | ||
<md-expansion-panel #panel3 *ngIf="showPanel3" [showToggle]="showToggle"> | ||
<md-expansion-panel-header> | ||
Section 3 | ||
</md-expansion-panel-header> | ||
<md-checkbox #showButtons>Reveal Buttons Below</md-checkbox> | ||
<div md-action-row *ngIf="showButtons.checked"> | ||
<button md-button (click)="panel2.expanded = true">OPEN SECTION 2</button> | ||
<button md-button (click)="panel3.expanded = false">CLOSE</button> | ||
</div> | ||
</md-expansion-panel> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.md-expansion-demo-width { | ||
width: 600px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {Component, ViewEncapsulation} from '@angular/core'; | ||
|
||
@Component({ | ||
moduleId: module.id, | ||
selector: 'expansion-demo', | ||
styleUrls: ['expansion-demo.css'], | ||
templateUrl: 'expansion-demo.html', | ||
encapsulation: ViewEncapsulation.None, | ||
}) | ||
export class ExpansionDemo { | ||
displayMode: string = 'default'; | ||
multi: boolean = false; | ||
showToggle: boolean = true; | ||
showPanel3 = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.