Skip to content

Commit

Permalink
fix(module:calendar,datepicker): fix month/year view switching (#871)
Browse files Browse the repository at this point in the history
  • Loading branch information
chunghha authored and wilsoncook committed Feb 4, 2018
1 parent c38b15e commit 3dbd308
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions src/components/calendar/nz-calendar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export enum RangePart { Start = 0, End = 1 }
<nz-select
class="ant-fullcalendar-month-select"
style="width: 70px;"
*ngIf="nzMode == 'year'"
*ngIf="nzMode == 'month'"
[ngModel]="_showMonth"
(ngModelChange)="_showMonth = $event;_buildCalendar()">
<nz-option
Expand All @@ -80,10 +80,10 @@ export enum RangePart { Start = 0, End = 1 }
</nz-option>
</nz-select>
<nz-radio-group [(ngModel)]="nzMode">
<label nz-radio-button [nzValue]="'year'">
<span>{{ _yearUnit }}</span>
</label><label nz-radio-button [nzValue]="'month'">
<span>{{ _monthUnit }}</span>
<label nz-radio-button [nzValue]="'month'">
<span>{{ _monthUnit }}</span>
</label><label nz-radio-button [nzValue]="'year'">
<span>{{ _yearUnit }}</span>
</label>
</nz-radio-group>
</div>
Expand All @@ -100,7 +100,7 @@ export enum RangePart { Start = 0, End = 1 }
[class.ant-fullcalendar-table]="!nzDatePicker"
[class.ant-calendar-table]="nzDatePicker"
[class.ant-patch-full-height]="nzDatePicker"
*ngIf="nzMode == 'year'">
*ngIf="nzMode == 'month'">
<thead>
<tr>
<th
Expand Down Expand Up @@ -163,7 +163,7 @@ export enum RangePart { Start = 0, End = 1 }
<table
[class.ant-fullcalendar-month-panel-table]="!nzDatePicker"
[class.ant-calendar-month-panel-table]="nzDatePicker"
*ngIf="nzMode == 'month'">
*ngIf="nzMode == 'year'">
<tbody class="ant-fullcalendar-month-panel-tbody">
<tr *ngFor="let quarter of _quartersCalendar">
<ng-template [ngIf]="!nzDatePicker">
Expand Down Expand Up @@ -238,7 +238,7 @@ export class NzCalendarComponent implements OnInit {
@Output() nzClickMonth: EventEmitter<MonthInterface> = new EventEmitter();
@Output() nzHoverDay: EventEmitter<DayInterface> = new EventEmitter();
@Input() nzClearTime = true;
@Input() nzMode = 'year';
@Input() nzMode = 'month';

@Input()
set nzFullScreen(value: boolean) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/datepicker/nz-datepicker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ import { toBoolean } from '../util/convert';
[nzShowYear]="_showYear"
[nzValue]="_value"
(nzClickMonth)="_clickMonth($event)"
[nzMode]="'month'"
[nzMode]="'year'"
[nzFullScreen]="false"
[nzShowHeader]="false"
nzDatePicker>
Expand Down Expand Up @@ -159,7 +159,7 @@ import { toBoolean } from '../util/convert';
[ngModel]="_value" (ngModelChange)="_changeTime($event)"
*ngIf="nzShowTime&&(_mode == 'time')"></nz-timepicker-inner>
<div class="ant-calendar-calendar-body">
<nz-calendar [nzClearTime]="!nzShowTime" [nzDisabledDate]="nzDisabledDate" (nzClickDay)="_clickDay($event)" [nzShowMonth]="_showMonth" [nzShowYear]="_showYear" [nzValue]="_value" (nzClickMonth)="_clickMonth($event)" [nzMode]="'year'" [nzFullScreen]="false" [nzShowHeader]="false" nzDatePicker></nz-calendar>
<nz-calendar [nzClearTime]="!nzShowTime" [nzDisabledDate]="nzDisabledDate" (nzClickDay)="_clickDay($event)" [nzShowMonth]="_showMonth" [nzShowYear]="_showYear" [nzValue]="_value" (nzClickMonth)="_clickMonth($event)" [nzMode]="'month'" [nzFullScreen]="false" [nzShowHeader]="false" nzDatePicker></nz-calendar>
</div>
<div class="ant-calendar-footer ant-calendar-footer-show-ok">
<span class="ant-calendar-footer-btn">
Expand Down
4 changes: 2 additions & 2 deletions src/components/datepicker/nz-rangepicker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export class NzRangePickerComponent implements ControlValueAccessor, OnInit {
_open;
_disabledDate: (value: Date) => boolean;
_disabledDatePart: Array<(value: Date) => boolean> = [null, null];
_mode = ['year', 'year'];
_mode = ['month', 'month'];
_selectedMonth: number[] = [];
_selectedYear: number[] = [];
_selectedDate: number[] = [];
Expand Down Expand Up @@ -367,7 +367,7 @@ export class NzRangePickerComponent implements ControlValueAccessor, OnInit {
if (this.nzDisabled) {
return;
}
this._mode = ['year', 'year'];
this._mode = ['month', 'month'];
this._open = true;
this._setTriggerWidth();
this._initShow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Component } from '@angular/core';
<label nz-radio-button [nzValue]="'small'"><span>Small</span></label>
</nz-radio-group>
<nz-datepicker [(ngModel)]="_date" [nzSize]="size" [nzPlaceHolder]="'Select date'"></nz-datepicker>
<nz-datepicker [(ngModel)]="_month" [nzMode]="'month'" [nzSize]="size" [nzPlaceHolder]="'Select date'" [nzFormat]="'YYYY/MM'"></nz-datepicker>
<nz-datepicker [(ngModel)]="_month" [nzMode]="'month'" [nzSize]="size" [nzPlaceHolder]="'Select month'" [nzFormat]="'YYYY/MM'"></nz-datepicker>
<nz-rangepicker [(ngModel)]="_dateRange" [nzSize]="size"></nz-rangepicker>
`,
styles : []
Expand Down

0 comments on commit 3dbd308

Please sign in to comment.