Skip to content

Commit

Permalink
fix(schedule, calendar): fix positions and changeDectection and
Browse files Browse the repository at this point in the history
  • Loading branch information
abalad committed May 24, 2018
1 parent 640ec39 commit d1d9237
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions projects/truly-ui/src/components/calendar/calendar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
font-weight: 400;
height: 45px;
line-height: 45px;

box-sizing: border-box;
>.date {
width: 170px;
& span {
Expand Down Expand Up @@ -45,7 +45,7 @@
font-size: 1.2em;
cursor: pointer;
text-align: center;
width: 90px;
width: 85px;
font-weight: 600;
user-select: none;
}
Expand Down
2 changes: 1 addition & 1 deletion projects/truly-ui/src/components/schedule/schedule.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</div>

<!-- SCHEDULE BODY -->
<div class="ui-schedule-body" [ngStyle]="{height: height}" [ngSwitch]="defaultView">
<div class="ui-schedule-body" [ngStyle]="{height: 'calc(' + height +' - 52px)'}" [ngSwitch]="defaultView">
<tl-view-day
*ngSwitchCase="'day'"
[duration]="duration"
Expand Down
1 change: 1 addition & 0 deletions projects/truly-ui/src/components/schedule/schedule.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

.ui-schedule-body {
border: 1px solid #D6D6D6;
box-sizing: content-box;
overflow-x: auto;
position: relative;
}
3 changes: 2 additions & 1 deletion projects/truly-ui/src/components/schedule/schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class TlSchedule implements OnInit, OnChanges {

private _endDayHour: string;

constructor() {}
constructor( private changeDetection: ChangeDetectorRef ) {}

ngOnInit() {
this.getEventsOfDay();
Expand All @@ -106,6 +106,7 @@ export class TlSchedule implements OnInit, OnChanges {
this.refreshStartAndEndDay();
this.getEventsOfDay();
}
this.changeDetection.detectChanges();
}

onChangeView( view ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

.ui-schedule-time-row {
height: 86px;
box-sizing: border-box;
border-bottom: 1px solid #D6D6D6;
text-align: center;
width: 100%;
Expand Down Expand Up @@ -42,6 +43,7 @@
padding-left: 10px;
height: 43px;
content: ' ';
box-sizing: border-box;
&:hover{
background-color: #EDEDED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export class ViewDayComponent implements OnInit, AfterViewInit, OnChanges {

ngAfterViewInit() {
this.inicializeNowIndicator();
this.changeDetectionRef.detectChanges();
}

ngOnChanges( changes: SimpleChanges ) {
Expand All @@ -64,6 +65,7 @@ export class ViewDayComponent implements OnInit, AfterViewInit, OnChanges {
this.inicializeNowIndicator();
this.changeDetectionRef.detectChanges();
}
this.changeDetectionRef.detectChanges();
}

calcPositionEvent(index, event: ScheduleDataSource) {
Expand Down Expand Up @@ -203,10 +205,8 @@ export class ViewDayComponent implements OnInit, AfterViewInit, OnChanges {
}

private inicializeNowIndicator() {
if ( this.showNowIndicator ) {
this.nowIndicatorPositionTop = this.convertMillisecondsToPixel();
this.changeDetectionRef.detectChanges();
}
this.nowIndicatorPositionTop = this.showNowIndicator ? this.convertMillisecondsToPixel() : -1000;
this.changeDetectionRef.detectChanges();
}


Expand Down

0 comments on commit d1d9237

Please sign in to comment.