Skip to content

Commit 08b85e0

Browse files
committed
[Component] Add Timepicker component
1 parent aa5a5f4 commit 08b85e0

File tree

5 files changed

+98
-0
lines changed

5 files changed

+98
-0
lines changed

src/renderer/app/layout/layout.routing.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ const LAYOUT_ROUTES: Routes = [
8282
{
8383
path: 'typeahead',
8484
loadChildren: () => import('../pages/component/typeahead/typeahead.module').then(m => m.TypeaheadComponentModule)
85+
},
86+
{
87+
path: 'timepicker',
88+
loadChildren: () => import('../pages/component/timepicker/timepicker.module').then(m => m.TimepickerComponentModule)
8589
}
8690
]
8791
},

src/renderer/app/layout/navigation/navigation.component.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@
5656
<li routerLinkActive="navigation__active">
5757
<a [routerLink]="['/component/typeahead']"><i class="fa fa-tty"></i> Typeahead</a>
5858
</li>
59+
<li routerLinkActive="navigation__active">
60+
<a [routerLink]="['/component/timepicker']"><i class="fa fa-times-circle"></i> Timepicker</a>
61+
</li>
5962
</ul>
6063
</li>
6164
<li routerLinkActive="navigation__sub--active" class="navigation__sub">
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<section class="content--row">
2+
<header class="content__title">
3+
<h1>Timepicker</h1>
4+
<small>This template is built using <code>ngx-bootstrap/timepicker</code> and provides some usage examples</small>
5+
</header>
6+
<div class="row">
7+
<div class="col-md-4">
8+
<div class="card">
9+
<div class="card-body">
10+
<h4 class="card-title">Timepicker</h4>
11+
<timepicker [(ngModel)]="timePickerValue" [readonlyInput]="!isTimePickerEnabled"
12+
class="timepicker"></timepicker>
13+
<div class="form-group mt-4">
14+
<input type="text" value="{{timePickerValue | date:'shortTime'}}" class="form-control">
15+
<i class="form-group__bar"></i>
16+
</div>
17+
</div>
18+
</div>
19+
</div>
20+
<div class="col-md-4">
21+
<div class="card">
22+
<div class="card-body">
23+
<h4 class="card-title">24 hours Timepicker</h4>
24+
<timepicker [(ngModel)]="timePickerMeridianValue" [readonlyInput]="!isTimePickerEnabled" class="timepicker"
25+
[showMeridian]="false"></timepicker>
26+
<div class="form-group mt-4">
27+
<input type="text" value="{{timePickerMeridianValue | date: 'HH:mm'}}" class="form-control">
28+
<i class="form-group__bar"></i>
29+
</div>
30+
</div>
31+
</div>
32+
</div>
33+
<div class="col-md-4">
34+
<div class="card">
35+
<div class="card-body">
36+
<h4 class="card-title">Custom Timepicker</h4>
37+
<timepicker [(ngModel)]="timePickerValue" [readonlyInput]="!isTimePickerEnabled" [hourStep]="2"
38+
[minuteStep]="1" class="timepicker"></timepicker>
39+
<div class="form-group mt-4">
40+
<input type="text" value="{{timePickerValue | date:'shortTime'}}" class="form-control">
41+
<i class="form-group__bar"></i>
42+
</div>
43+
</div>
44+
</div>
45+
</div>
46+
</div>
47+
<button class="btn btn-primary" (click)="isTimePickerEnabled=!isTimePickerEnabled">Enabling/Disabling</button>
48+
</section>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Component, OnInit } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-component-timepicker',
5+
templateUrl: './timepicker.component.html'
6+
})
7+
export class TimePickerComponent implements OnInit {
8+
isTimePickerEnabled = true;
9+
timePickerValue: Date = new Date();
10+
timePickerMeridianValue: Date = new Date();
11+
12+
constructor() {
13+
}
14+
15+
ngOnInit() {
16+
}
17+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { CommonModule } from '@angular/common';
2+
import { NgModule } from '@angular/core';
3+
import { FormsModule } from '@angular/forms';
4+
import { RouterModule } from '@angular/router';
5+
import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
6+
import { TimepickerModule } from 'ngx-bootstrap/timepicker';
7+
import { TimePickerComponent } from './timepicker.component';
8+
9+
const TIMEPICKER_COMPONENT_ROUTES = [
10+
{path: '', component: TimePickerComponent}
11+
];
12+
13+
@NgModule({
14+
declarations: [
15+
TimePickerComponent
16+
],
17+
imports: [
18+
CommonModule,
19+
FormsModule,
20+
BsDropdownModule.forRoot(),
21+
TimepickerModule.forRoot(),
22+
RouterModule.forChild(TIMEPICKER_COMPONENT_ROUTES)
23+
]
24+
})
25+
export class TimepickerComponentModule {
26+
}

0 commit comments

Comments
 (0)