-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#163): support for action buttons
- Loading branch information
Showing
11 changed files
with
208 additions
and
74 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 |
---|---|---|
|
@@ -144,4 +144,5 @@ | |
[twelvehour]="twelvehour" | ||
> | ||
</mat-datetimepicker-clock> | ||
<ng-content></ng-content> | ||
</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
18 changes: 18 additions & 0 deletions
18
projects/core/src/datetimepicker/datetimepicker-actions.component.html
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,18 @@ | ||
<div class="mat-datetimepicker-actions"> | ||
<button | ||
mat-button | ||
color="primary" | ||
type="button" | ||
(click)="handleCancelButton($event)" | ||
> | ||
{{ cancelButtonLabel }} | ||
</button> | ||
<button | ||
mat-raised-button | ||
color="primary" | ||
type="button" | ||
(click)="handleConfirmButton($event)" | ||
> | ||
{{ confirmButtonLabel }} | ||
</button> | ||
</div> |
4 changes: 4 additions & 0 deletions
4
projects/core/src/datetimepicker/datetimepicker-actions.component.scss
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,4 @@ | ||
.mat-datetimepicker-actions { | ||
display: flex; | ||
justify-content: flex-end; | ||
} |
36 changes: 36 additions & 0 deletions
36
projects/core/src/datetimepicker/datetimepicker-actions.component.ts
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,36 @@ | ||
import { Component, Input } from '@angular/core'; | ||
|
||
import { MatDatetimepickerComponent } from './datetimepicker'; | ||
|
||
@Component({ | ||
selector: 'mat-datetimepicker-actions', | ||
templateUrl: 'datetimepicker-actions.component.html', | ||
styleUrls: ['datetimepicker-actions.component.scss'], | ||
}) | ||
export class MatDatetimepickerActionsComponent { | ||
@Input() protected confirmButtonLabel = 'Confirm'; | ||
@Input() protected cancelButtonLabel = 'Cancel'; | ||
|
||
private datetimepicker: MatDatetimepickerComponent<any>; | ||
|
||
public fromTemplateWithDatetimepicker( | ||
matDatetimepickerActions: MatDatetimepickerActionsComponent, | ||
datetimepicker: MatDatetimepickerComponent<any> | ||
) { | ||
this.confirmButtonLabel = matDatetimepickerActions.confirmButtonLabel; | ||
this.cancelButtonLabel = matDatetimepickerActions.cancelButtonLabel; | ||
this.datetimepicker = datetimepicker; | ||
} | ||
|
||
protected handleCancelButton(event): void { | ||
event.preventDefault(); | ||
this.datetimepicker.close(); | ||
} | ||
|
||
protected handleConfirmButton(event): void { | ||
event.preventDefault(); | ||
// TODO: We need a "temporary" value from the input at this point | ||
// TODO 2: The datetimepicker should not close itself after having everything selected | ||
// this.datetimepicker._select(this.datetimepicker._selected) | ||
} | ||
} |
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
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.