Skip to content

Commit

Permalink
feat(module:calendar): support nzDisabledDate of calendar (#5295)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eve-Sama authored Jun 5, 2020
1 parent 39a6c28 commit aabd17e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions components/calendar/calendar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type NzCalendarDateTemplate = TemplateRef<{ $implicit: Date }>;
[activeDate]="activeDate"
[cellRender]="$any(dateCell)"
[fullCellRender]="$any(dateFullCell)"
[disabledDate]="nzDisabledDate"
(valueChange)="onDateSelect($event)"
></date-table>
</ng-template>
Expand Down Expand Up @@ -97,6 +98,7 @@ export class NzCalendarComponent implements ControlValueAccessor, OnChanges {

@Input() nzMode: NzCalendarMode = 'month';
@Input() nzValue?: Date;
@Input() nzDisabledDate?: (date: Date) => boolean;

@Output() readonly nzModeChange: EventEmitter<NzCalendarMode> = new EventEmitter();
@Output() readonly nzPanelChange: EventEmitter<{ date: Date; mode: NzCalendarMode }> = new EventEmitter();
Expand Down
2 changes: 2 additions & 0 deletions components/calendar/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ registerLocaleData(en);
| `[nzDateFullCell]` | (Contentable) Customize the display of the date cell, the template content will override the cell | `TemplateRef<Date>` | - |
| `[nzMonthCell]` | (Contentable) Customize the display of the month cell, the template content will be appended to the cell | `TemplateRef<Date>` | - |
| `[nzMonthFullCell]` | (Contentable) Customize the display of the month cell, the template content will override the cell | `TemplateRef<Date>` | - |
| `[nzDisabledDate]` | specify the date that cannot be selected | `(current: Date) => boolean` | - | - |
| `(nzPanelChange)` | Callback for when panel changes | `EventEmitter<{ date: Date, mode: 'month' \| 'year' }>` | - |
| `(nzSelectChange)` | A callback function of selected item | `EventEmitter<Date>` | - |
1 change: 1 addition & 0 deletions components/calendar/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ registerLocaleData(zh);
| `[nzDateFullCell]` | (可作为内容)自定义渲染日期单元格,模版内容覆盖单元格 | `TemplateRef<Date>` | - |
| `[nzMonthCell]` | (可作为内容)自定义渲染月单元格,模版内容会被追加到单元格 | `TemplateRef<Date>` | - |
| `[nzMonthFullCell]` | (可作为内容)自定义渲染月单元格,模版内容覆盖单元格 | `TemplateRef<Date>` | - |
| `[nzDisabledDate]` | 不可选择的日期 | `(current: Date) => boolean` | - |
| `(nzPanelChange)` | 面板变化的回调 | `EventEmitter<{ date: Date, mode: 'month' \| 'year' }>` | - |
| `(nzSelectChange)` | 选择日期的回调 | `EventEmitter<Date>` | - |

0 comments on commit aabd17e

Please sign in to comment.