@@ -38,46 +38,56 @@ declare var moment: any;
38
38
<b class="prev_next next month" (click)="updateMonthData(+1)">›</b>
39
39
</div>
40
40
41
- <!-- Date -->
42
- <div class="days" *ngIf="!timeOnly">
43
-
44
- <!-- Su Mo Tu We Th Fr Sa -->
45
- <div class="day-of-week"
46
- *ngFor="let dayOfWeek of monthData.localizedDaysOfWeek; let ndx=index"
47
- [class.weekend]="isWeekend(ndx + monthData.firstDayOfWeek)"
48
- title="{{dayOfWeek.fullName}}">
49
- {{dayOfWeek.shortName}}
50
- </div>
51
-
52
- <!-- Fill up blank days for this month -->
53
- <div *ngIf="monthData.leadingDays.length < 7">
54
- <div class="day"
55
- (click)="updateMonthData(-1)"
56
- *ngFor="let dayNum of monthData.leadingDays">
57
- {{dayNum}}
41
+ <div class="week-numbers-and-days"
42
+ [ngClass]="{'show-week-numbers': !timeOnly && showWeekNumbers}">
43
+ <!-- Week -->
44
+ <div class="week-numbers" *ngIf="!timeOnly && showWeekNumbers">
45
+ <div class="week-number" *ngFor="let weekNumber of monthData.weekNumbers">
46
+ {{weekNumber}}
58
47
</div>
59
48
</div>
49
+
50
+ <!-- Date -->
51
+ <div class="days" *ngIf="!timeOnly">
52
+
53
+ <!-- Su Mo Tu We Th Fr Sa -->
54
+ <div class="day-of-week"
55
+ *ngFor="let dayOfWeek of monthData.localizedDaysOfWeek; let ndx=index"
56
+ [class.weekend]="isWeekend(ndx + monthData.firstDayOfWeek)"
57
+ title="{{dayOfWeek.fullName}}">
58
+ {{dayOfWeek.shortName}}
59
+ </div>
60
60
61
- <div class="day"
62
- *ngFor="let dayNum of monthData.days"
63
- (click)="selectDateTime(toDate(dayNum))"
64
- title="{{monthData.year}}-{{monthData.month+1}}-{{dayNum}}"
65
- [ngClass]="{
66
- selectable: !isDateDisabled(toDate(dayNum)),
67
- selected: toDate(dayNum).getTime() === toDateOnly(selectedDate).getTime(),
68
- today: toDate(dayNum).getTime() === today.getTime(),
69
- weekend: isWeekend(dayNum, monthData.month)
70
- }">
71
- {{dayNum}}
72
- </div>
61
+ <!-- Fill up blank days for this month -->
62
+ <div *ngIf="monthData.leadingDays.length < 7">
63
+ <div class="day"
64
+ (click)="updateMonthData(-1)"
65
+ *ngFor="let dayNum of monthData.leadingDays">
66
+ {{dayNum}}
67
+ </div>
68
+ </div>
73
69
74
- <!-- Fill up blank days for this month -->
75
- <div *ngIf="monthData.trailingDays.length < 7">
76
70
<div class="day"
77
- (click)="updateMonthData(+1)"
78
- *ngFor="let dayNum of monthData.trailingDays">
71
+ *ngFor="let dayNum of monthData.days"
72
+ (click)="selectDateTime(toDate(dayNum))"
73
+ title="{{monthData.year}}-{{monthData.month+1}}-{{dayNum}}"
74
+ [ngClass]="{
75
+ selectable: !isDateDisabled(toDate(dayNum)),
76
+ selected: toDate(dayNum).getTime() === toDateOnly(selectedDate).getTime(),
77
+ today: toDate(dayNum).getTime() === today.getTime(),
78
+ weekend: isWeekend(dayNum, monthData.month)
79
+ }">
79
80
{{dayNum}}
80
81
</div>
82
+
83
+ <!-- Fill up blank days for this month -->
84
+ <div *ngIf="monthData.trailingDays.length < 7">
85
+ <div class="day"
86
+ (click)="updateMonthData(+1)"
87
+ *ngFor="let dayNum of monthData.trailingDays">
88
+ {{dayNum}}
89
+ </div>
90
+ </div>
81
91
</div>
82
92
</div>
83
93
@@ -92,20 +102,24 @@ declare var moment: any;
92
102
<span class="timeValue">
93
103
{{("0"+hour).slice(-2)}} : {{("0"+minute).slice(-2)}}
94
104
</span><br/>
95
- <label class="hourLabel">{{locale.hour}}:</label>
96
- <input #hours class="hourInput"
97
- tabindex="90000"
98
- (change)="selectDateTime()"
99
- type="range"
100
- min="{{minHour || 0}}"
101
- max="{{maxHour || 23}}"
102
- [(ngModel)]="hour" />
103
- <label class="minutesLabel">{{locale.minute}}:</label>
104
- <input #minutes class="minutesInput"
105
- tabindex="90000"
106
- step="{{minuteStep}}"
107
- (change)="selectDateTime()"
108
- type="range" min="0" max="59" range="10" [(ngModel)]="minute"/>
105
+ <div>
106
+ <label class="hourLabel">{{locale.hour}}:</label>
107
+ <input #hours class="hourInput"
108
+ tabindex="90000"
109
+ (change)="selectDateTime()"
110
+ type="range"
111
+ min="{{minHour || 0}}"
112
+ max="{{maxHour || 23}}"
113
+ [(ngModel)]="hour" />
114
+ </div>
115
+ <div>
116
+ <label class="minutesLabel">{{locale.minute}}:</label>
117
+ <input #minutes class="minutesInput"
118
+ tabindex="90000"
119
+ step="{{minuteStep}}"
120
+ (change)="selectDateTime()"
121
+ type="range" min="0" max="59" range="10" [(ngModel)]="minute"/>
122
+ </div>
109
123
</div>
110
124
</div>
111
125
` ,
@@ -143,6 +157,9 @@ declare var moment: any;
143
157
animation: slideDown 0.1s ease-in-out;
144
158
animation-fill-mode: both;
145
159
}
160
+ .ng2-datetime-picker .days {
161
+ width: 210px; /* 30 x 7 days */
162
+ }
146
163
.ng2-datetime-picker .close-button {
147
164
position: absolute;
148
165
width: 1em;
@@ -166,6 +183,7 @@ declare var moment: any;
166
183
border-bottom: 1px solid #ddd;
167
184
position: relative;
168
185
}
186
+
169
187
.ng2-datetime-picker > .month > .prev_next {
170
188
color: #555;
171
189
display: block;
@@ -187,46 +205,61 @@ declare var moment: any;
187
205
.ng2-datetime-picker > .month > .prev_next.next {
188
206
float: right;
189
207
}
190
- .ng2-datetime-picker > .days {
208
+
209
+ .ng2-datetime-picker .week-numbers-and-days {
210
+ text-align: center;
211
+ }
212
+ .ng2-datetime-picker .week-numbers {
213
+ line-height: 30px;
214
+ display: inline-block;
215
+ padding: 30px 0 0 0;
216
+ color: #ddd;
217
+ text-align: right;
218
+ width: 21px;
219
+ vertical-align: top;
220
+ }
221
+
222
+ .ng2-datetime-picker .days {
223
+ display: inline-block;
191
224
width: 210px; /* 30 x 7 */
192
- margin: 10px;
193
225
text-align: center;
226
+ padding: 0 10px;
194
227
}
195
- .ng2-datetime-picker > .days .day-of-week,
196
- .ng2-datetime-picker > .days .day {
228
+ .ng2-datetime-picker .days .day-of-week,
229
+ .ng2-datetime-picker .days .day {
197
230
box-sizing: border-box;
198
231
-moz-box-sizing: border-box;
199
232
border: 1px solid transparent;
200
233
width: 30px;
201
234
line-height: 28px;
202
235
float: left;
203
236
}
204
- .ng2-datetime-picker > .days .day-of-week {
237
+ .ng2-datetime-picker .days .day-of-week {
205
238
font-weight: bold;
206
239
}
207
- .ng2-datetime-picker > .days .day-of-week.weekend {
240
+ .ng2-datetime-picker .days .day-of-week.weekend {
208
241
color: #ccc;
209
242
background-color: inherit;
210
243
}
211
- .ng2-datetime-picker > .days .day:not(.selectable) {
244
+ .ng2-datetime-picker .days .day:not(.selectable) {
212
245
color: #ccc;
213
246
cursor: default;
214
247
}
215
- .ng2-datetime-picker > .days .weekend {
248
+ .ng2-datetime-picker .days .weekend {
216
249
color: #ccc;
217
250
background-color: #eee;
218
251
}
219
- .ng2-datetime-picker > .days .day.selectable {
252
+ .ng2-datetime-picker .days .day.selectable {
220
253
cursor: pointer;
221
254
}
222
- .ng2-datetime-picker > .days .day.selected {
255
+ .ng2-datetime-picker .days .day.selected {
223
256
background: gray;
224
257
color: #fff;
225
258
}
226
- .ng2-datetime-picker > .days .day:not(.selected).selectable:hover {
259
+ .ng2-datetime-picker .days .day:not(.selected).selectable:hover {
227
260
background: #eee;
228
261
}
229
- .ng2-datetime-picker > .days:after {
262
+ .ng2-datetime-picker .days:after {
230
263
content: '';
231
264
display: block;
232
265
clear: left;
@@ -248,13 +281,9 @@ declare var moment: any;
248
281
.ng2-datetime-picker .hourLabel,
249
282
.ng2-datetime-picker .minutesLabel {
250
283
display: inline-block;
251
- width: 40px ;
252
- text -align: right ;
284
+ width: 45px ;
285
+ vertical -align: top ;
253
286
}
254
- .ng2-datetime-picker input[type=range] {
255
- width: 200px;
256
- }
257
-
258
287
.closing-layer {
259
288
display: block;
260
289
position: fixed;
@@ -282,11 +311,13 @@ declare var moment: any;
282
311
bottom: 0;
283
312
left: 0;
284
313
right: 0;
314
+ width: auto !important;
285
315
animation: slideUp 0.1s ease-in-out;
286
316
}
287
317
288
- .ng2-datetime-picker .days {
289
- margin: 10px auto;
318
+ .ng2-datetime-picker > .days {
319
+ display: block;
320
+ margin: 0 auto;
290
321
}
291
322
292
323
.closing-layer {
@@ -319,6 +350,7 @@ export class Ng2DatetimePickerComponent {
319
350
@Input ( 'disabled-dates' ) disabledDates : Date [ ] ;
320
351
@Input ( 'show-close-button' ) showCloseButton : boolean ;
321
352
@Input ( 'show-close-layer' ) showCloseLayer : boolean ;
353
+ @Input ( 'show-week-numbers' ) showWeekNumbers : boolean = false ;
322
354
@Input ( 'show-today-shortcut' ) showTodayShortcut : boolean = false ;
323
355
324
356
@Output ( 'selected$' ) selected$ :EventEmitter < any > = new EventEmitter ( ) ;
0 commit comments