-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(timepicker): new timepicker implementation (#2058)
fixes #2036 fixes #1981 ( + min max demo ) fixes #1973 close #1957 ( + seconds demo ) fixes #1935 fixes #1672 feat #1007 added keyboard and mousewheel support fixes #962 fixes #793 fixes #173 fixes #1271 added custom validation demo fixes #1539 bs4 fixes #1253 if input is invalid * feat(timepicker): new timepicker implementation * feat(timepicker): new timepicker implementation testing * chore(timepicker): removed old timepicker implementation * chore(mini-ngrx): added ngrx licence * fix(timepicker): fix seconds * fix(timepicker): fix custom validation demo * fix(tests): fix tests & aot errors * fix(timepicker): min max restrictions * fix(timepicker): min max checks * feat(timepicker): add inputs validation (#2187) * feat(timepicker): add inputs validation * fix(timepicker): add isPM support * feat(timepicker): add isValid output * feat(timepicker): added test plan (#2127) * fix(timepicker): fix ngModelChange demo * fix(test): fix unit tests * docs(timepicker): fix docs conflict, add isValid description
- Loading branch information
Showing
34 changed files
with
2,422 additions
and
334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
demo/src/app/components/+timepicker/demos/custom-validation/custom-validation.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<p>Illustrates custom validation, you have to select time between 11:00 and 12:59</p> | ||
|
||
<div class="form-group"> | ||
<timepicker [(ngModel)]="myTime" [formControl]="ctrl" required></timepicker> | ||
</div> | ||
|
||
<pre class="alert" | ||
[class.alert-danger]="!ctrl.valid && !ctrl.pristine" | ||
[class.alert-success]="ctrl.valid && !ctrl.pristine"> | ||
Time is: {{myTime}} | ||
</pre> | ||
<div class="alert alert-danger" *ngIf="ctrl.errors && ctrl.errors['outOfRange']">Invalid time</div> |
23 changes: 23 additions & 0 deletions
23
demo/src/app/components/+timepicker/demos/custom-validation/custom-validation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Component } from '@angular/core'; | ||
import { FormControl } from '@angular/forms'; | ||
|
||
@Component({ | ||
selector: 'demo-timepicker-custom-validation', | ||
templateUrl: './custom-validation.html' | ||
}) | ||
export class DemoTimepickerCustomValidationComponent { | ||
public myTime: Date; | ||
|
||
public ctrl = new FormControl('', (control: FormControl) => { | ||
const value = control.value; | ||
if (!value) { | ||
return null; | ||
} | ||
const hours = value.getHours(); | ||
if (hours < 11 || hours > 12) { | ||
return {outOfRange: true}; | ||
} | ||
|
||
return null; | ||
}); | ||
} |
3 changes: 2 additions & 1 deletion
3
demo/src/app/components/+timepicker/demos/dynamic/dynamic.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
<timepicker [(ngModel)]="mytime" (change)="changed()"></timepicker> | ||
<timepicker [(ngModel)]="mytime" (ngModelChange)="changed()" (isValid)="isValid = $event"></timepicker> | ||
|
||
<pre class="alert alert-info">Time is: {{mytime}}</pre> | ||
<pre *ngIf="!isValid" class="alert alert-danger">Invalid time format</pre> | ||
|
||
<button type="button" class="btn btn-primary" (click)="update()">Set to 14:00</button> | ||
<button type="button" class="btn btn-danger" (click)="clear()">Clear</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
demo/src/app/components/+timepicker/demos/min-max/min-max.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<timepicker [(ngModel)]="myTime" [min]="minTime" [max]="maxTime"></timepicker> | ||
|
||
<pre class="alert alert-info">Time is: {{myTime}}</pre> |
18 changes: 18 additions & 0 deletions
18
demo/src/app/components/+timepicker/demos/min-max/min-max.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'demo-timepicker-min-max', | ||
templateUrl: './min-max.html' | ||
}) | ||
export class DemoTimepickerMinMaxComponent { | ||
public myTime: Date = new Date(); | ||
public minTime: Date = new Date(); | ||
public maxTime: Date = new Date(); | ||
|
||
constructor() { | ||
this.minTime.setHours(8); | ||
this.minTime.setMinutes(0); | ||
this.maxTime.setHours(17); | ||
this.maxTime.setMinutes(0); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
demo/src/app/components/+timepicker/demos/mousewheel-arrowkeys/mousewheel-arrowkeys.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<p>Mouse wheel disabled</p> | ||
|
||
<timepicker [(ngModel)]="myTime1" [mousewheel]="false"></timepicker> | ||
|
||
<pre class="alert alert-info">Time is: {{myTime1}}</pre> | ||
|
||
<p>Arrow keys disabled</p> | ||
|
||
<timepicker [(ngModel)]="myTime2" [arrowkeys]="false"></timepicker> | ||
|
||
<pre class="alert alert-info">Time is: {{myTime2}}</pre> |
10 changes: 10 additions & 0 deletions
10
demo/src/app/components/+timepicker/demos/mousewheel-arrowkeys/mousewheel-arrowkeys.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'demo-timepicker-mousewheel-arrowkeys', | ||
templateUrl: './mousewheel-arrowkeys.html' | ||
}) | ||
export class DemoTimepickerMousewheelArrowkeysComponent { | ||
public myTime1: Date = new Date(); | ||
public myTime2: Date = new Date(); | ||
} |
3 changes: 3 additions & 0 deletions
3
demo/src/app/components/+timepicker/demos/seconds/seconds.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<timepicker [(ngModel)]="myTime" [showSeconds]="showSec"></timepicker> | ||
|
||
<pre class="alert alert-info">Time is: {{myTime}}</pre> |
10 changes: 10 additions & 0 deletions
10
demo/src/app/components/+timepicker/demos/seconds/seconds.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'demo-timepicker-seconds', | ||
templateUrl: './seconds.html' | ||
}) | ||
export class DemoTimepickerSecondsComponent { | ||
public myTime: Date = new Date(); | ||
public showSec: boolean = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.