2 |
3 |
4 |
5 | {{date | date: settings.format}}
6 |
7 |
8 |
9 |
10 |
11 |
{{date | date: 'EEEE'}}
12 |
{{date | date: 'dd'}}
13 |
14 |
15 |
{{date | date: 'MMMM'}}
16 |
17 |
18 |
{{date | date: 'yyyy'}}
19 |
20 |
21 |
22 |
23 | {{date | date: 'hh'}} : {{date | date: 'mm'}} {{date | date: 'a'}}
24 |
25 |
26 |
27 |
28 |
29 |
30 |
{{date | date: 'MMMM'}}
31 |
33 |
34 |
35 | {{date | date: 'MMMM'}}
36 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | {{date | date: 'yyyy'}}
45 |
46 |
47 |
48 |
49 |
60 |
61 | {{month}}
63 |
64 |
65 |
66 |
67 |
68 | {{year}}
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 |
100 | {{day.day}}
101 | |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
Done
110 |
111 |
112 |
113 |
114 |
115 |
125 |
126 |
127 |
128 |
129 |
130 |
131 | {{dateRange.startDate | date: 'dd'}}
132 |
133 |
134 |
135 |
136 | {{dateRange.startDate | date: 'MMMM'}} {{dateRange.startDate | date: 'yyyy'}}
137 |
138 |
139 |
140 | {{dateRange.startDate | date: 'EEEE'}}
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
{{dateRange.endDate | date: 'dd'}}
150 |
151 |
152 |
153 | {{dateRange.endDate | date: 'MMMM'}} {{dateRange.endDate | date: 'yyyy'}}
154 |
155 |
156 |
157 | {{dateRange.endDate | date: 'EEEE'}}
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
{{leftDate | date: 'MMMM'}}
166 |
168 |
169 |
170 | {{leftDate | date: 'MMMM'}}
171 |
173 |
174 |
175 |
176 |
177 |
178 |
179 | {{leftDate | date: 'yyyy'}}
180 |
181 |
182 |
183 |
184 |
195 |
196 | {{month}}
198 |
199 |
200 |
201 |
202 |
203 | {{year}}
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
:
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
234 | {{day.day}}
235 | |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
{{rightDate | date: 'MMMM'}}
245 |
247 |
248 |
249 | {{rightDate | date: 'MMMM'}}
250 |
252 |
253 |
254 |
255 |
256 |
257 |
258 | {{rightDate | date: 'yyyy'}}
259 |
260 |
261 |
262 |
263 |
274 |
275 | {{month}}
277 |
278 |
279 |
280 |
281 |
282 | {{year}}
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
:
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
313 | {{day.day}}
314 | |
315 |
316 |
317 |
318 |
319 |
327 |
328 |
--------------------------------------------------------------------------------
/src/app/angular2-datetimepicker/datepicker.component.scss:
--------------------------------------------------------------------------------
1 | @import url('https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700');
2 |
3 | $base-color: #1565c0;
4 | $secondary-color: #ffffff;
5 |
6 | body{
7 | font-family: 'Roboto',sans-serif;
8 | }
9 | *{
10 | box-sizing: border-box;
11 | }
12 | #cuppaDatePickerContainer, #cuppaDatePicker{
13 | width: 250px;
14 | text-align: center;
15 | margin: 0px auto;
16 | font-family: 'Roboto','Arial',sans-serif;
17 | }
18 | .year-dropdown{
19 | text-align: center;
20 | }
21 | .calendar-header{
22 | color: #333;
23 | background: #fff;
24 | }
25 | .wc-date-container{
26 | float: left;
27 | width: 100%;
28 | height: 30px;
29 | border: 1px solid $base-color;
30 | margin-bottom: 1px;
31 | font-size: 16px;
32 | padding: 5px;
33 | text-align: left;
34 | cursor: pointer;
35 | background: #fff;
36 | line-height: 20px;
37 | }
38 | .wc-date-container > span{
39 | color: $base-color;
40 | }
41 | .wc-date-container > i{
42 | float: right;
43 | font-size: 20px;
44 | color: $base-color;
45 | }
46 | .winkel-calendar{
47 | position: relative;
48 | font-family: 'Roboto','Arial',sans-serif;
49 | }
50 | .wc-date-popover{
51 | font-size: 14px;
52 | box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.4); margin: 0px auto;
53 | perspective: 1000px;
54 | float: left;
55 | background: #fff;
56 | background: $secondary-color;
57 | position: fixed;
58 | width: 90%;
59 | top: 5%;
60 | left: 50%;
61 | z-index: 9999999;
62 | overflow: hidden;
63 | height: 90%;
64 | max-width: 320px;
65 | transition: all .5s linear;
66 | transform: translateX(-50%);
67 | }
68 | .wc-banner{
69 | /* background: #3ce5ed; */
70 | float: left;
71 | width: 100%;
72 | font-size: 54px;
73 | background: $base-color;
74 | }
75 | .wc-day-row{
76 | padding: 5px 0px;
77 | /*background: rgba(0, 0, 0, 0.09);*/
78 | color: $secondary-color;
79 | width: 100%;
80 | float: left;
81 | font-size: 3vh;
82 | text-align: center;
83 | }
84 | .wc-date-row{
85 | display: inline-block;
86 | font-size: 25vw;
87 | color: $secondary-color;
88 | padding: 5px;
89 | width: 50%;
90 | float: left;
91 | text-align: right;
92 | font-weight: 200;
93 | }
94 | .wc-month-row{
95 | padding: 25px 0px 0px 0px;
96 | font-size: 8vw;
97 | color: $secondary-color;
98 | width: 100%;
99 | float: left;
100 | }
101 | .wc-month-row > div, .wc-year-row > div{
102 |
103 | }
104 | .wc-month-row > i, .wc-year-row > i{
105 | float: right;
106 | font-size: 12px;
107 | padding: 10px 6px;
108 | cursor: pointer;
109 | }
110 | .wc-month-row > i:hover, .wc-year-row > i:hover{
111 | color: rgba(255, 255, 255, 0.63);
112 | }
113 | .wc-year-row{
114 | text-align: left;
115 | color: $secondary-color;
116 | font-size: 7vw;
117 | float: left;
118 | width: 100%;
119 | padding: 2px 0px 0px 0px;
120 | }
121 | .timepicker-true .wc-year-row{
122 | font-size: 20px;
123 | padding: 5px 0px 0px 12px;
124 | }
125 | .timestate > .active{
126 | color: #fff;
127 | }
128 | .timestate span{
129 | cursor:pointer;
130 | }
131 | .wc-my-sec{
132 | display: inline-block;
133 | padding: 5px 10px;
134 | float: left;
135 | width: 50%;
136 | font-weight: 300;
137 | }
138 | .timepicker-true .wc-my-sec{
139 | width: 20%;
140 | }
141 | .time i{
142 | font-size: 21px;
143 | display: block;
144 | text-align: center;
145 | cursor: pointer;
146 | }
147 | .time i:hover{
148 | color: rgba(255, 255, 255, 0.65);
149 | }
150 | .time > .hour, .time > .minutes{
151 | float: left;
152 | width: 48%;
153 | text-align: center;
154 | }
155 | .wc-month-row > div:nth-child(1), .wc-year-row > div:nth-child(1){
156 | float: left;
157 | text-align: left;
158 | }
159 | .wc-time-sec{
160 | color: $secondary-color;
161 | text-align: center;
162 | padding: 0px 10px 10px;
163 | float: left;
164 | width: 100%;
165 | }
166 | .wc-time-sec > .time{
167 | font-size: 38px;
168 | font-weight: 300;
169 | width: 100%;
170 | text-align: center;
171 | float: left;
172 | }
173 | .time-divider{
174 | width: 4%;
175 | float: left;
176 | text-align: center;
177 | padding: 0px 10px;
178 | }
179 | .time-view{
180 | position: absolute;
181 | background: #fff;
182 | width: 100%;
183 | z-index: 1;
184 | top: 40px;
185 | padding: 35px;
186 | border-top: 1px solid $base-color;
187 | }
188 | .time-view-btn {
189 | text-align: center;
190 | }
191 | .meridian{
192 | text-align: center;
193 | padding: 15px 0px;
194 | }
195 | .button{
196 | width: 100%;
197 | padding: 10px;
198 | background: $base-color;
199 | color: #fff;
200 | margin: 0px auto;
201 | border: 1px solid $base-color;
202 | border-radius: 3px;
203 | cursor: pointer;
204 | }
205 | .button-sm{
206 | width: 50%;
207 | }
208 | .time-view .time{
209 | font-size: 36px;
210 | width: 100%;
211 | margin: 0px auto;
212 | display: inline-block;
213 | padding: 5px 0px 0px 0px;
214 | color: $base-color;
215 | font-weight: 300;
216 | }
217 | .time-view .time-divider{
218 | padding: 16px 0;
219 | }
220 | .wc-time-sec .time input, .time-view .time input {
221 | display: inline-block;
222 | width: 100%;
223 | background: none;
224 | border: none;
225 | text-align: center;
226 | cursor: pointer;
227 | font-family: inherit;
228 | font-size: 32px;
229 | font-weight: 300;
230 | padding: 0px 10px;
231 | text-align: center;
232 | color: $base-color;
233 | }
234 | .inc-btn, .dec-btn {
235 | font-size: 14px;
236 | display: block;
237 | color: #8e8e8e;
238 | }
239 | .wc-time-sec > .time > .timestate{
240 | float: left;
241 | padding: 0px 10px;
242 | }
243 | .show-time-picker .wc-date-row{
244 | width: 33% !important;
245 | }
246 | .show-time-picker .wc-my-sec{
247 | width: 22% !important;
248 | }
249 |
250 | .wc-month-controls > .fa:hover, .wc-year-controls > .fa:hover{
251 | color: #fff;
252 | }
253 | .wc-details > .fa:hover{
254 | color: #ccc;
255 | }
256 | .wc-month-controls{
257 | padding: 5px;
258 | font-size: 16px;
259 | color: rgba(255, 255, 255, 0.71);
260 | float: right;
261 | }
262 | .wc-year-controls{
263 | padding: 2px 5px 0px 5px;
264 | font-size: 16px;
265 | color: rgba(255, 255, 255, 0.71);
266 | float: right;
267 | }
268 | .wc-year-controls > .fa , .wc-month-controls > .fa{
269 | cursor: pointer;
270 | padding: 0px 4px;
271 | }
272 |
273 | .wc-details{
274 | float: left;
275 | width: 65%;
276 | padding: 10px 0px 10px;
277 | color: $secondary-color;
278 | background: $base-color;
279 | }
280 | .banner-true > .wc-details{
281 | padding: 10px 0px 10px;
282 | }
283 | .wc-prev{
284 | float: left;
285 | width:25%;
286 | text-align: left;
287 | padding: 0px 15px;
288 | cursor: pointer;
289 | font-size: 35px;
290 | }
291 | .month-year{
292 | float: left;
293 | width:50%;
294 | font-size: 18px;
295 | line-height: 35px;
296 | text-align: center;
297 | }
298 | .wc-next{
299 | float: right;
300 | width:25%;
301 | text-align: right;
302 | padding: 0px 15px;
303 | cursor: pointer;
304 | font-size: 35px;
305 | }
306 | .calendar-days{
307 | color: #07c;
308 | background: #fff;
309 | }
310 | .cal-util{
311 | width: 100%;
312 | float: left;
313 | position: absolute;
314 | bottom: 0;
315 | background: #fff;
316 | border-top: 1px solid #f2f2f2;
317 | }
318 | .cal-util > .ok{
319 | width: 100%;
320 | padding: 5px;
321 | float: left;
322 | color: $base-color;
323 | font-size: 18px;
324 | border-top: 1px solid #d1d1d1;
325 | text-align: center;
326 | cursor: pointer;
327 | }
328 | .ok > i{
329 | margin-right: 5px;
330 | }
331 | .cal-util > .cancel{
332 | width: 50%;
333 | float: left;
334 | padding: 10px;
335 | color: $base-color;
336 | font-size: 20px;
337 | }
338 | .cal-util > .ok:hover, .cal-util > .cancel:hover{
339 | box-shadow: inset 0px 0px 20px #ccc;
340 | }
341 | .range-date-popover .cal-util{
342 | padding: 10px;
343 | }
344 | .range-date-popover .cal-util .btn-xs{
345 | float: right;
346 | }
347 | .btn-xs {
348 | padding: 5px 10px;
349 | width: auto;
350 | }
351 | .today > span{
352 | border: 1px solid $base-color;
353 | background: none;
354 | }
355 | .selected-day > span{
356 | /*background: #3ce5ed;*/
357 | background: $base-color;
358 | color: #fff;
359 | }
360 | .calendar-header{
361 |
362 | }
363 |
364 | .calendar-days td{
365 | cursor: pointer;
366 | }
367 | .calendar-day:hover > span{
368 | background: $base-color;
369 | color: #fff;
370 | }
371 | .winkel-calendar table{
372 | width: 100%;
373 | text-align: center;
374 | font-size: 18px;
375 | border-collapse: collapse;
376 | }
377 | .winkel-calendar table td{
378 | padding: 0px 0px;
379 | width: calc((100%)/7);
380 | text-align: center;
381 | transition: all .1s linear;
382 | }
383 | .winkel-calendar table td span{
384 | display: block;
385 | padding: 7px;
386 | margin: 0px;
387 | line-height: 32px;
388 | }
389 | .calendar-header td{
390 | padding: 5px 0px !important;
391 | }
392 | .months-view, .years-view{
393 | background: #fff;
394 | width: 100%;
395 | top: 210px;
396 | width: 100%;
397 | height: calc(100% - 210px);
398 | bottom: 0;
399 | text-align: center;
400 |
401 | }
402 | .years-list-view{
403 | float: left;
404 | width: calc(100% - 60px);
405 | height: 100%;
406 | }
407 | .months-view > span, .years-list-view > span{
408 | display: inline-block;
409 | width: 25%;
410 | padding: 25px 0px;
411 | cursor: pointer;
412 | font-size: 16px;
413 | }
414 | .years-list-view > span{
415 | width: 33.3333%
416 | }
417 | .years-view > .prev, .years-view > .next{
418 | float: left;
419 | width: 30px;
420 | padding: 85px 0px;
421 | cursor: pointer;
422 | font-size: 52px;
423 | }
424 | .years-view > .prev:hover, .years-view > .next:hover{
425 | color: #ccc;
426 | }
427 | .years-view > .next{
428 | float: right;
429 | }
430 | .current-month, .current-year{
431 | color: $base-color;
432 | }
433 | .years-view > span{
434 | width: 33.3333%;
435 | }
436 | .months-view > span:hover, .years-list-view > span:hover{
437 | color: $base-color;
438 | }
439 | .banner-true{
440 | padding-top: 0px !important;
441 | }
442 | .banner-true > .wc-banner{
443 | margin-bottom : 0px !important;
444 | }
445 | .banner-true > .time-view{
446 | height: calc(100% - 124px);
447 | top: 142px;
448 | }
449 | .methods{
450 | clear: left;
451 | padding: 50px 0px;
452 | text-align: center;
453 | }
454 | .month-year i{
455 | cursor:pointer;
456 | font-size: 10px;
457 | }
458 |
459 | .timepicker-true .wc-month-row{
460 | font-size: 28px;
461 | padding: 5px 0px 5px 15px;
462 | }
463 | .timepicker-true .wc-month-row > div:nth-child(1), .wc-year-row > div:nth-child(1){
464 | }
465 | .timepicker-true .wc-month-row > i, .wc-year-row > i{
466 | padding: 8px 6px;
467 | }
468 | .timepicker-true .wc-my-sec{
469 | padding: 16px 2px;
470 | }
471 | .timepicker-true .wc-time-sec{
472 | width: 48%;
473 | padding: 25px 0px;
474 | margin: 0px;
475 | cursor: pointer;
476 | }
477 | .timepicker-true .wc-time-sec:hover{
478 | color: rgba(255, 255, 255, 0.65);
479 | }
480 | .timepicker-true .wc-time-sec > .time{
481 | width: 75%;
482 | cursor: pointer;
483 | }
484 | .timepicker-true .time i{
485 | display: none;
486 | }
487 | .timepicker-true .time-divider{
488 | padding: 0px;
489 | }
490 | .timepicker-true .timestate{
491 | padding: 0px;
492 | width: auto;
493 | padding-top: 7px;
494 | font-size: 20px;
495 | font-weight: 300;
496 | }
497 | .year-title{
498 | width: 35%;
499 | float: left;
500 | line-height: 55px;
501 | font-size: 18px;
502 | color: $secondary-color;
503 | background: $base-color;
504 | }
505 | .year-title i{
506 | float: right;
507 | padding: 13px 10px 7px 0px;
508 | font-size: 28px;
509 | }
510 |
511 | @media (min-width: 365px) and (max-width: 767px){
512 | .wc-date-row{
513 | }
514 | .timepicker-true .wc-date-row {
515 | width: 54%;
516 | padding: 20px 5px 10px;
517 | }
518 | .timepicker-true .wc-my-sec {
519 | padding: 33px 2px 10px;
520 | width: 46%;
521 | }
522 | .timepicker-true .wc-time-sec {
523 | width: 100%;
524 | padding: 0px 0px 15px 0px;
525 | }
526 | .timepicker-true .wc-time-sec > .time {
527 | width: 35%;
528 | float: none;
529 | margin: 0px auto;
530 | font-size: 42px;
531 | }
532 | .timepicker-true .wc-month-row {
533 | font-size: 42px;
534 | padding: 5px 0px 5px 5px;
535 | }
536 | .timepicker-true .wc-year-row {
537 | font-size: 24px;
538 | padding: 15px 0px 0px 5px;
539 | }
540 | .timepicker-true .timestate{
541 | font-size: 22px;
542 | font-weight: 100;
543 | }
544 | .months-view, .years-view{
545 | top: 297px;
546 | }
547 | .banner-true > .time-view{
548 | top: 240px;
549 | }
550 | .time-view .time{
551 | font-size: 62px;
552 | }
553 | .cuppa-btn-group{
554 | font-size: 22px;
555 | font-weight: 300;
556 | }
557 | .angular-range-slider{
558 | height: 5px;
559 | margin: 20px auto 25px auto;
560 | }
561 | .angular-range-slider div.handle{
562 | width: 45px;
563 | height: 45px;
564 | top: -20px;
565 | font-size: 26px;
566 | }
567 | .time-view-btn{
568 | padding: 25px 0px;
569 | }
570 | .button-sm {
571 | width: 80%;
572 | padding: 10px;
573 | font-size: 16px;
574 | }
575 | .cuppa-btn-group > .button{
576 | padding: 5px 15px !important;
577 | }
578 |
579 | }
580 | @media (min-width: 768px) {
581 | .wc-date-popover{
582 | width: 250px;
583 | position: absolute;
584 | top: 31px;
585 | height: auto;
586 | left: 0;
587 | transform: translateX(0);
588 | }
589 | .wc-day-row{
590 | padding: 5px 0px;
591 | font-size: 0.25em;
592 | }
593 | .wc-date-row{
594 | font-size: 1em;
595 | padding: 5px;
596 | }
597 | .wc-my-sec{
598 | padding: 5px 0px;
599 | }
600 | .timepicker-true .wc-my-sec{
601 | padding: 15px 3px;
602 | }
603 | .wc-month-row{
604 | padding: 10px 0px 0px 0px;
605 | font-size: 0.4em;
606 | }
607 | .wc-year-row{
608 | font-size: 0.3em;
609 | padding: 0px;
610 | }
611 | .month-year{
612 | font-size: 14px;
613 | line-height: 20px;
614 | cursor: pointer;
615 | }
616 | .wc-month-row > div:nth-child(1), .wc-year-row > div:nth-child(1){
617 | }
618 | .wc-prev, .wc-next{
619 | font-size: 18px;
620 | }
621 | .wc-details{
622 | padding: 10px 0px 10px;
623 | }
624 | .year-title{
625 | line-height: 40px;
626 | font-size: 16px;
627 | }
628 | .year-title i{
629 | padding: 11px 10px 10px 0px;
630 | font-size: 18px;
631 | }
632 | .calendar-header td{
633 | padding: 5px 0px !important;
634 | }
635 | .winkel-calendar table{
636 | font-size: 14px;
637 | }
638 | .winkel-calendar table td span{
639 | line-height: 24px;
640 | width: 35px;
641 | height: 35px;
642 | }
643 | .months-view, .years-view{
644 | top: 40px;
645 | width: 100%;
646 | height: calc(100%);
647 | }
648 | .banner-true .months-view, .banner-true .years-view{
649 | top: 165px;
650 | height: calc(100% - 128px);
651 | }
652 | .winkel-calendar table td span{
653 | padding: 6px;
654 | }
655 | .cal-util > .ok{
656 | font-size: 14px;
657 | padding: 10px;
658 | }
659 | .wc-time-sec > .time{
660 | font-size: 0.35em;
661 | cursor: pointer;
662 | }
663 | .time i{
664 | font-size: 10px;
665 | }
666 | .wc-time-sec > .timestate{
667 | font-size: 16px;
668 | }
669 | .wc-month-row > div:nth-child(1), .wc-year-row > div:nth-child(1){
670 | min-width: 35px;
671 | }
672 | .wc-month-row > i, .wc-year-row > i{
673 | font-size: 8px;
674 | }
675 | .cal-util{
676 | position: relative;
677 | }
678 | .banner-true > .time-view {
679 | top: 159px;
680 | }
681 | .timepicker-true .wc-month-row {
682 | padding: 6px 0px 0px 0px;
683 | font-size: 18px;
684 | }
685 | .timepicker-true .wc-year-row {
686 | padding: 0px 0px 0px 0px;
687 | font-size: 16px;
688 | }
689 | }
690 | .time-view h5{
691 | text-align: left;
692 | width: 80%;
693 | margin: 0px auto;
694 | padding: 5px 0px;
695 | font-weight: 400;
696 | }
697 |
698 | .cuppa-btn-group{
699 | display: inline-flex;
700 | }
701 | .cuppa-btn-group > .active{
702 | background: $base-color !important;
703 | color: #fff !important;
704 | }
705 | .cuppa-btn-group > .button{
706 | border: 1px solid $base-color;
707 | background: #fff;
708 | border-radius: 3px;
709 | float: left;
710 | margin: 0px;
711 | align-items: initial;
712 | color: $base-color;
713 | width: auto;
714 | padding: 5px 10px;
715 | }
716 | .cuppa-btn-group > .button:first-child{
717 | border-top-right-radius: 0px;
718 | border-bottom-right-radius: 0px;
719 | border-right: 0px;
720 | }
721 | .cuppa-btn-group > .button:last-child{
722 | border-top-left-radius: 0px;
723 | border-bottom-left-radius: 0px;
724 | }
725 |
726 | /* Slider CSS*/
727 |
728 | .slider{
729 | width: 200px;
730 | height: 5px;
731 | background: #ccc;
732 | border-radius: 5px;
733 | margin: 12px auto;
734 | position: relative;
735 | }
736 | .slider > .circle{
737 | width: 20px;
738 | height: 20px;
739 | background: #fff;
740 | position: absolute;
741 | top: -8px;
742 | border-radius: 20px;
743 | left: 60px;
744 | box-shadow: 0px 0px 5px #ccc;
745 | cursor: pointer;
746 | }
747 | input[type='number'] {
748 | -moz-appearance:textfield;
749 | }
750 | /* Webkit browsers like Safari and Chrome */
751 | input[type=number]::-webkit-inner-spin-button,
752 | input[type=number]::-webkit-outer-spin-button {
753 | -webkit-appearance: none;
754 | margin: 0;
755 | }
756 | .range-highlight {
757 | background: #f2f2f2;
758 | }
759 | .clock-icon {
760 | text-align: center;
761 | color: $base-color;
762 | }
763 | .time-close{
764 | position: absolute;
765 | right: 15px;
766 | top: 15px;
767 | cursor: pointer;
768 | }
769 | .util-list {
770 | list-style: none;
771 | float: left;
772 | padding: 0px;
773 | margin: 0px;
774 | }
775 | .util-list li {
776 | float: left;
777 | padding: 5px;
778 | }
779 | .util-list li a{
780 | color: #007bff;
781 | cursor: pointer;
782 | }
783 | .util-list li a:hover{
784 | color: #14569d;
785 | text-decoration: underline;
786 | }
787 |
--------------------------------------------------------------------------------
/src/app/angular2-datetimepicker/datepicker.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, forwardRef, EventEmitter, Input, Output } from '@angular/core';
2 | import { DatePipe } from '@angular/common';
3 | import { DateRange } from './model';
4 | import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';
5 | import { Settings } from './interface';
6 |
7 | export const DATEPICKER_CONTROL_VALUE_ACCESSOR: any = {
8 | provide: NG_VALUE_ACCESSOR,
9 | useExisting: forwardRef(() => DatePicker),
10 | multi: true
11 | };
12 |
13 | @Component({
14 | selector: 'angular2-date-picker',
15 | templateUrl: './datepicker.component.html',
16 | styleUrls: ['./datepicker.component.scss', './rangepicker.scss'],
17 | providers: [DATEPICKER_CONTROL_VALUE_ACCESSOR]
18 | })
19 |
20 | export class DatePicker implements OnInit, ControlValueAccessor {
21 |
22 | @Input()
23 | settings: Settings;
24 |
25 | @Output()
26 | onDateSelect: EventEmitter
= new EventEmitter();
27 |
28 | selectedDate: String;
29 | date: Date;
30 | dateRange: DateRange = new DateRange();
31 | popover: Boolean = false;
32 |
33 | cal_days_in_month: Array = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
34 | timeViewDate: Date = new Date(this.date);
35 | hourValue: number = 0;
36 | toHourValue: number = 0;
37 | minValue: number = 0;
38 | toMinValue: number = 0;
39 | timeViewMeridian: string = "";
40 | toTimeViewMeridian: string = "";
41 | timeView: boolean = false;
42 | yearView: Boolean = false;
43 | yearsList: Array = [];
44 | monthDays: Array = [];
45 | toMonthDays: Array = [];
46 | monthsView: boolean = false;
47 | today: Date = new Date();
48 | leftDate: Date = new Date();
49 | rightDate: Date = new Date();
50 |
51 | defaultSettings: Settings = {
52 | defaultOpen: false,
53 | bigBanner: true,
54 | timePicker: false,
55 | format: 'dd-MMM-yyyy hh:mm a',
56 | cal_days_labels: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
57 | cal_full_days_lables: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
58 | cal_months_labels: ['January', 'February', 'March', 'April',
59 | 'May', 'June', 'July', 'August', 'September',
60 | 'October', 'November', 'December'],
61 | cal_months_labels_short: ['JAN', 'FEB', 'MAR', 'APR',
62 | 'MAY', 'JUN', 'JUL', 'AUG', 'SEP',
63 | 'OCT', 'NOV', 'DEC'],
64 | closeOnSelect: true,
65 | rangepicker: false
66 | }
67 | constructor() {
68 |
69 | }
70 | ngOnInit() {
71 | this.settings = Object.assign(this.defaultSettings, this.settings);
72 | if (this.settings.defaultOpen) {
73 | this.popover = true;
74 | }
75 | }
76 | private onTouchedCallback: () => {};
77 | private onChangeCallback: (_: any) => {};
78 | writeValue(value: any) {
79 | if (value !== undefined && value !== null) {
80 | if (!this.settings.rangepicker) {
81 | this.initDate(value);
82 | this.monthDays = this.generateDays(this.date);
83 | }
84 | else {
85 | this.initDateRange(value);
86 | if (this.dateRange.startDate.getMonth() === this.dateRange.endDate.getMonth() && this.dateRange.startDate.getFullYear() === this.dateRange.endDate.getFullYear()) {
87 | this.leftDate = new Date(this.dateRange.startDate);
88 | var tempDate = new Date(this.dateRange.startDate);
89 | tempDate.setMonth(tempDate.getMonth() + 1);
90 | tempDate.setDate(1);
91 | this.rightDate = new Date(tempDate);
92 | this.monthDays = this.generateDays(this.leftDate);
93 | this.toMonthDays = this.generateDays(this.rightDate);
94 | }
95 | else {
96 | this.leftDate = new Date(this.dateRange.startDate);
97 | this.rightDate = new Date(this.dateRange.endDate);
98 | this.monthDays = this.generateDays(this.leftDate);
99 | this.toMonthDays = this.generateDays(this.rightDate);
100 | }
101 |
102 | console.log(this.monthDays);
103 | }
104 |
105 | }
106 | else {
107 | this.date = new Date();
108 | }
109 | }
110 | registerOnChange(fn: any) {
111 | this.onChangeCallback = fn;
112 | }
113 | registerOnTouched(fn: any) {
114 | this.onTouchedCallback = fn;
115 | }
116 | initDate(val: string) {
117 | this.date = new Date(val);
118 | if (this.date.getHours() <= 11) {
119 | this.hourValue = this.date.getHours();
120 | this.timeViewMeridian = "AM";
121 | }
122 | else {
123 | this.hourValue = this.date.getHours() - 12;
124 | this.timeViewMeridian = "PM";
125 | }
126 | if (this.date.getHours() == 0 || this.date.getHours() == 12) {
127 | this.hourValue = 12;
128 | }
129 | this.minValue = this.date.getMinutes();
130 | }
131 | initDateRange(val: DateRange) {
132 | this.dateRange.startDate = new Date(val.startDate);
133 | this.dateRange.endDate = new Date(val.endDate);
134 | if (this.dateRange.startDate.getHours() <= 11) {
135 | this.hourValue = this.dateRange.startDate.getHours();
136 | this.timeViewMeridian = "AM";
137 | }
138 | else {
139 | this.hourValue = this.dateRange.startDate.getHours() - 12;
140 | this.timeViewMeridian = "PM";
141 | }
142 | if (this.dateRange.startDate.getHours() == 0 || this.dateRange.startDate.getHours() == 12) {
143 | this.hourValue = 12;
144 | }
145 | this.minValue = this.dateRange.startDate.getMinutes();
146 |
147 | if (this.dateRange.endDate.getHours() <= 11) {
148 | this.toHourValue = this.dateRange.endDate.getHours();
149 | this.toTimeViewMeridian = "AM";
150 | }
151 | else {
152 | this.toHourValue = this.dateRange.endDate.getHours() - 12;
153 | this.toTimeViewMeridian = "PM";
154 | }
155 | if (this.dateRange.endDate.getHours() == 0 || this.dateRange.endDate.getHours() == 12) {
156 | this.toHourValue = 12;
157 | }
158 | this.toMinValue = this.dateRange.endDate.getMinutes();
159 |
160 | }
161 | generateDays(date: Date) {
162 | var year = date.getFullYear(),
163 | month = date.getMonth(),
164 | current_day = date.getDate(),
165 | today = new Date();
166 | var firstDay = new Date(year, month, 1);
167 | var startingDay = firstDay.getDay();
168 | var monthLength = this.getMonthLength(month, year);
169 | var day = 1;
170 | var dateArr = [];
171 | var dateRow = [];
172 | // this loop is for is weeks (rows)
173 | for (var i = 0; i < 9; i++) {
174 | // this loop is for weekdays (cells)
175 | dateRow = [];
176 | for (var j = 0; j <= 6; j++) {
177 | var dateCell = null;
178 | if (day <= monthLength && (i > 0 || j >= startingDay)) {
179 | dateCell = day;
180 | if (day == current_day) {
181 | // dateCell.classList.add('selected-day');
182 | }
183 | if (day == today.getDate() && date.getMonth() == today.getMonth() && date.getFullYear() == today.getFullYear()) {
184 | // dateCell.classList.add('today');
185 | }
186 | day++;
187 | }
188 | dateRow.push({ day: dateCell, date: new Date((month + 1) + '-' + dateCell + '-' + date.getFullYear()) });
189 | }
190 | // stop making rows if we've run out of days
191 | if (day > monthLength) {
192 | dateArr.push(dateRow);
193 | break;
194 | } else {
195 | dateArr.push(dateRow);
196 | }
197 | }
198 | return dateArr;
199 | }
200 | generateYearList(param: string) {
201 | var startYear = null;
202 | var currentYear = null;
203 | if (param == "next") {
204 | startYear = this.yearsList[8] + 1;
205 | currentYear = this.date.getFullYear();
206 | }
207 | else if (param == "prev") {
208 | startYear = this.yearsList[0] - 9;
209 | currentYear = this.date.getFullYear();
210 | }
211 | else {
212 | currentYear = this.date.getFullYear();
213 | startYear = currentYear - 4;
214 | this.yearView = !this.yearView;
215 | this.monthsView = false;
216 | }
217 | for (var k = 0; k < 9; k++) {
218 | this.yearsList[k] = startYear + k;
219 | }
220 | }
221 | getMonthLength(month: number, year: number) {
222 | var monthLength = this.cal_days_in_month[month];
223 |
224 | // compensate for leap year
225 | if (month == 1) { // February only!
226 | if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
227 | monthLength = 29;
228 | }
229 | }
230 | return monthLength;
231 | }
232 | toggleMonthView() {
233 | this.yearView = false;
234 | this.monthsView = !this.monthsView;
235 | }
236 | toggleMeridian(val: string) {
237 | this.timeViewMeridian = val;
238 | }
239 | setTimeView() {
240 | if (this.timeViewMeridian == "AM") {
241 | if (this.hourValue == 12) {
242 | this.date.setHours(0);
243 | }
244 | else {
245 | this.date.setHours(this.hourValue);
246 | }
247 | this.date.setMinutes(this.minValue);
248 | }
249 | else {
250 | if (this.hourValue == 12) {
251 | this.date.setHours(this.hourValue);
252 | }
253 | else {
254 | this.date.setHours(this.hourValue + 12);
255 | }
256 | this.date.setMinutes(this.minValue);
257 | }
258 | this.date = new Date(this.date);
259 | this.timeView = !this.timeView;
260 | }
261 |
262 | /***
263 | * (ssd > endDay -> startDay = endDay -> step = 1 ) && (sed > startDay -> 2)
264 | * (ssd < endDay -> startDay = ssd - step =1) && (sed < startDay -> 2 )
265 | *
266 | */
267 |
268 | rangeSelected: number = 0;
269 | setDay(evt: any, type: string) {
270 | if (evt.target.innerHTML) {
271 | var selectedDay = new Date(evt.target.getAttribute('data-label'));
272 | if (type == 'range') {
273 | if (this.rangeSelected == 0) {
274 | this.setStartDate(selectedDay);
275 | }
276 | else if (this.rangeSelected == 1) {
277 | this.setEndDate(selectedDay);
278 | }
279 | }
280 | else {
281 | this.date = new Date(selectedDay);
282 | this.onChangeCallback(this.date.toString());
283 |
284 | }
285 | if (this.settings.closeOnSelect) {
286 | this.popover = false;
287 | this.onDateSelect.emit(this.date);
288 | }
289 | }
290 | }
291 | setStartDate(selectedDate: Date) {
292 | if (selectedDate < this.dateRange.endDate) {
293 | this.dateRange.startDate = new Date(selectedDate);
294 | }
295 | else if (selectedDate > this.dateRange.endDate) {
296 | this.dateRange.startDate = new Date(selectedDate);
297 | this.dateRange.endDate = new Date(selectedDate);
298 | }
299 | this.rangeSelected = 1;
300 | }
301 | setEndDate(selectedDate: Date) {
302 | if (selectedDate > this.dateRange.startDate && (this.dateRange.startDate != this.dateRange.endDate)) {
303 | this.dateRange.endDate = new Date(selectedDate);
304 | }
305 | else if (selectedDate > this.dateRange.startDate && (this.dateRange.startDate == this.dateRange.endDate)) {
306 | this.dateRange.endDate = new Date(selectedDate);
307 | }
308 | else if (selectedDate < this.dateRange.startDate && (this.dateRange.startDate != this.dateRange.endDate)) {
309 | this.dateRange.startDate = new Date(selectedDate);
310 | this.dateRange.endDate = new Date(selectedDate);
311 | }
312 | else if (selectedDate < this.dateRange.startDate && (this.dateRange.startDate == this.dateRange.endDate)) {
313 | this.dateRange.startDate = new Date(selectedDate);
314 | this.dateRange.endDate = new Date(selectedDate);
315 | }
316 | else if (selectedDate.getTime() == this.dateRange.startDate.getTime()) {
317 | this.dateRange.startDate = new Date(selectedDate);
318 | this.dateRange.endDate = new Date(selectedDate);
319 | }
320 | this.rangeSelected = 0;
321 | }
322 | highlightRange(date: Date) {
323 | return (date > this.dateRange.startDate && date < this.dateRange.endDate);
324 | }
325 | setYear(evt: any) {
326 | console.log(evt.target);
327 | var selectedYear = parseInt(evt.target.getAttribute('id'));
328 | this.date = new Date(this.date.setFullYear(selectedYear));
329 | this.yearView = !this.yearView;
330 | this.monthDays = this.generateDays(this.date);
331 | }
332 | setMonth(evt: any) {
333 | if (evt.target.getAttribute('id')) {
334 | var selectedMonth = this.settings.cal_months_labels_short.indexOf(evt.target.getAttribute('id'));
335 | this.date = new Date(this.date.setMonth(selectedMonth));
336 | this.monthsView = !this.monthsView;
337 | this.monthDays = this.generateDays(this.date);
338 | }
339 | }
340 | prevMonth(e: any) {
341 | e.stopPropagation();
342 | var self = this;
343 | if (this.date.getMonth() == 0) {
344 | this.date.setMonth(11);
345 | this.date.setFullYear(this.date.getFullYear() - 1);
346 | } else {
347 | var prevmonthLength = this.getMonthLength(this.date.getMonth() - 1, this.date.getFullYear());
348 | var currentDate = this.date.getDate();
349 | if (currentDate > prevmonthLength) {
350 | this.date.setDate(prevmonthLength);
351 | }
352 | this.date.setMonth(this.date.getMonth() - 1);
353 | }
354 | this.date = new Date(this.date);
355 | this.monthDays = this.generateDays(this.date);
356 | }
357 | nextMonth(e: any) {
358 | e.stopPropagation();
359 | var self = this;
360 | if (this.date.getMonth() == 11) {
361 | this.date.setMonth(0);
362 | this.date.setFullYear(this.date.getFullYear() + 1);
363 | } else {
364 | var nextmonthLength = this.getMonthLength(this.date.getMonth() + 1, this.date.getFullYear());
365 | var currentDate = this.date.getDate();
366 | if (currentDate > nextmonthLength) {
367 | this.date.setDate(nextmonthLength);
368 | }
369 | this.date.setMonth(this.date.getMonth() + 1);
370 |
371 | }
372 | this.date = new Date(this.date);
373 | this.monthDays = this.generateDays(this.date);
374 | }
375 | onChange(evt: any) {
376 | console.log(evt);
377 | }
378 | incHour() {
379 | if (this.hourValue < 12) {
380 | this.hourValue += 1;
381 | console.log(this.hourValue);
382 | }
383 | }
384 | decHour() {
385 | if (this.hourValue > 1) {
386 | this.hourValue -= 1;
387 | console.log(this.hourValue);
388 | }
389 | }
390 | incMinutes() {
391 | if (this.minValue < 59) {
392 | this.minValue += 1;
393 | console.log(this.minValue);
394 | }
395 | }
396 | decMinutes() {
397 | if (this.minValue > 0) {
398 | this.minValue -= 1;
399 | console.log(this.minValue);
400 | }
401 | }
402 | done() {
403 | this.onChangeCallback(this.date.toString());
404 | this.popover = false;
405 | this.onDateSelect.emit(this.date);
406 | }
407 | togglePopover() {
408 | if (this.popover) {
409 | this.closepopover();
410 | }
411 | else {
412 | this.popover = true;
413 | }
414 | }
415 | closepopover() {
416 | this.rangeSelected = 0;
417 | this.popover = false;
418 | }
419 | composeDate(date: Date) {
420 | return (date.getMonth() + 1) + '-' + date.getDate() + '-' + date.getFullYear();
421 | }
422 | getCurrentWeek() {
423 | var curr_date = new Date();
424 |
425 | var day = curr_date.getDay();
426 |
427 | var diff = curr_date.getDate() - day + (day == 0 ? -6 : 1); // 0 for sunday
428 |
429 | var week_start_tstmp = curr_date.setDate(diff);
430 |
431 | var week_start = new Date(week_start_tstmp);
432 |
433 |
434 | var week_end = new Date(week_start_tstmp); // first day of week
435 |
436 | week_end = new Date(week_end.setDate(week_end.getDate() + 6));
437 |
438 |
439 | var date = week_start + ' to ' + week_end; // date range for current week
440 | console.log(date);
441 | if (week_start.getMonth() === week_end.getMonth()) {
442 | this.monthDays = this.generateDays(week_start);
443 | var tempDate = new Date(week_end);
444 | tempDate.setMonth(tempDate.getMonth() + 1);
445 | tempDate.setDate(1);
446 | this.toMonthDays = this.generateDays(tempDate);
447 | }
448 | else {
449 | this.monthDays = this.generateDays(week_start);
450 | this.toMonthDays = this.generateDays(week_end);
451 | }
452 |
453 | this.setStartDate(week_start);
454 | this.setEndDate(week_end);
455 | }
456 | }
--------------------------------------------------------------------------------
/src/app/angular2-datetimepicker/datepicker.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { DatePicker } from './datepicker.component';
4 | import { FormsModule } from '@angular/forms';
5 | import { ClickOutsideDirective } from './clickOutside';
6 | @NgModule({
7 | imports: [CommonModule,FormsModule],
8 | declarations: [DatePicker, ClickOutsideDirective],
9 | exports: [DatePicker,FormsModule, ClickOutsideDirective]
10 | })
11 | export class AngularDateTimePickerModule{
12 |
13 | }
--------------------------------------------------------------------------------
/src/app/angular2-datetimepicker/index.ts:
--------------------------------------------------------------------------------
1 | export { DatePicker } from './datepicker.component';
2 | export { AngularDateTimePickerModule } from './datepicker.module';
--------------------------------------------------------------------------------
/src/app/angular2-datetimepicker/interface.ts:
--------------------------------------------------------------------------------
1 | export interface Settings{
2 | bigBanner?: Boolean;
3 | timePicker: Boolean;
4 | format: string;
5 | defaultOpen?: Boolean;
6 | cal_days_labels: Array;
7 | cal_full_days_lables: Array;
8 | cal_months_labels: Array;
9 | cal_months_labels_short: Array;
10 | closeOnSelect?: boolean;
11 | rangepicker?: boolean;
12 | }
--------------------------------------------------------------------------------
/src/app/angular2-datetimepicker/model.ts:
--------------------------------------------------------------------------------
1 | export class DateRange {
2 | startDate: Date;
3 | endDate: Date;
4 | constructor(){}
5 | }
--------------------------------------------------------------------------------
/src/app/angular2-datetimepicker/rangepicker.scss:
--------------------------------------------------------------------------------
1 | .range-banner{
2 | background: #ffffff;
3 | width: 100%;
4 | float: left;
5 | display: flex;
6 | flex-direction: row;
7 | flex-wrap: nowrap;
8 | padding: 25px 15px 10px 15px;
9 | }
10 | .range-input {
11 | display: flex;
12 | flex-direction: row;
13 | min-width: 275px;
14 | }
15 | .wc-date-container {
16 | position: relative;
17 | }
18 | .range-direc {
19 | position: absolute;
20 | right: -8px;
21 | background: #fff;
22 | z-index: 1;
23 | color: #ccc !important;
24 | font-size: 16px !important;
25 | top: 6px;
26 | }
27 | .to-input {
28 | padding-left: 15px;
29 | }
30 | .arrow-right {
31 | padding: 0px 20px;
32 | }
33 | .arrow-right .fa {
34 | font-size: 2em;
35 | color: #1565c0;
36 | }
37 | .wc-banner-col {
38 | /*flex-grow: 1;*/
39 | display: flex;
40 | color: #1565c0;
41 | flex-direction: row;
42 | align-items: center;
43 | flex-wrap: wrap;
44 | position: relative;
45 | }
46 | .wc-banner-col label{
47 | width: 100%;
48 | text-align: left;
49 | margin: 0px;
50 | position: absolute;
51 | top: -10px;
52 | color: #888888;
53 | }
54 | .wc-day {
55 | font-size: 3em;
56 | font-weight: 300;
57 | padding-right: 5px;
58 | }
59 | .wc-my {
60 | display: flex;
61 | align-items: baseline;
62 | flex-direction: column;
63 | }
64 | .wc-month {
65 | font-size: 1.2em;
66 | margin-top: -5px;
67 | color: #888888;
68 | }
69 | .wc-year {
70 | font-size: 0.9em;
71 | font-weight: 300;
72 | margin-top: -1px;
73 | color: #6e6e6e;
74 | }
75 | .dp-left-section, .dp-right-section{
76 | border-top: 1px solid #fff;
77 | }
78 | .dp-left-section {
79 | border-right: 1px solid #ccc;
80 | }
81 | .range-date-popover {
82 | border: 1px solid #1565c0;
83 | background: #fff;
84 | }
85 | @media (min-width: 768px){
86 | .range-banner .wc-banner {
87 | width: 30%;
88 | }
89 | .range-date-popover {
90 | width: 500px;
91 | position: absolute;
92 | top: 31px;
93 | height: auto;
94 | left: 0;
95 | -webkit-transform: translateX(0);
96 | transform: translateX(0);
97 | }
98 | .dp-left-section, .dp-right-section{
99 | float: left;
100 | width: 50%;
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/src/app/app.component.css:
--------------------------------------------------------------------------------
1 | .left-sidebar, .right-sidebar {
2 | width: 330px;
3 | max-width: 330px;
4 | min-width: 330px;
5 | }
6 | .outer-wrapper {
7 | padding: 30px;
8 | }
9 | .center-content{
10 | background: #ffffff;
11 | border: 1px solid rgba(0,0,0,.125);
12 | border-radius: 3px;
13 | padding: 15px;
14 | }
15 |
--------------------------------------------------------------------------------
/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
18 |
--------------------------------------------------------------------------------
/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, async } from '@angular/core/testing';
2 |
3 | import { AppComponent } from './app.component';
4 |
5 | describe('AppComponent', () => {
6 | beforeEach(async(() => {
7 | TestBed.configureTestingModule({
8 | declarations: [
9 | AppComponent
10 | ],
11 | }).compileComponents();
12 | }));
13 |
14 | it('should create the app', async(() => {
15 | const fixture = TestBed.createComponent(AppComponent);
16 | const app = fixture.debugElement.componentInstance;
17 | expect(app).toBeTruthy();
18 | }));
19 |
20 | it(`should have as title 'app works!'`, async(() => {
21 | const fixture = TestBed.createComponent(AppComponent);
22 | const app = fixture.debugElement.componentInstance;
23 | expect(app.title).toEqual('app works!');
24 | }));
25 |
26 | it('should render title in a h1 tag', async(() => {
27 | const fixture = TestBed.createComponent(AppComponent);
28 | fixture.detectChanges();
29 | const compiled = fixture.debugElement.nativeElement;
30 | expect(compiled.querySelector('h1').textContent).toContain('app works!');
31 | }));
32 | });
33 |
--------------------------------------------------------------------------------
/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, AfterViewInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-root',
5 | templateUrl: './app.component.html',
6 | styleUrls: ['./app.component.css', './appstyles.scss']
7 | })
8 | export class AppComponent implements OnInit, AfterViewInit {
9 | date: Date = new Date();
10 | settings = {
11 | bigBanner: true,
12 | timePicker: true,
13 | format: 'dd-MM-yyyy',
14 | defaultOpen: true
15 | }
16 | constructor() {
17 |
18 | }
19 | ngAfterViewInit() {
20 |
21 | }
22 | ngOnInit() {
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { BrowserModule } from '@angular/platform-browser';
2 | import { NgModule } from '@angular/core';
3 | import { FormsModule } from '@angular/forms';
4 |
5 | import { AppComponent } from './app.component';
6 | import { AngularDateTimePickerModule } from './angular2-datetimepicker/datepicker.module';
7 | import { AdsenseComponent } from './adsense.component';
8 | import { DatePickerExample } from './examples/datepicker';
9 | import { DateTimePickerExample } from './examples/datetimepicker';
10 | import { SimpleDatePickerExample } from './examples/simpledatepicker';
11 | import { UsingWithFormExample } from './examples/usingWithForms';
12 | import { DateRangePickerExample } from './examples/rangepicker';
13 | import { AppRouterModule } from './app.router';
14 |
15 |
16 | @NgModule({
17 | declarations: [
18 | AppComponent,
19 | AdsenseComponent,
20 | DatePickerExample,
21 | DateTimePickerExample,
22 | SimpleDatePickerExample,
23 | UsingWithFormExample,
24 | DateRangePickerExample
25 | ],
26 | imports: [
27 | AngularDateTimePickerModule,
28 | BrowserModule,
29 | FormsModule,
30 | AppRouterModule],
31 | providers: [],
32 | bootstrap: [AppComponent]
33 | })
34 | export class AppModule { }
--------------------------------------------------------------------------------
/src/app/app.router.ts:
--------------------------------------------------------------------------------
1 | import { RouterModule, Routes } from '@angular/router';
2 | import { NgModule } from '@angular/core';
3 |
4 | import { AppComponent } from './app.component';
5 | import { DatePickerExample } from './examples/datepicker';
6 | import { DateTimePickerExample } from './examples/datetimepicker';
7 | import { SimpleDatePickerExample } from './examples/simpledatepicker';
8 | import { UsingWithFormExample } from './examples/usingWithForms';
9 | import { DateRangePickerExample } from './examples/rangepicker';
10 |
11 | const appRoutes: Routes = [
12 | { path: '', redirectTo: '/datepicker',pathMatch: 'full'},
13 | { path: 'datepicker', component: DatePickerExample},
14 | { path: 'datetimepicker', component: DateTimePickerExample},
15 | { path: 'simpledatepicker', component: SimpleDatePickerExample},
16 | { path: 'usinginform', component: UsingWithFormExample},
17 | { path: 'rangepicker', component: DateRangePickerExample}
18 |
19 | ];
20 |
21 |
22 | @NgModule({
23 | imports: [
24 | RouterModule.forRoot(appRoutes, { useHash: true })
25 | ],
26 | exports: [
27 | RouterModule
28 | ]
29 |
30 | })
31 | export class AppRouterModule { }
--------------------------------------------------------------------------------
/src/app/appstyles.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CuppaLabs/angular2-datetimepicker/bbc439a84457d3b685391973c5717c317557ef6c/src/app/appstyles.scss
--------------------------------------------------------------------------------
/src/app/examples/datepicker.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, AfterViewInit } from '@angular/core';
2 |
3 | @Component({
4 | templateUrl: './views/basic.html'
5 | })
6 | export class DatePickerExample implements OnInit {
7 | date: any = '04-18-1990';
8 | settings = {
9 | bigBanner: true,
10 | timePicker: false,
11 | format: 'dd-MM-yyyy',
12 | defaultOpen: true,
13 | closeOnSelect: false,
14 | rangepicker: false
15 | }
16 | constructor() {
17 |
18 | }
19 | onDateSelect(date: any){
20 | console.log(date);
21 | }
22 | ngOnInit() {
23 |
24 | }
25 | title: string = "Basic Example";
26 | }
27 |
--------------------------------------------------------------------------------
/src/app/examples/datetimepicker.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, AfterViewInit } from '@angular/core';
2 |
3 | @Component({
4 | template: `
5 |
6 | `
7 | })
8 | export class DateTimePickerExample implements OnInit {
9 | date: Date = new Date();
10 | settings = {
11 | bigBanner: true,
12 | timePicker: true,
13 | format: 'dd-MM-yyyy hh:mm',
14 | defaultOpen: true
15 | }
16 | constructor(){
17 |
18 | }
19 | ngOnInit(){
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/app/examples/rangepicker.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, AfterViewInit } from '@angular/core';
2 |
3 | @Component({
4 | templateUrl: './views/rangepicker.html'
5 | })
6 | export class DateRangePickerExample implements OnInit {
7 | date: any = {startDate: new Date('04-18-1990'), endDate: new Date('04-20-2017')};
8 | settings = {
9 | bigBanner: true,
10 | timePicker: false,
11 | format: 'dd-MM-yyyy',
12 | defaultOpen: true,
13 | closeOnSelect: false,
14 | rangepicker: true
15 | }
16 | constructor() {
17 |
18 | }
19 | onDateSelect(date: any){
20 | console.log(date);
21 | }
22 | ngOnInit() {
23 |
24 | }
25 | title: string = "Range picker Example";
26 | }
27 |
--------------------------------------------------------------------------------
/src/app/examples/simpledatepicker.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, AfterViewInit } from '@angular/core';
2 |
3 | @Component({
4 | template: `
5 |
6 | `
7 | })
8 | export class SimpleDatePickerExample implements OnInit {
9 | date: Date = new Date();
10 | settings = {
11 | bigBanner: false,
12 | timePicker: false,
13 | format: 'dd-MM-yyyy',
14 | defaultOpen: true
15 | }
16 | constructor(){
17 |
18 | }
19 | ngOnInit(){
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/app/examples/usingWithForms.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, AfterViewInit } from '@angular/core';
2 |
3 | @Component({
4 | templateUrl: './views/usingwithforms.html'
5 | })
6 | export class UsingWithFormExample implements OnInit {
7 | title: string = "Using with angular forms";
8 | formModel = {
9 | name: '',
10 | dob: new Date(),
11 | };
12 | dobSettings = {
13 | bigBanner: false,
14 | timePicker: true,
15 | format: 'dd-MM-yyyy hh:mm',
16 | defaultOpen: true,
17 | closeOnSelect: true,
18 | rangepicker: false
19 |
20 | }
21 | constructor() {
22 |
23 | }
24 | onDateSelect(date: any) {
25 | console.log(date);
26 | }
27 | ngOnInit() {
28 |
29 | }
30 | submitted = false;
31 | onSubmit() { this.submitted = true; }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/app/examples/views/basic.html:
--------------------------------------------------------------------------------
1 | {{title}}
2 |
6 |
--------------------------------------------------------------------------------
/src/app/examples/views/rangepicker.html:
--------------------------------------------------------------------------------
1 | {{title}}
2 |
3 | Date Rangepicker is still under development. Please stay tuned for updates !! Thank you for visiting.
4 |
5 |
10 |
--------------------------------------------------------------------------------
/src/app/examples/views/timepicker.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CuppaLabs/angular2-datetimepicker/bbc439a84457d3b685391973c5717c317557ef6c/src/app/examples/views/timepicker.html
--------------------------------------------------------------------------------
/src/app/examples/views/usingwithforms.html:
--------------------------------------------------------------------------------
1 | {{title}}
2 |
31 |
--------------------------------------------------------------------------------
/src/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CuppaLabs/angular2-datetimepicker/bbc439a84457d3b685391973c5717c317557ef6c/src/assets/.gitkeep
--------------------------------------------------------------------------------
/src/assets/images/coffee11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CuppaLabs/angular2-datetimepicker/bbc439a84457d3b685391973c5717c317557ef6c/src/assets/images/coffee11.png
--------------------------------------------------------------------------------
/src/assets/images/coffee14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CuppaLabs/angular2-datetimepicker/bbc439a84457d3b685391973c5717c317557ef6c/src/assets/images/coffee14.png
--------------------------------------------------------------------------------
/src/assets/images/cuppa-logo-coffee11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CuppaLabs/angular2-datetimepicker/bbc439a84457d3b685391973c5717c317557ef6c/src/assets/images/cuppa-logo-coffee11.png
--------------------------------------------------------------------------------
/src/assets/images/sand-background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CuppaLabs/angular2-datetimepicker/bbc439a84457d3b685391973c5717c317557ef6c/src/assets/images/sand-background.jpg
--------------------------------------------------------------------------------
/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // The file contents for the current environment will overwrite these during build.
2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do
3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead.
4 | // The list of which env maps to which file can be found in `.angular-cli.json`.
5 |
6 | export const environment = {
7 | production: false
8 | };
9 |
--------------------------------------------------------------------------------
/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CuppaLabs/angular2-datetimepicker/bbc439a84457d3b685391973c5717c317557ef6c/src/favicon.ico
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Angular 2 DateTime picker | Cuppa Labs
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
27 |
28 |
29 |
64 |
65 |
66 |
Loading...
67 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import { enableProdMode } from '@angular/core';
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3 |
4 | import { AppModule } from './app/app.module';
5 | import { environment } from './environments/environment';
6 |
7 | if (environment.production) {
8 | enableProdMode();
9 | }
10 |
11 | platformBrowserDynamic().bootstrapModule(AppModule);
12 |
--------------------------------------------------------------------------------
/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file includes polyfills needed by Angular and is loaded before the app.
3 | * You can add your own extra polyfills to this file.
4 | *
5 | * This file is divided into 2 sections:
6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8 | * file.
9 | *
10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/
22 | // import 'core-js/es6/symbol';
23 | // import 'core-js/es6/object';
24 | // import 'core-js/es6/function';
25 | // import 'core-js/es6/parse-int';
26 | // import 'core-js/es6/parse-float';
27 | // import 'core-js/es6/number';
28 | // import 'core-js/es6/math';
29 | // import 'core-js/es6/string';
30 | // import 'core-js/es6/date';
31 | // import 'core-js/es6/array';
32 | // import 'core-js/es6/regexp';
33 | // import 'core-js/es6/map';
34 | // import 'core-js/es6/set';
35 |
36 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
37 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
38 |
39 | /** IE10 and IE11 requires the following to support `@angular/animation`. */
40 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
41 |
42 |
43 | /** Evergreen browsers require these. **/
44 | import 'core-js/es6/reflect';
45 | import 'core-js/es7/reflect';
46 |
47 |
48 | /** ALL Firefox browsers require the following to support `@angular/animation`. **/
49 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
50 |
51 |
52 |
53 | /***************************************************************************************************
54 | * Zone JS is required by Angular itself.
55 | */
56 | import 'zone.js/dist/zone'; // Included with Angular CLI.
57 |
58 |
59 |
60 | /***************************************************************************************************
61 | * APPLICATION IMPORTS
62 | */
63 |
64 | /**
65 | * Date, currency, decimal and percent pipes.
66 | * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
67 | */
68 | // import 'intl'; // Run `npm install --save intl`.
69 | /**
70 | * Need to import at least one locale-data with intl.
71 | */
72 | // import 'intl/locale-data/jsonp/en';
73 |
--------------------------------------------------------------------------------
/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 | body{
3 | background-color: rgb(246, 246, 246) !important;
4 | }
5 | .navbar-default{
6 | border-radius: 0px !important;
7 | background-color: #fff !important;
8 | margin: 0px !important;
9 | }
10 | .example-title{
11 | border-bottom: 2px solid #ccc;
12 | margin-bottom: 75px;
13 | }
14 | .row{
15 | margin: 0px !important;
16 | margin-bottom: 20px !important;
17 | }
18 | .navbar-brand>img {
19 | height: 32px;
20 | margin-top: -6px;
21 | }
22 | .component-title{
23 | font-size: 18px;
24 | color: #333 !important;
25 | }
26 | .jumbotron{
27 | text-align: center;
28 | color: #fff !important;
29 | }
30 | .jumbotron h1{
31 | text-shadow: 1px 1px 0px #7d7d7d;
32 | }
33 | h4{
34 | color: #686868;
35 | }
36 | @media screen and (min-width: 768px){
37 | .jumbotron{
38 | padding-top: 15px !important;
39 | padding-bottom: 15px !important;
40 | margin: 0px;
41 | background: none !important;
42 | }
43 | .jumbotron .h1, .jumbotron h1{
44 | font-size: 42px !important;
45 | color: #fff !important;
46 | }
47 | }
48 | .code-section {
49 | margin-top: 100px;
50 | margin-bottom: 10px;
51 | }
52 | .ui-tabview-nav {
53 | background: #007bff !important;
54 | }
55 | .ui-tabview .ui-tabview-nav > li.ui-state-default {
56 | background: #007bff !important;
57 | }
58 | .ui-state-default a {
59 | color: #fff !important;
60 | }
61 | .ui-tabview .ui-tabview-nav > li.ui-state-active {
62 | background: #fff !important;
63 | }
64 | .ui-tabview .ui-tabview-nav > li.ui-state-active > a{
65 | color: #333 !important;
66 | }
67 | .ui-tabview-panel {
68 | padding: 0px !important;
69 | margin: 0px -7px;
70 | }
71 | .custom-class-example {
72 | color: #ccc;
73 | }
74 | .custom-class-example .c-token{
75 | background: #38d574 !important;
76 | }
77 | .custom-class-example .pure-checkbox label::before {
78 | border-color: #38d574 !important;
79 | }
80 | .custom-class-example .pure-checkbox input[type="checkbox"]:checked + label[_ngcontent-c1]:before {
81 | background: #38d574 !important;
82 | }
83 | .outer-wrapper {
84 | margin-top: 15px;
85 | }
86 | .dropdown-container {
87 | height: 170px;
88 | }
--------------------------------------------------------------------------------
/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/dist/long-stack-trace-zone';
4 | import 'zone.js/dist/proxy.js';
5 | import 'zone.js/dist/sync-test';
6 | import 'zone.js/dist/jasmine-patch';
7 | import 'zone.js/dist/async-test';
8 | import 'zone.js/dist/fake-async-test';
9 | import { getTestBed } from '@angular/core/testing';
10 | import {
11 | BrowserDynamicTestingModule,
12 | platformBrowserDynamicTesting
13 | } from '@angular/platform-browser-dynamic/testing';
14 |
15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
16 | declare var __karma__: any;
17 | declare var require: any;
18 |
19 | // Prevent Karma from running prematurely.
20 | __karma__.loaded = function () {};
21 |
22 | // First, initialize the Angular testing environment.
23 | getTestBed().initTestEnvironment(
24 | BrowserDynamicTestingModule,
25 | platformBrowserDynamicTesting()
26 | );
27 | // Then we find all the tests.
28 | const context = require.context('./', true, /\.spec\.ts$/);
29 | // And load the modules.
30 | context.keys().map(context);
31 | // Finally, start Karma to run the tests.
32 | __karma__.start();
33 |
--------------------------------------------------------------------------------
/src/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "module": "es2015",
6 | "baseUrl": "",
7 | "types": []
8 | },
9 | "exclude": [
10 | "test.ts",
11 | "**/*.spec.ts"
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/src/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/spec",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "baseUrl": "",
8 | "types": [
9 | "jasmine",
10 | "node"
11 | ]
12 | },
13 | "files": [
14 | "test.ts"
15 | ],
16 | "include": [
17 | "**/*.spec.ts",
18 | "**/*.d.ts"
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/src/typings.d.ts:
--------------------------------------------------------------------------------
1 | /* SystemJS module definition */
2 | declare var module: NodeModule;
3 | interface NodeModule {
4 | id: string;
5 | }
6 |
--------------------------------------------------------------------------------
/tsconfig-aot.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["es2015", "es2017", "dom"],
5 | "module": "es2015",
6 | "moduleResolution": "node",
7 | "sourceMap": true,
8 | "declaration": true,
9 | "removeComments": false,
10 | "noImplicitAny": true,
11 | "experimentalDecorators": true,
12 | "emitDecoratorMetadata": true,
13 | "allowUnreachableCode": false,
14 | "allowUnusedLabels": false,
15 | "pretty": true,
16 | "stripInternal": true,
17 | "skipLibCheck": true,
18 | "outDir": "dist",
19 | "rootDir": "./tmp/src-inlined"
20 | },
21 | "files": [
22 | "./tmp/src-inlined/index.ts"
23 | ],
24 | "angularCompilerOptions": {
25 | "genDir": "dist",
26 | "debug": false,
27 | "skipTemplateCodegen": true,
28 | "skipMetadataEmit": false,
29 | "strictMetadataEmit": true
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "outDir": "./dist/out-tsc",
5 | "baseUrl": "src",
6 | "sourceMap": true,
7 | "declaration": false,
8 | "moduleResolution": "node",
9 | "emitDecoratorMetadata": true,
10 | "experimentalDecorators": true,
11 | "target": "es5",
12 | "typeRoots": [
13 | "node_modules/@types"
14 | ],
15 | "lib": [
16 | "es2016",
17 | "dom"
18 | ]
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rulesDirectory": [
3 | "node_modules/codelyzer"
4 | ],
5 | "rules": {
6 | "callable-types": true,
7 | "class-name": true,
8 | "comment-format": [
9 | true,
10 | "check-space"
11 | ],
12 | "curly": true,
13 | "eofline": true,
14 | "forin": true,
15 | "import-blacklist": [
16 | true,
17 | "rxjs"
18 | ],
19 | "import-spacing": true,
20 | "indent": [
21 | true,
22 | "spaces"
23 | ],
24 | "interface-over-type-literal": true,
25 | "label-position": true,
26 | "max-line-length": [
27 | true,
28 | 140
29 | ],
30 | "member-access": false,
31 | "member-ordering": [
32 | true,
33 | "static-before-instance",
34 | "variables-before-functions"
35 | ],
36 | "no-arg": true,
37 | "no-bitwise": true,
38 | "no-console": [
39 | true,
40 | "debug",
41 | "info",
42 | "time",
43 | "timeEnd",
44 | "trace"
45 | ],
46 | "no-construct": true,
47 | "no-debugger": true,
48 | "no-empty": false,
49 | "no-empty-interface": true,
50 | "no-eval": true,
51 | "no-inferrable-types": [
52 | true,
53 | "ignore-params"
54 | ],
55 | "no-shadowed-variable": true,
56 | "no-string-literal": false,
57 | "no-string-throw": true,
58 | "no-switch-case-fall-through": true,
59 | "no-trailing-whitespace": true,
60 | "no-unused-expression": true,
61 | "no-use-before-declare": true,
62 | "no-var-keyword": true,
63 | "object-literal-sort-keys": false,
64 | "one-line": [
65 | true,
66 | "check-open-brace",
67 | "check-catch",
68 | "check-else",
69 | "check-whitespace"
70 | ],
71 | "prefer-const": true,
72 | "quotemark": [
73 | true,
74 | "single"
75 | ],
76 | "radix": true,
77 | "semicolon": [
78 | "always"
79 | ],
80 | "triple-equals": [
81 | true,
82 | "allow-null-check"
83 | ],
84 | "typedef-whitespace": [
85 | true,
86 | {
87 | "call-signature": "nospace",
88 | "index-signature": "nospace",
89 | "parameter": "nospace",
90 | "property-declaration": "nospace",
91 | "variable-declaration": "nospace"
92 | }
93 | ],
94 | "typeof-compare": true,
95 | "unified-signatures": true,
96 | "variable-name": false,
97 | "whitespace": [
98 | true,
99 | "check-branch",
100 | "check-decl",
101 | "check-operator",
102 | "check-separator",
103 | "check-type"
104 | ],
105 | "directive-selector": [
106 | true,
107 | "attribute",
108 | "app",
109 | "camelCase"
110 | ],
111 | "component-selector": [
112 | true,
113 | "element",
114 | "app",
115 | "kebab-case"
116 | ],
117 | "use-input-property-decorator": true,
118 | "use-output-property-decorator": true,
119 | "use-host-property-decorator": true,
120 | "no-input-rename": true,
121 | "no-output-rename": true,
122 | "use-life-cycle-interface": true,
123 | "use-pipe-transform-interface": true,
124 | "component-class-suffix": true,
125 | "directive-class-suffix": true,
126 | "no-access-missing-member": true,
127 | "templates-use-public": true,
128 | "invoke-injectable": true
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/webpack-test.config.ts:
--------------------------------------------------------------------------------
1 | import * as webpack from 'webpack';
2 | import * as path from 'path';
3 |
4 | export default {
5 | resolve: {
6 | extensions: [ '.ts', '.js', '.json' ]
7 | },
8 | module: {
9 | rules: [
10 | {
11 | test: /\.ts$/,
12 | use: [
13 | {
14 | loader: 'awesome-typescript-loader',
15 | options: {
16 | configFileName: 'tsconfig.json'
17 | }
18 | },
19 | {
20 | loader: 'angular2-template-loader'
21 | }
22 | ],
23 | exclude: [
24 | /\.e2e\.ts$/,
25 | /node_modules/
26 | ]
27 | },
28 |
29 | {
30 | test: /.ts$/,
31 | exclude: /(node_modules|\.spec\.ts|\.e2e\.ts$)/,
32 | loader: 'istanbul-instrumenter-loader',
33 | enforce: 'post'
34 | },
35 |
36 | {
37 | test: /\.json$/,
38 | use: 'json-loader'
39 | },
40 |
41 | {
42 | test: /\.css$/,
43 | use: ['to-string-loader', 'css-loader']
44 | },
45 |
46 | {
47 | test: /\.scss$/,
48 | use: ['to-string-loader', 'css-loader', 'sass-loader']
49 | },
50 |
51 | {
52 | test: /\.html$/,
53 | use: 'raw-loader'
54 | }
55 | ]
56 | },
57 | plugins: [
58 | new webpack.SourceMapDevToolPlugin({
59 | filename: null,
60 | test: /\.(ts|js)($|\?)/i
61 | }),
62 |
63 | new webpack.ContextReplacementPlugin(
64 | /angular(\\|\/)core(\\|\/)@angular/,
65 | path.join(__dirname, 'src')
66 | ),
67 |
68 | new webpack.NoEmitOnErrorsPlugin()
69 | ]
70 | } as webpack.Configuration;
71 |
--------------------------------------------------------------------------------
/webpack-umd.config.ts:
--------------------------------------------------------------------------------
1 | import * as webpack from 'webpack';
2 | import * as path from 'path';
3 | import * as fs from 'fs';
4 | import * as angularExternals from 'webpack-angular-externals';
5 | import * as rxjsExternals from 'webpack-rxjs-externals';
6 |
7 | const pkg = JSON.parse(fs.readFileSync('./package.json').toString());
8 |
9 | export default {
10 | entry: {
11 | 'index.umd': './src/app/angular2-datetimepicker/index.ts',
12 | 'index.umd.min': './src/app/angular2-datetimepicker/index.ts'
13 | },
14 | output: {
15 | path: path.join(__dirname, 'dist'),
16 | filename: '[name].js',
17 | libraryTarget: 'umd',
18 | library: 'ticktock'
19 | },
20 | resolve: {
21 | extensions: [ '.ts', '.js', '.json' ]
22 | },
23 | externals: [
24 | angularExternals(),
25 | rxjsExternals()
26 | ],
27 | devtool: 'source-map',
28 | module: {
29 | rules: [
30 | {
31 | test: /\.ts$/,
32 | use: [
33 | {
34 | loader: 'awesome-typescript-loader',
35 | options: {
36 | configFileName: 'tsconfig.json'
37 | }
38 | },
39 | {
40 | loader: 'angular2-template-loader'
41 | }
42 | ],
43 | exclude: [
44 | /node_modules/,
45 | /\.(spec|e2e)\.ts$/
46 | ]
47 | },
48 |
49 | {
50 | test: /\.json$/,
51 | use: 'json-loader'
52 | },
53 |
54 | {
55 | test: /\.css$/,
56 | use: ['to-string-loader', 'css-loader']
57 | },
58 |
59 | {
60 | test: /\.scss$/,
61 | use: ['to-string-loader', 'css-loader', 'sass-loader']
62 | },
63 |
64 | {
65 | test: /\.html$/,
66 | use: 'raw-loader'
67 | }
68 | ]
69 | },
70 | plugins: [
71 | new webpack.ContextReplacementPlugin(
72 | /angular(\\|\/)core(\\|\/)@angular/,
73 | path.join(__dirname, 'src')
74 | ),
75 |
76 | new webpack.optimize.UglifyJsPlugin({
77 | include: /\.min\.js$/,
78 | sourceMap: true
79 | }),
80 |
81 | new webpack.BannerPlugin({
82 | banner: `
83 | /**
84 | * ${pkg.name} - ${pkg.description}
85 | * @version v${pkg.version}
86 | * @author ${pkg.author.name}
87 | * @link ${pkg.homepage}
88 | * @license ${pkg.license}
89 | */
90 | `.trim(),
91 | raw: true,
92 | entryOnly: true
93 | })
94 |
95 | ]
96 | } as webpack.Configuration;
97 |
--------------------------------------------------------------------------------