-
Notifications
You must be signed in to change notification settings - Fork 209
Expand file tree
/
Copy pathdatepicker.component.html
More file actions
executable file
·209 lines (209 loc) · 8.25 KB
/
datepicker.component.html
File metadata and controls
executable file
·209 lines (209 loc) · 8.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<div class="devui-month-view {{ cssClass }}">
<table class="devui-table devui-month-view-table">
<thead class="devui-noSelect">
<tr class="devui-date-header">
<td>
<a
class="devui-btn-link"
aria-hidden="true"
(click)="onPreYearOption()"
[ngClass]="{
'devui-year-month-disabled': !hasPreYearOption()
}"
>
<svg
width="10px"
height="10px"
viewBox="0 0 10 10"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g transform="translate(-1.000000, -1.000000)">
<path
d="M11,1.83333333 L11,10.1666667 L7,7.38833333 L7,10.1666667 L1,6 L7,1.83333333 L7,4.61033333 L11,1.83333333 Z"
></path>
</g>
</g>
</svg>
</a>
</td>
<td>
<a
*ngIf="!openChooseYear && !openChooseMonth"
class="devui-btn-link devui-btn-left"
aria-hidden="true"
(click)="onPreMonth()"
[ngClass]="{ 'devui-year-month-disabled': !hasPreMonth() }"
>
<svg
width="6px"
height="10px"
viewBox="0 0 6 10"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g transform="translate(-3.000000, -1.000000)">
<polygon
transform="translate(6.000000, 6.000000) rotate(-90.000000) translate(-6.000000, -6.000000) "
points="6 3 10.1666667 9 1.83333333 9"
></polygon>
</g>
</g>
</svg>
</a>
</td>
<td colspan="3" class="devui-dropdown">
<span class="devui-date-title" (click)="toggle($event, 'year')">{{ i18nText?.yearDisplay(currentYear) }}</span>
<span class="devui-date-title-buffer"></span>
<span class="devui-date-title" (click)="toggle($event, 'month')" *ngIf="mode !== 'year'">{{
(i18nText?.monthsOfYear)[currentMonthIndex]
}}</span>
<ul class="devui-monthOption text-center" [style.display]="openChooseMonth ? 'block' : 'none'">
<li
*ngFor="let month of availableMonths"
[ngClass]="{ active: currentMonthIndex == month.index, disabled: month.disabled }"
(click)="onSelectMonth(month)"
>
{{ month.title }}
</li>
</ul>
<ul class="devui-yearOption text-center" [style.display]="openChooseYear ? 'block' : 'none'">
<li
*ngFor="let item of yearOptions"
[ngClass]="{ active: currentYear == item.title, disabled: item.disabled }"
(click)="onSelectYear(item, $event)"
>
{{ item.title }}
</li>
</ul>
</td>
<td>
<a
*ngIf="!openChooseYear && !openChooseMonth"
class="devui-btn-link devui-btn-right"
aria-hidden="true"
(click)="onNextMonth()"
[ngClass]="{ 'devui-year-month-disabled': !hasNextMonth() }"
>
<svg
width="6px"
height="9px"
viewBox="0 0 6 9"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g transform="translate(-3.000000, -2.000000)">
<polygon
transform="translate(6.000000, 6.166667) scale(-1, 1) rotate(-90.000000) translate(-6.000000, -6.166667) "
points="6 3.16666667 10.1666667 9.16666667 1.83333333 9.16666667"
></polygon>
</g>
</g>
</svg>
</a>
</td>
<td>
<a
class="devui-btn-link"
aria-hidden="true"
(click)="onNextYearOption()"
[ngClass]="{
'devui-year-month-disabled': !hasNextYearOption()
}"
>
<svg
width="10px"
height="9px"
viewBox="0 0 10 9"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g transform="translate(-1.000000, -2.000000)">
<polygon points="5 4.77777778 5 2 11 6.16666667 5 10.3333333 5 7.55555556 1 10.3333333 1 2"></polygon>
</g>
</g>
</svg>
</a>
</td>
</tr>
<tr class="small text-center devui-week-header">
<td *ngFor="let item of i18nText?.daysOfWeek">{{ item }}</td>
</tr>
</thead>
<tbody class="devui-noSelect">
<tr *ngFor="let week of displayWeeks">
<td
*ngFor="let day of week"
class="devui-day"
[ngClass]="{
'devui-out-of-month': !day.inMonth,
'devui-in-month-day': day.inMonth,
active: isSelectDay(day.date),
disabled: isDisabledDay(day.date),
'devui-today': day.isToday
}"
(click)="onSelectDate($event, day.date)"
>
<div class="devui-calendar-date">{{ day.day }}</div>
</td>
</tr>
</tbody>
<tfoot [ngClass]="{ 'devui-noSelect': !customViewTemplate }">
<tr class="time-picker-view" (click)="!customViewTemplate && $event.stopPropagation()" *ngIf="showTime || !customViewTemplate">
<td colspan="4">
<div class="devui-timepicker" *ngIf="showTime" [ngClass]="{ 'devui-timepicker-disabled': isDisabledTime() }">
<div class="devui-time">
<input [ngModel]="currentHour" (keydown)="fixTime($event, 'h')" [disabled]="isDisabledTime()" />
<div class="devui-btn-nav" *ngIf="!isDisabledTime()">
<div class="btn-up" (click)="timeUp('h')"></div>
<div class="btn-down" (click)="timeDown('h')"></div>
</div>
</div>
<div class="devui-time">
<input class="devui-minutes" [ngModel]="currentMinute" (keydown)="fixTime($event, 'm')" [disabled]="isDisabledTime()" />
<div class="devui-btn-nav" *ngIf="!isDisabledTime()">
<div class="btn-up" (click)="timeUp('m')"></div>
<div class="btn-down" (click)="timeDown('m')"></div>
</div>
</div>
<div class="devui-time">
<input class="devui-seconds" [ngModel]="currentSecond" (keydown)="fixTime($event, 's')" [disabled]="isDisabledTime()" />
<div class="devui-btn-nav" *ngIf="!isDisabledTime()">
<div class="btn-up" (click)="timeUp('s')"></div>
<div class="btn-down" (click)="timeDown('s')"></div>
</div>
</div>
</div>
</td>
<td colspan="3">
<div class="devui-btn-wrapper" *ngIf="showTime">
<d-button bsStyle="common" [disabled]="disabled" (btnClick)="confirmTime($event)" bsSize="sm"
>{{ i18nCommonText?.btnConfirm }}
</d-button>
</div>
<div class="devui-btn-wrapper" *ngIf="!showTime">
<d-button bsStyle="common" [disabled]="isTodayDisable() || disabled" (btnClick)="chooseToday()" bsSize="sm"
>{{ i18nText?.today }}
</d-button>
</div>
</td>
</tr>
<tr class="time-picker-view devui-custom-area" *ngIf="customViewTemplate">
<td colspan="7">
<ng-template
[ngTemplateOutlet]="customViewTemplate"
[ngTemplateOutletContext]="{ $implicit: this, chooseDate: chooseDate, clearAll: clearAll }"
></ng-template>
</td>
</tr>
</tfoot>
</table>
</div>