File tree Expand file tree Collapse file tree 12 files changed +144
-5
lines changed Expand file tree Collapse file tree 12 files changed +144
-5
lines changed Original file line number Diff line number Diff line change 14
14
" components/checkbox/checkbox.md" ,
15
15
" components/chip/chip.md" ,
16
16
" components/content/content.md" ,
17
+ " components/datetime/datetime.md" ,
17
18
" components/input/input.md" ,
18
19
" components/item/item.md" ,
19
20
" components/label/label.md" ,
Original file line number Diff line number Diff line change 14
14
" components/checkbox/checkbox.wp" ,
15
15
" components/chip/chip.wp" ,
16
16
" components/content/content.wp" ,
17
+ " components/datetime/datetime.wp" ,
17
18
" components/input/input.wp" ,
18
19
" components/item/item.wp" ,
19
20
" components/label/label.wp" ,
Original file line number Diff line number Diff line change
1
+ @import " ../../globals.md" ;
2
+ @import " ./datetime" ;
3
+
4
+ // Material Design DateTime
5
+ // --------------------------------------------------
6
+
7
+ $datetime-md-padding-top : $item-md-padding-top !default ;
8
+ $datetime-md-padding-right : ($item-md-padding-right / 2 ) !default ;
9
+ $datetime-md-padding-bottom : $item-md-padding-bottom !default ;
10
+ $datetime-md-padding-left : $item-md-padding-left !default ;
11
+
12
+
13
+ ion-datetime {
14
+ padding : $datetime-md-padding-top $datetime-md-padding-right $datetime-md-padding-bottom $datetime-md-padding-left ;
15
+ }
Original file line number Diff line number Diff line change 6
6
ion-datetime {
7
7
display : flex ;
8
8
overflow : hidden ;
9
-
10
- max-width : 45% ;
11
9
}
12
10
13
11
.datetime-text {
@@ -20,6 +18,9 @@ ion-datetime {
20
18
font-size : inherit ;
21
19
text-overflow : ellipsis ;
22
20
white-space : nowrap ;
21
+
22
+ min-height : 1.2em ;
23
+ line-height : 1.2 ;
23
24
}
24
25
25
26
.datetime-disabled ,
@@ -28,3 +29,9 @@ ion-datetime {
28
29
29
30
pointer-events : none ;
30
31
}
32
+
33
+ .item-label-stacked ion-datetime ,
34
+ .item-label-floating ion-datetime {
35
+ width : 100% ;
36
+ padding-left : 0 ;
37
+ }
Original file line number Diff line number Diff line change @@ -698,6 +698,15 @@ export class DateTime {
698
698
return this . _value ;
699
699
}
700
700
701
+ /**
702
+ * @private
703
+ */
704
+ checkHasValue ( inputValue : any ) {
705
+ if ( this . _item ) {
706
+ this . _item . setCssClass ( 'input-has-value' , ! ! ( inputValue && inputValue !== '' ) ) ;
707
+ }
708
+ }
709
+
701
710
/**
702
711
* @private
703
712
*/
@@ -766,6 +775,7 @@ export class DateTime {
766
775
console . debug ( 'datetime, writeValue' , val ) ;
767
776
this . setValue ( val ) ;
768
777
this . updateText ( ) ;
778
+ this . checkHasValue ( val ) ;
769
779
}
770
780
771
781
/**
@@ -792,6 +802,7 @@ export class DateTime {
792
802
console . debug ( 'datetime, onChange' , val ) ;
793
803
this . setValue ( val ) ;
794
804
this . updateText ( ) ;
805
+ this . checkHasValue ( val ) ;
795
806
796
807
// convert DateTimeData value to iso datetime format
797
808
fn ( convertDataToISO ( this . _value ) ) ;
Original file line number Diff line number Diff line change
1
+ @import " ../../globals.wp" ;
2
+ @import " ./datetime" ;
3
+
4
+ // Windows DateTime
5
+ // --------------------------------------------------
6
+
7
+ $datetime-wp-min-width : 45% !default ;
8
+
9
+ $datetime-wp-padding-top : $item-wp-padding-top !default ;
10
+ $datetime-wp-padding-right : ($item-wp-padding-right / 2 ) !default ;
11
+ $datetime-wp-padding-bottom : $item-wp-padding-bottom !default ;
12
+ $datetime-wp-padding-left : $item-wp-padding-left !default ;
13
+
14
+ $datetime-wp-border-width : 2px !default ;
15
+ $datetime-wp-border-color : $input-wp-border-color !default ;
16
+
17
+ ion-datetime {
18
+ padding : $datetime-wp-padding-top $datetime-wp-padding-right $datetime-wp-padding-bottom $datetime-wp-padding-left ;
19
+ min-width : $datetime-wp-min-width ;
20
+ }
21
+
22
+ .datetime-text {
23
+ border : $datetime-wp-border-width solid $datetime-wp-border-color ;
24
+ line-height : 3rem ;
25
+ min-height : 3.4rem ;
26
+ padding : 0 8px ;
27
+ }
28
+
29
+ .item-datetime ion-label [floating ] {
30
+ transform : translate3d (8px , 41px , 0 );
31
+ }
Original file line number Diff line number Diff line change
1
+ import { Component } from '@angular/core' ;
2
+ import { ionicBootstrap } from '../../../../../src' ;
3
+
4
+
5
+ @Component ( {
6
+ templateUrl : 'main.html'
7
+ } )
8
+ class E2EPage {
9
+ stacked2 = '1994-12-15T13:47:20.789' ;
10
+ floating2 = '1995-04-15' ;
11
+ fixed2 = '2002-09-23T15:03:46.789' ;
12
+ inline2 = '2005-06-17T11:06Z' ;
13
+ }
14
+
15
+
16
+ @Component ( {
17
+ template : '<ion-nav [root]="root"></ion-nav>'
18
+ } )
19
+ class E2EApp {
20
+ root = E2EPage ;
21
+ }
22
+
23
+ ionicBootstrap ( E2EApp ) ;
Original file line number Diff line number Diff line change
1
+ < ion-toolbar >
2
+ < ion-title > Datetime</ ion-title >
3
+ </ ion-toolbar >
4
+
5
+ < ion-content class ="outer-content ">
6
+
7
+ < ion-item >
8
+ < ion-label stacked > Stacked</ ion-label >
9
+ < ion-datetime [(ngModel)] ="stacked1 "> </ ion-datetime >
10
+ </ ion-item >
11
+
12
+ < ion-item >
13
+ < ion-label stacked > Stacked</ ion-label >
14
+ < ion-datetime [(ngModel)] ="stacked2 "> </ ion-datetime >
15
+ </ ion-item >
16
+
17
+ < ion-item >
18
+ < ion-label floating > Floating</ ion-label >
19
+ < ion-datetime displayFormat ="MMMM YY " [(ngModel)] ="floating1 "> </ ion-datetime >
20
+ </ ion-item >
21
+
22
+ < ion-item >
23
+ < ion-label floating > Floating</ ion-label >
24
+ < ion-datetime displayFormat ="D MMM YYYY "[(ngModel)] ="floating2 "> </ ion-datetime >
25
+ </ ion-item >
26
+
27
+ < ion-item >
28
+ < ion-label fixed > Fixed</ ion-label >
29
+ < ion-datetime displayFormat ="MM/DD/YYYY " [(ngModel)] ="fixed1 "> </ ion-datetime >
30
+ </ ion-item >
31
+
32
+ < ion-item >
33
+ < ion-label fixed > Fixed</ ion-label >
34
+ < ion-datetime displayFormat ="DDDD MMM D, YYYY " [(ngModel)] ="fixed2 "> </ ion-datetime >
35
+ </ ion-item >
36
+
37
+ < ion-item >
38
+ < ion-label > Inline</ ion-label >
39
+ < ion-datetime displayFormat ="MM/DD/YYYY " [(ngModel)] ="inline1 "> </ ion-datetime >
40
+ </ ion-item >
41
+
42
+ < ion-item >
43
+ < ion-label > Inline</ ion-label >
44
+ < ion-datetime displayFormat ="DDDD MMM D, YYYY " [(ngModel)] ="inline2 "> </ ion-datetime >
45
+ </ ion-item >
46
+
47
+ </ ion-content >
Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ ion-label {
20
20
// --------------------------------------------------
21
21
22
22
.item-input ion-label ,
23
- .item-select ion-label {
23
+ .item-select ion-label ,
24
+ .item-datetime ion-label {
24
25
color : $label-ios-text-color ;
25
26
}
26
27
You can’t perform that action at this time.
0 commit comments