Skip to content
This repository was archived by the owner on Mar 4, 2023. It is now read-only.

Commit ba2bc20

Browse files
author
evombau
committed
click feedback
1 parent e7a4938 commit ba2bc20

File tree

8 files changed

+29
-7
lines changed

8 files changed

+29
-7
lines changed

projects/material-calendar/src/lib/calendar-panel/calendar-panel.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ <h3 class="displayMonthName" *ngIf="config.displayYear">{{monat.name}} {{monat.y
3333

3434
<mat-grid-tile *ngIf="day.type === 'date'" colspan="1" rowspan="1" matTooltip="test" class="date"
3535
[ngClass]="[day.isWeekendDay? 'Weekend' : '', day.isHoliday && config.useHolidays ? 'Holiday' : '']">
36-
<div [ngClass]="day.date.setHours(0, 0, 0, 0) == today? 'today': ''">
36+
<div (click)="onClick(day)" [ngClass]="day.date.setHours(0, 0, 0, 0) == today? 'today': ''">
3737
<a>{{day.day}}</a>
3838
</div>
3939
</mat-grid-tile>

projects/material-calendar/src/lib/calendar-panel/calendar-panel.component.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ mat-grid-tile {
2525

2626
.date {
2727
border-radius: 4px;
28+
cursor: pointer;
2829
}
2930

3031
.today {

projects/material-calendar/src/lib/calendar-panel/calendar-panel.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit, HostBinding, Input, Output } from '@angular/core';
1+
import { Component, OnInit, HostBinding, Input, Output, EventEmitter } from '@angular/core';
22
import { CalendarService } from '../service/calendar.service';
33
import * as pSBC from '../service/pSBC';
44
import { CalendarConfig } from '../service/models';
@@ -89,6 +89,12 @@ export class CalendarPanelComponent implements OnInit {
8989
todayColor;
9090
panelWidth = '100%';
9191

92+
@Output() public clickDate = new EventEmitter<Object>();
93+
94+
onClick(event){
95+
this.clickDate.emit(event);
96+
}
97+
9298
constructor(private calendarService: CalendarService,
9399
private sharedFunctions: SharedFunctions) { }
94100

projects/material-calendar/src/lib/calendar-panels/calendar-panels.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ <h3 class="displayMonthName" *ngIf="config.displayYear">{{monat.name}} {{monat.y
4646

4747
<mat-grid-tile *ngIf="day.type === 'date'" colspan="1" rowspan="1" matTooltip="test" class="date"
4848
[ngClass]="[day.isWeekendDay? 'Weekend' : '', day.isHoliday && config.useHolidays ? 'Holiday' : '']">
49-
<div [ngClass]="day.date.setHours(0, 0, 0, 0) == today? 'today': ''">
49+
<div (click)="onClick(day)" [ngClass]="day.date.setHours(0, 0, 0, 0) == today? 'today': ''">
5050
<a>{{day.day}}</a>
5151
</div>
5252
</mat-grid-tile>

projects/material-calendar/src/lib/calendar-panels/calendar-panels.component.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ mat-grid-tile {
3636

3737
.date {
3838
border-radius: 4px;
39+
cursor: pointer;
3940
}
4041

4142
.today {

projects/material-calendar/src/lib/calendar-panels/calendar-panels.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit, HostBinding, Input, Output } from '@angular/core';
1+
import { Component, OnInit, HostBinding, Input, Output, EventEmitter } from '@angular/core';
22
import { CalendarService } from '../service/calendar.service';
33
import * as pSBC from '../service/pSBC';
44
import { CalendarConfig } from '../service/models';
@@ -117,6 +117,11 @@ export class CalendarPanelsComponent implements OnInit {
117117
todayColor;
118118
panelWidth = '100%';
119119

120+
@Output() public clickDate = new EventEmitter<Object>();
121+
onClick(event){
122+
this.clickDate.emit(event);
123+
}
124+
120125
constructor(private calendarService: CalendarService,
121126
private sharedFunctions: SharedFunctions) { }
122127

projects/my-first-app/src/app/app.component.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@
3131
</div>
3232

3333
<calendar-panels [mode]="mode" [placeholderDay]="placeholder" year="2020" month="5" [monthsBefore]="monthsBefore"
34-
[monthsAfter]="monthsAfter" [config]="calendarConfig">
34+
[monthsAfter]="monthsAfter" [config]="calendarConfig" (clickDate)="testMethod($event)">
3535
</calendar-panels>
3636

37-
<!-- <calendar-panel [placeholderDay]="placeholder" year="2020" month="5" [config]="calendarConfig">
38-
</calendar-panel> -->
37+
<!-- <div style="width: 600px;">
38+
<calendar-panel [placeholderDay]="placeholder" year="2020" month="5" [config]="calendarConfig" (clickDate)="testMethod($event)">
39+
</calendar-panel>
40+
</div> -->

projects/my-first-app/src/app/app.component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,16 @@ export class AppComponent implements OnInit {
3131
switches: true,
3232
}
3333

34+
constructor() {
35+
}
36+
3437
ngOnInit() {
3538
}
3639

40+
testMethod(event) {
41+
console.log(event)
42+
}
43+
3744
switchMode() {
3845
this.mode = (this.mode === 'monthly') ? 'annual' : 'monthly'
3946
}

0 commit comments

Comments
 (0)