Skip to content

Commit

Permalink
feat(input-number): support input-number placeholder (#1512)
Browse files Browse the repository at this point in the history
  • Loading branch information
vthinkxie authored May 24, 2018
1 parent 64f5ce5 commit 7e3d4e4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion components/input-number/demo/digit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component } from '@angular/core';

@Component({
selector: 'nz-demo-input-number-digit',
template: `<nz-input-number [(ngModel)]="demoValue" [nzMin]="1" [nzMax]="10" [nzStep]="0.1"></nz-input-number>`
template: `<nz-input-number [(ngModel)]="demoValue" [nzMin]="1" [nzMax]="10" [nzStep]="0.1" [nzPlaceHolder]="'Digital'"></nz-input-number>`
})
export class NzDemoInputNumberDigitComponent {
demoValue: number;
Expand Down
1 change: 1 addition & 0 deletions components/input-number/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ When a numeric value needs to be provided.
| nzPrecision | precision of input value | number | - |
| nzSize | width of input box | string | default |
| nzStep | The number to which the current value is increased or decreased. It can be an integer or decimal. | number | string | 1 |
| nzPlaceHolder | Placeholder of select | string | - |

## Methods

Expand Down
1 change: 1 addition & 0 deletions components/input-number/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ title: InputNumber
| nzPrecision | 数值精度 | number | - |
| nzSize | 输入框大小 | string | default |
| nzStep | 每次改变步数,可以为小数 | number | string | 1 |
| nzPlaceHolder | 选择框默认文字 | string | - |

## 方法

Expand Down
2 changes: 2 additions & 0 deletions components/input-number/nz-input-number.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { toBoolean } from '../core/util/convert';
[disabled]="nzDisabled"
[attr.min]="nzMin"
[attr.max]="nzMax"
[placeholder]="nzPlaceHolder"
[attr.step]="nzStep"
(keydown)="onKeyDown($event)"
(keyup)="onKeyUp($event)"
Expand Down Expand Up @@ -85,6 +86,7 @@ export class NzInputNumberComponent implements ControlValueAccessor, AfterViewIn
@Input() nzMax: number = Infinity;
@Input() nzParser = (value) => value;
@Input() nzPrecision: number;
@Input() nzPlaceHolder = '';

@HostBinding('class.ant-input-number-lg')
get isLarge(): boolean {
Expand Down
3 changes: 3 additions & 0 deletions components/input-number/nz-input-number.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe('input number', () => {
it('should basic className correct', () => {
fixture.detectChanges();
expect(inputNumber.nativeElement.classList).toContain('ant-input-number');
expect(inputElement.getAttribute('placeholder')).toBe('placeholder');
});
it('should focus className correct', () => {
fixture.detectChanges();
Expand Down Expand Up @@ -446,6 +447,7 @@ describe('input number', () => {
[nzSize]="size"
[nzMin]="min"
[nzMax]="max"
[nzPlaceHolder]="placeholder"
[nzStep]="step"
[nzFormatter]="formatter"
[nzParser]="parser"
Expand All @@ -461,6 +463,7 @@ export class NzTestInputNumberBasicComponent {
min = -1;
max = 1;
size = 'default';
placeholder = 'placeholder';
step = 1;
precision = 2;
formatter = (value) => value;
Expand Down

0 comments on commit 7e3d4e4

Please sign in to comment.