File tree Expand file tree Collapse file tree
projects/uiowa/date-range-picker Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " @uiowa/date-range-picker" ,
3- "version" : " 19.0.0 " ,
3+ "version" : " 19.0.2 " ,
44 "author" : " Changhui Xu <changhui-xu@uiowa.edu>" ,
55 "description" : " An Angular library for date range picker." ,
66 "keywords" : [
1515 },
1616 "license" : " MIT" ,
1717 "peerDependencies" : {
18- "@angular/common" : " ^ 19.2 .0" ,
19- "@angular/core" : " ^ 19.2 .0" ,
18+ "@angular/common" : " >= 19.0 .0" ,
19+ "@angular/core" : " >= 19.0 .0" ,
2020 "@ng-bootstrap/ng-bootstrap" : " >=18.0.0"
2121 },
2222 "dependencies" : {
Original file line number Diff line number Diff line change 44 display : inline-block;
55 height : 2rem ;
66 width : 2rem ;
7+ border-radius : 0.5rem ;
8+ }
9+ .custom-day : hover ,
10+ .custom-day .focused {
11+ background-color : # e6e6e6 ;
12+ }
13+ .custom-day .today {
14+ border : 1px solid # 0d6efd ;
715}
816.custom-day .weekend {
917 color : # d81e1e ;
Original file line number Diff line number Diff line change 4444< ng-template
4545 #dayTemplate
4646 let-date ="date "
47+ let-today ="today "
48+ let-selected ="selected "
4749 let-disabled ="disabled "
50+ let-focused ="focused "
4851 let-currentMonth ="currentMonth "
4952>
5053 < span
5154 class ="custom-day "
5255 [class.weekend] ="isWeekend(date) "
56+ [class.today] ="today "
57+ [class.focused] ="focused "
58+ [class.bg-primary] ="selected "
59+ [class.text-white] ="selected "
5360 [class.disabled] ="disabled "
5461 [class.outside] ="date.month !== currentMonth "
5562 >
5865</ ng-template >
5966
6067< ng-template #footerTemplate >
61- < div *ngIf =" allowClear " >
62- < hr class =" my-0 " />
63- < button
64- class =" btn btn-primary btn-sm m-2 float-start "
65- (click) =" ngbDate = today; onDateChange(today); d.close() "
66- >
67- Today
68- </ button >
69- < button
70- class ="btn btn-secondary btn-sm m-2 float-end "
71- (click) ="ngbDate = null; dateChange.emit(undefined); d.close() "
72- >
73- Clear
74- </ button >
75- </ div >
68+ < hr class =" my-0 " / >
69+ < button
70+ class =" btn btn-primary btn-sm m-2 float-start "
71+ (click) =" ngbDate = today; onDateChange(today); d.close() "
72+ >
73+ Today
74+ </ button >
75+ @if(allowClear){
76+ < button
77+ class ="btn btn-secondary btn-sm m-2 float-end "
78+ (click) ="ngbDate = null; dateChange.emit(undefined); d.close() "
79+ >
80+ Clear
81+ </ button >
82+ }
7683</ ng-template >
Original file line number Diff line number Diff line change 11import {
22 ChangeDetectionStrategy ,
33 Component ,
4- EventEmitter ,
4+ inject ,
55 Input ,
66 OnChanges ,
77 OnInit ,
8- Output ,
8+ output ,
99 SimpleChanges ,
1010} from '@angular/core' ;
1111import {
@@ -24,29 +24,21 @@ import {
2424} )
2525export class DatePickerComponent implements OnInit , OnChanges {
2626 @Input ( ) id = '' ;
27- @Input ( )
28- date : Date | null = null ;
29- @Input ( )
30- disabled = false ;
27+ @Input ( ) date : Date | null = null ;
28+ @Input ( ) disabled = false ;
3129 @Input ( ) minDate ?: Date ;
3230 @Input ( ) maxDate ?: Date ;
3331 @Input ( ) isInvalid = false ;
3432 @Input ( ) allowClear = false ;
3533
36- @Output ( )
37- dateChange = new EventEmitter < Date > ( ) ;
34+ dateChange = output < Date | undefined > ( ) ;
3835
3936 ngbDate : NgbDate | null = null ;
4037 ngbMinDate ! : NgbDateStruct ;
4138 ngbMaxDate ! : NgbDateStruct ;
42- today ! : NgbDate ;
39+ today = inject ( NgbCalendar ) . getToday ( ) ;
4340
44- constructor (
45- private readonly dateAdapter : NgbDateNativeAdapter ,
46- calendar : NgbCalendar
47- ) {
48- this . today = calendar . getToday ( ) ;
49- }
41+ constructor ( private readonly dateAdapter : NgbDateNativeAdapter ) { }
5042
5143 ngOnInit ( ) {
5244 this . ngbDate = NgbDate . from ( this . dateAdapter . fromModel ( this . date ) ) ;
Original file line number Diff line number Diff line change 55 height : 2rem ;
66 width : 2rem ;
77}
8-
8+ .custom-day .today {
9+ border : 1px solid # 0d6efd ;
10+ }
911.custom-day .focused {
1012 background-color : # e6e6e6 ;
1113}
Original file line number Diff line number Diff line change 88 readonly
99 [attr.id] ="id "
1010 [disabled] ="disabled "
11- [ autoClose] =" false "
11+ autoClose =" outside "
1212 [displayMonths] ="2 "
1313 [dayTemplate] ="t "
1414 [showWeekNumbers] ="false "
4242< ng-template
4343 #t
4444 let-date ="date "
45+ let-today ="today "
4546 let-focused ="focused "
4647 let-disabled ="disabled "
4748 let-currentMonth ="currentMonth "
5455 "
5556 [class.faded] ="isHovered(date) || isInside(date) "
5657 [class.weekend] ="isWeekend(date) "
58+ [class.today] ="today "
5759 [class.disabled] ="disabled "
5860 [class.outside] ="date.month !== currentMonth "
5961 (mouseenter) ="hoveredDate = date "
Original file line number Diff line number Diff line change @@ -2,11 +2,10 @@ import {
22 ChangeDetectionStrategy ,
33 Component ,
44 ElementRef ,
5- EventEmitter ,
65 Input ,
76 OnChanges ,
87 OnInit ,
9- Output ,
8+ output ,
109 SimpleChanges ,
1110 ViewChild ,
1211} from '@angular/core' ;
@@ -26,16 +25,11 @@ import { DateRange } from '../models/date-range';
2625} )
2726export class DateRangePickerComponent implements OnInit , OnChanges {
2827 @Input ( ) id = '' ;
29- @Input ( )
30- dateRange : DateRange = new DateRange ( ) ;
31- @Input ( )
32- minDate ?: Date ;
33- @Input ( )
34- maxDate ?: Date ;
35- @Input ( )
36- disabled = false ;
37- @Output ( )
38- dateRangeChange = new EventEmitter < DateRange > ( ) ;
28+ @Input ( ) dateRange : DateRange = new DateRange ( ) ;
29+ @Input ( ) minDate ?: Date ;
30+ @Input ( ) maxDate ?: Date ;
31+ @Input ( ) disabled = false ;
32+ dateRangeChange = output < DateRange > ( ) ;
3933 hoveredDate : NgbDate | null = null ;
4034
4135 private fromDate : NgbDate | null = null ;
You can’t perform that action at this time.
0 commit comments