Skip to content

Commit

Permalink
feat(module:time-picker): support updating OK and Now button text (#6410
Browse files Browse the repository at this point in the history
)
  • Loading branch information
chongqiangchen authored Feb 13, 2021
1 parent 772e76c commit ef3af58
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions components/core/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ export interface TabsConfig {
export interface TimePickerConfig {
nzAllowEmpty?: boolean;
nzClearText?: string;
nzNowText?: string;
nzOkText?: string;
nzFormat?: string;
nzHourStep?: number;
nzMinuteStep?: number;
Expand Down
2 changes: 2 additions & 0 deletions components/time-picker/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import { NzTimePickerModule } from 'ng-zorro-antd/time-picker';
| `[nzAllowEmpty]` | allow clearing text | `boolean` | `true` ||
| `[nzAutoFocus]` | get focus when component mounted | `boolean` | `false` |
| `[nzClearText]` | clear tooltip of icon | `string` | `'clear'` ||
| `[nzNowText]` | text of the Now button | `string` | `'Now'` ||
| `[nzOkText]` | text of the Ok button | `string` | `'Ok'` ||
| `[nzDefaultOpenValue]` | default open panel value if `[ngModel]` is null | `Date` | `new Date()` |
| `[nzDisabled]` | determine whether the TimePicker is disabled | `boolean` | `false` |
| `[nzDisabledHours]` | to specify the hours that cannot be selected | `() => number[]` | - |
Expand Down
2 changes: 2 additions & 0 deletions components/time-picker/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import { NzTimePickerModule } from 'ng-zorro-antd/time-picker';
| `[nzAllowEmpty]` | 是否展示清除按钮 | `boolean` | `true` ||
| `[nzAutoFocus]` | 自动获取焦点 | `boolean` | `false` |
| `[nzClearText]` | 清除按钮的提示文案 | `string` | `'clear'` ||
| `[nzNowText]` | 此刻按钮文本 | `string` | `"此刻"` ||
| `[nzOkText]` | 确认按钮文本 | `string` | `"确定"` ||
| `[nzDefaultOpenValue]` |`[ngModel]` 不存在时,可以设置面板打开时默认选中的值 | `Date` | `new Date()` |
| `[nzDisabled]` | 禁用全部操作 | `boolean` | `false` |
| `[nzDisabledHours]` | 禁止选择部分小时选项 | `() => number[]` | - |
Expand Down
6 changes: 4 additions & 2 deletions components/time-picker/time-picker-panel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ export type NzTimePickerUnit = 'hour' | 'minute' | 'second' | '12-hour';
<ul class="ant-picker-ranges">
<li class="ant-picker-now">
<a (click)="onClickNow()">
{{ 'Calendar.lang.now' | nzI18n }}
{{ nzNowText || ('Calendar.lang.now' | nzI18n) }}
</a>
</li>
<li class="ant-picker-ok">
<button nz-button type="button" nzSize="small" nzType="primary" (click)="onClickOk()">
{{ 'Calendar.lang.ok' | nzI18n }}
{{ nzOkText || ('Calendar.lang.ok' | nzI18n) }}
</button>
</li>
</ul>
Expand Down Expand Up @@ -162,6 +162,8 @@ export class NzTimePickerPanelComponent implements ControlValueAccessor, OnInit,
@Input() nzAddOn?: TemplateRef<void>;
@Input() nzHideDisabledOptions = false;
@Input() nzClearText?: string;
@Input() nzNowText?: string;
@Input() nzOkText?: string;
@Input() nzPlaceHolder?: string | null;
@Input() @InputBoolean() nzUse12Hours = false;
@Input() nzDefaultOpenValue?: Date;
Expand Down
4 changes: 4 additions & 0 deletions components/time-picker/time-picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'timePicker';
[nzDefaultOpenValue]="nzDefaultOpenValue"
[nzAddOn]="nzAddOn"
[nzClearText]="nzClearText"
[nzNowText]="nzNowText"
[nzOkText]="nzOkText"
[nzAllowEmpty]="nzAllowEmpty"
[(ngModel)]="value"
(ngModelChange)="onPanelValueChange($event)"
Expand Down Expand Up @@ -156,6 +158,8 @@ export class NzTimePickerComponent implements ControlValueAccessor, OnInit, Afte
@Input() @WithConfig() nzMinuteStep: number = 1;
@Input() @WithConfig() nzSecondStep: number = 1;
@Input() @WithConfig() nzClearText: string = 'clear';
@Input() @WithConfig() nzNowText: string = '';
@Input() @WithConfig() nzOkText: string = '';
@Input() @WithConfig() nzPopupClassName: string = '';
@Input() nzPlaceHolder = '';
@Input() nzAddOn?: TemplateRef<void>;
Expand Down

0 comments on commit ef3af58

Please sign in to comment.