@@ -2,34 +2,25 @@ import { Component, OnInit } from '@angular/core';
2
2
import { isBs3 } from '../utils/ng2-bootstrap-config' ;
3
3
import { DatePickerInnerComponent } from './datepicker-inner.component' ;
4
4
5
- // write an interface for template options
6
- const TEMPLATE_OPTIONS : any = {
7
- 'bs4' : {
8
- ARROW_LEFT : '<' ,
9
- ARROW_RIGHT : '>'
10
- } ,
11
- 'bs3' : {
12
- ARROW_LEFT : `
13
- <i class="glyphicon glyphicon-chevron-left"></i>
14
- ` ,
15
- ARROW_RIGHT : `
16
- <i class="glyphicon glyphicon-chevron-right"></i>
17
- `
18
- }
19
- } ;
20
-
21
5
@Component ( {
22
6
selector : 'daypicker' ,
23
7
template : `
24
8
<table *ngIf="datePicker.datepickerMode==='day'" role="grid" [attr.aria-labelledby]="datePicker.uniqueId+'-title'" aria-activedescendant="activeDateId">
25
9
<thead>
26
10
<tr>
27
11
<th>
28
- <button type="button"
29
- class="btn btn-default btn-secondary btn-sm pull-left"
30
- (click)="datePicker.move(-1)"
31
- tabindex="-1"
32
- [innerHTML]="CURRENT_THEME_TEMPLATE.ARROW_LEFT">
12
+ <button *ngIf="!isBs4"
13
+ type="button"
14
+ class="btn btn-default btn-secondary btn-sm pull-left"
15
+ (click)="datePicker.move(-1)"
16
+ tabindex="-1">
17
+ <i class="glyphicon glyphicon-chevron-left"></i>
18
+ </button>
19
+ <button *ngIf="isBs4"
20
+ type="button"
21
+ class="btn btn-default btn-secondary btn-sm pull-left"
22
+ (click)="datePicker.move(-1)"
23
+ tabindex="-1"><
33
24
</button>
34
25
</th>
35
26
<th [attr.colspan]="5 + (datePicker.showWeeks ? 1 : 0)">
@@ -42,11 +33,18 @@ const TEMPLATE_OPTIONS: any = {
42
33
</button>
43
34
</th>
44
35
<th>
45
- <button type="button"
46
- class="btn btn-default btn-secondary btn-sm pull-right"
47
- (click)="datePicker.move(1)"
48
- tabindex="-1"
49
- [innerHTML]="CURRENT_THEME_TEMPLATE.ARROW_RIGHT">
36
+ <button *ngIf="!isBs4"
37
+ type="button"
38
+ class="btn btn-default btn-secondary btn-sm pull-right"
39
+ (click)="datePicker.move(1)"
40
+ tabindex="-1">
41
+ <i class="glyphicon glyphicon-chevron-right"></i>
42
+ </button>
43
+ <button *ngIf="isBs4"
44
+ type="button"
45
+ class="btn btn-default btn-secondary btn-sm pull-right"
46
+ (click)="datePicker.move(1)"
47
+ tabindex="-1">>
50
48
</button>
51
49
</th>
52
50
</tr>
@@ -85,12 +83,8 @@ export class DayPickerComponent implements OnInit {
85
83
public rows : any [ ] = [ ] ;
86
84
public weekNumbers : number [ ] = [ ] ;
87
85
public datePicker : DatePickerInnerComponent ;
88
- public CURRENT_THEME_TEMPLATE : any ;
89
86
90
87
public constructor ( datePicker : DatePickerInnerComponent ) {
91
- this . CURRENT_THEME_TEMPLATE = isBs3 ( )
92
- ? TEMPLATE_OPTIONS . bs3
93
- : TEMPLATE_OPTIONS . bs4 ;
94
88
this . datePicker = datePicker ;
95
89
}
96
90
0 commit comments