From aabd17e5430ffda076d5c83364e978400f5e4eba Mon Sep 17 00:00:00 2001 From: Eve <948832626@qq.com> Date: Fri, 5 Jun 2020 10:37:35 +0800 Subject: [PATCH] feat(module:calendar): support nzDisabledDate of calendar (#5295) --- components/calendar/calendar.component.ts | 2 ++ components/calendar/doc/index.en-US.md | 2 ++ components/calendar/doc/index.zh-CN.md | 1 + 3 files changed, 5 insertions(+) diff --git a/components/calendar/calendar.component.ts b/components/calendar/calendar.component.ts index 99c80becef6..b23324c07c2 100644 --- a/components/calendar/calendar.component.ts +++ b/components/calendar/calendar.component.ts @@ -63,6 +63,7 @@ type NzCalendarDateTemplate = TemplateRef<{ $implicit: Date }>; [activeDate]="activeDate" [cellRender]="$any(dateCell)" [fullCellRender]="$any(dateFullCell)" + [disabledDate]="nzDisabledDate" (valueChange)="onDateSelect($event)" > @@ -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 = new EventEmitter(); @Output() readonly nzPanelChange: EventEmitter<{ date: Date; mode: NzCalendarMode }> = new EventEmitter(); diff --git a/components/calendar/doc/index.en-US.md b/components/calendar/doc/index.en-US.md index 3a78716dbc2..41dc5a12d89 100644 --- a/components/calendar/doc/index.en-US.md +++ b/components/calendar/doc/index.en-US.md @@ -52,4 +52,6 @@ registerLocaleData(en); | `[nzDateFullCell]` | (Contentable) Customize the display of the date cell, the template content will override the cell | `TemplateRef` | - | | `[nzMonthCell]` | (Contentable) Customize the display of the month cell, the template content will be appended to the cell | `TemplateRef` | - | | `[nzMonthFullCell]` | (Contentable) Customize the display of the month cell, the template content will override the cell | `TemplateRef` | - | +| `[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` | - | diff --git a/components/calendar/doc/index.zh-CN.md b/components/calendar/doc/index.zh-CN.md index 13f16f14b37..676ba964926 100644 --- a/components/calendar/doc/index.zh-CN.md +++ b/components/calendar/doc/index.zh-CN.md @@ -52,5 +52,6 @@ registerLocaleData(zh); | `[nzDateFullCell]` | (可作为内容)自定义渲染日期单元格,模版内容覆盖单元格 | `TemplateRef` | - | | `[nzMonthCell]` | (可作为内容)自定义渲染月单元格,模版内容会被追加到单元格 | `TemplateRef` | - | | `[nzMonthFullCell]` | (可作为内容)自定义渲染月单元格,模版内容覆盖单元格 | `TemplateRef` | - | +| `[nzDisabledDate]` | 不可选择的日期 | `(current: Date) => boolean` | - | | `(nzPanelChange)` | 面板变化的回调 | `EventEmitter<{ date: Date, mode: 'month' \| 'year' }>` | - | | `(nzSelectChange)` | 选择日期的回调 | `EventEmitter` | - |