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): add md-datepicker-trigger & compatibility w/ md-inp…
…ut-container (angular#3468) feat(datepicker): add mdDatepickerToggle & compatibility w/ md-input-container
- Loading branch information
Showing
11 changed files
with
206 additions
and
57 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 |
---|---|---|
@@ -1,6 +1,25 @@ | ||
<h1>Work in progress, not ready for use.</h1> | ||
|
||
<input [mdDatepicker]="dp" [(ngModel)]="date"> | ||
<button (click)="dp.openStandardUi()">open</button> | ||
<button (click)="dp.openTouchUi()">open (mobile)</button> | ||
<md-datepicker #dp></md-datepicker> | ||
<p> | ||
<md-checkbox [(ngModel)]="touch">Use touch UI</md-checkbox> | ||
</p> | ||
<br> | ||
<p> | ||
<input [mdDatepicker]="dp" [(ngModel)]="date"> | ||
<button [mdDatepickerToggle]="dp"></button> | ||
<md-datepicker #dp [touchUi]="touch"></md-datepicker> | ||
</p> | ||
<p> | ||
<md-input-container> | ||
<input mdInput [mdDatepicker]="dp2" [(ngModel)]="date"> | ||
<button [mdDatepickerToggle]="dp2"></button> | ||
<md-datepicker #dp2 [touchUi]="touch"></md-datepicker> | ||
</md-input-container> | ||
</p> | ||
<p> | ||
<button [mdDatepickerToggle]="dp3"></button> | ||
<md-input-container> | ||
<input mdInput [mdDatepicker]="dp3" [(ngModel)]="date"> | ||
<md-datepicker #dp3 [touchUi]="touch"></md-datepicker> | ||
</md-input-container> | ||
</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
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,13 @@ | ||
$mat-datepicker-toggle-icon-size: 24px !default; | ||
|
||
|
||
.mat-datepicker-toggle { | ||
display: inline-block; | ||
background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="currentColor"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z"/></svg>') no-repeat; | ||
background-size: contain; | ||
height: $mat-datepicker-toggle-icon-size; | ||
width: $mat-datepicker-toggle-icon-size; | ||
border: none; | ||
outline: none; | ||
vertical-align: middle; | ||
} |
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,30 @@ | ||
import {ChangeDetectionStrategy, Component, Input, ViewEncapsulation} from '@angular/core'; | ||
import {MdDatepicker} from './datepicker'; | ||
|
||
|
||
@Component({ | ||
moduleId: module.id, | ||
selector: 'button[mdDatepickerToggle], button[matDatepickerToggle]', | ||
template: '', | ||
styleUrls: ['datepicker-toggle.css'], | ||
host: { | ||
'[class.mat-datepicker-toggle]': 'true', | ||
'(click)': '_open($event)', | ||
}, | ||
encapsulation: ViewEncapsulation.None, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class MdDatepickerToggle { | ||
@Input('mdDatepickerToggle') datepicker: MdDatepicker; | ||
|
||
@Input('matDatepickerToggle') | ||
get _datepicker() { return this.datepicker; } | ||
set _datepicker(v: MdDatepicker) { this.datepicker = v; } | ||
|
||
_open(event: Event): void { | ||
if (this.datepicker) { | ||
this.datepicker.open(); | ||
event.stopPropagation(); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.