Skip to content

Commit

Permalink
fix(module:select, datepicker, timepicker, radio, checkbox, input-num…
Browse files Browse the repository at this point in the history
…ber): fix touched state (#248)

close #228
  • Loading branch information
Zhaoming Li authored and vthinkxie committed Sep 9, 2017
1 parent 4233db1 commit 07f48bc
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/checkbox/nz-checkbox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
[ngClass]="_inputPrefixCls"
[ngModel]="nzChecked"
(focus)="nzFocus()"
(blur)="nzBlur()">
(blur)="onTouched();nzBlur()">
</span>
<ng-content></ng-content>
`,
Expand Down
3 changes: 2 additions & 1 deletion src/components/datepicker/nz-datepicker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { ConnectionPositionPair } from '../core/overlay/index';
#trigger>
<input
nz-input
(blur)="onTouched()"
[class.ant-input-disabled]="nzDisabled"
[attr.placeholder]="nzPlaceHolder"
[disabled]="nzDisabled"
Expand All @@ -37,7 +38,7 @@ import { ConnectionPositionPair } from '../core/overlay/index';
[value]="_value|nzDate:nzFormat">
<i class="ant-calendar-picker-clear anticon anticon-cross-circle"
*ngIf="_showClearIcon"
(click)="_clearValue($event)">
(click)="onTouched();_clearValue($event)">
</i>
<span class="ant-calendar-picker-icon"></span>
</span>
Expand Down
2 changes: 1 addition & 1 deletion src/components/input-number/nz-input-number.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
class="ant-input-number-input-wrap">
<input class="ant-input-number-input"
#inputNumber
(blur)="_checkValue()"
(blur)="onTouched();_checkValue()"
[placeholder]="nzPlaceHolder"
[disabled]="nzDisabled"
[(ngModel)]="_displayValue"
Expand Down
1 change: 1 addition & 0 deletions src/components/radio/nz-radio.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export class NzRadioComponent implements OnInit {
nzBlur() {
this._focused = false;
this.setClassMap();
this._nzRadioGroup.onTouched();
}

setClassMap(): void {
Expand Down
5 changes: 4 additions & 1 deletion src/components/select/nz-select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import { TagAnimation } from '../core/animation/tag-animations';
[(ngModel)]="_searchText"
(ngModelChange)="updateFilterOption();onSearchChange($event);"
(keydown)="updateWidth(searchInput,_searchText)"
(blur)="onTouched()"
#searchInput>
<span class="ant-select-search__field__mirror"></span></div>
</li>
Expand All @@ -93,6 +94,7 @@ import { TagAnimation } from '../core/animation/tag-animations';
<div class="ant-select-search__field__wrap">
<input
class="ant-select-search__field"
(blur)="onTouched()"
(compositionstart)="compositionStart()"
(compositionend)="compositionEnd()"
[(ngModel)]="_searchText"
Expand All @@ -103,7 +105,7 @@ import { TagAnimation } from '../core/animation/tag-animations';
</div>
</div>
<span
(click)="clearSelect($event)"
(click)="onTouched();clearSelect($event)"
class="ant-select-selection__clear"
style="-webkit-user-select: none;"
*ngIf="_selectedOption?.nzLabel&&nzAllowClear&&!nzMultiple">
Expand Down Expand Up @@ -591,6 +593,7 @@ export class NzSelectComponent implements OnInit, AfterContentInit, AfterContent
if (!this.nzOpen) {
return;
}
this.onTouched();
if (this.nzMultiple) {
this._renderer.removeStyle(this.searchInputElementRef.nativeElement, 'width');
}
Expand Down
1 change: 1 addition & 0 deletions src/components/time-picker/nz-timepicker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { ConnectionPositionPair } from '../core/overlay/index';
class="ant-time-picker-input"
[attr.placeholder]="nzPlaceHolder"
(click)="_openCalendar()"
(blur)="onTouched()"
[value]="_value|nzDate:_format">
<span class="ant-time-picker-icon"></span>
</span>
Expand Down

0 comments on commit 07f48bc

Please sign in to comment.