@@ -7,23 +7,37 @@ import {DatePickerInner} from './datepicker-inner';
77//write an interface for template options
88const TEMPLATE_OPTIONS :any = {
99 [ Ng2BootstrapTheme . BS4 ] : {
10- DAY_BUTTON : `
11- <button type="button" style="min-width:100%;" class="btn btn-sm"
12- [ngClass]="{'btn-secondary': !dtz.selected && !datePicker.isActive(dtz), 'btn-info': dtz.selected || !dtz.selected && datePicker.isActive(dtz), disabled: dtz.disabled}"
13- [disabled]="dtz.disabled"
14- (click)="datePicker.select(dtz.date)" tabindex="-1">
15- <span [ngClass]="{'text-muted': dtz.secondary || dtz.current}">{{dtz.label}}</span>
16- </button>
10+ DAY_TITLE : `
11+ <th *ngFor="#labelz of labels" class="text-xs-center"><small aria-label="labelz.full"><b>{{labelz.abbr}}</b></small></th>
12+ ` ,
13+ WEEK_ROW : `
14+ <td [hidden]="!datePicker.showWeeks" class="text-xs-center h6"><em>{{ weekNumbers[index] }}</em></td>
15+ <!-- [ngClass]="dtz.customClass" -->
16+ <td *ngFor="#dtz of rowz" class="text-xs-center" role="gridcell" [id]="dtz.uid">
17+ <button type="button" style="min-width:100%;" class="btn btn-sm"
18+ [ngClass]="{'btn-secondary': !dtz.selected && !datePicker.isActive(dtz), 'btn-info': dtz.selected || !dtz.selected && datePicker.isActive(dtz), disabled: dtz.disabled}"
19+ [disabled]="dtz.disabled"
20+ (click)="datePicker.select(dtz.date)" tabindex="-1">
21+ <span [ngClass]="{'text-muted': dtz.secondary || dtz.current}">{{dtz.label}}</span>
22+ </button>
23+ </td>
1724 `
1825 } ,
1926 [ Ng2BootstrapTheme . BS3 ] : {
20- DAY_BUTTON : `
21- <button type="button" style="min-width:100%;" class="btn btn-default btn-sm"
22- [ngClass]="{'btn-info': dtz.selected, active: datePicker.isActive(dtz), disabled: dtz.disabled}"
23- [disabled]="dtz.disabled"
24- (click)="datePicker.select(dtz.date)" tabindex="-1">
25- <span [ngClass]="{'text-muted': dtz.secondary, 'text-info': dtz.current}">{{dtz.label}}</span>
26- </button>
27+ DAY_TITLE : `
28+ <th *ngFor="#labelz of labels" class="text-center"><small aria-label="labelz.full"><b>{{labelz.abbr}}</b></small></th>
29+ ` ,
30+ WEEK_ROW : `
31+ <td [hidden]="!datePicker.showWeeks" class="text-center h6"><em>{{ weekNumbers[index] }}</em></td>
32+ <!-- [ngClass]="dtz.customClass" -->
33+ <td *ngFor="#dtz of rowz" class="text-center" role="gridcell" [id]="dtz.uid">
34+ <button type="button" style="min-width:100%;" class="btn btn-default btn-sm"
35+ [ngClass]="{'btn-info': dtz.selected, active: datePicker.isActive(dtz), disabled: dtz.disabled}"
36+ [disabled]="dtz.disabled"
37+ (click)="datePicker.select(dtz.date)" tabindex="-1">
38+ <span [ngClass]="{'text-muted': dtz.secondary, 'text-info': dtz.current}">{{dtz.label}}</span>
39+ </button>
40+ </td>
2741 `
2842 }
2943} ;
@@ -32,7 +46,7 @@ const CURRENT_THEME_TEMPLATE:any = TEMPLATE_OPTIONS[Ng2BootstrapConfig.theme ||
3246
3347@Component ( {
3448 selector : 'daypicker, [daypicker]' ,
35- template : `
49+ template : `
3650<table [hidden]="datePicker.datepickerMode!=='day'" role="grid" aria-labelledby="uniqueId+'-title'" aria-activedescendant="activeDateId">
3751 <thead>
3852 <tr>
@@ -66,17 +80,13 @@ const CURRENT_THEME_TEMPLATE:any = TEMPLATE_OPTIONS[Ng2BootstrapConfig.theme ||
6680 </th>
6781 </tr>
6882 <tr>
69- <th [hidden]="!datePicker.showWeeks" class="text-center" ></th>
70- <th *ngFor="#labelz of labels" class="text-center"><small aria-label="labelz.full"><b>{{labelz.abbr}}</b></small></th>
83+ <th [hidden]="!datePicker.showWeeks"></th>
84+ ${ CURRENT_THEME_TEMPLATE . DAY_TITLE }
7185 </tr>
7286 </thead>
7387 <tbody>
7488 <tr *ngFor="#rowz of rows;#index=index">
75- <td [hidden]="!datePicker.showWeeks" class="text-center h6"><em>{{ weekNumbers[index] }}</em></td>
76- <!-- [ngClass]="dtz.customClass" -->
77- <td *ngFor="#dtz of rowz" class="text-center" role="gridcell" [id]="dtz.uid">
78- ${ CURRENT_THEME_TEMPLATE . DAY_BUTTON }
79- </td>
89+ ${ CURRENT_THEME_TEMPLATE . WEEK_ROW }
8090 </tr>
8191 </tbody>
8292</table>
@@ -90,7 +100,7 @@ export class DayPicker implements OnInit {
90100 public rows :Array < any > = [ ] ;
91101 public weekNumbers :Array < number > = [ ] ;
92102
93- constructor ( public datePicker : DatePickerInner ) {
103+ constructor ( public datePicker :DatePickerInner ) {
94104 }
95105
96106 /*private getDaysInMonth(year:number, month:number) {
0 commit comments