2
2
/*jslint vars:true */
3
3
4
4
/**
5
- * @license angular-bootstrap-datetimepicker v0.2.2
5
+ * @license angular-bootstrap-datetimepicker v0.2.3
6
6
* (c) 2013 Knight Rider Consulting, Inc. http://www.knightrider.com
7
7
* License: MIT
8
8
*/
@@ -21,54 +21,52 @@ angular.module('ui.bootstrap.datetimepicker', [])
21
21
startView : 'day' ,
22
22
weekStart : 0
23
23
} )
24
- . constant ( 'dateTimePickerConfigValidation ', function ( configuration ) {
24
+ . directive ( 'datetimepicker ', [ 'dateTimePickerConfig' , function ( defaultConfig ) {
25
25
"use strict" ;
26
26
27
- var validOptions = [ 'startView' , 'minView' , 'minuteStep' , 'dropdownSelector' , 'weekStart' ] ;
27
+ var validateConfiguration = function ( configuration ) {
28
+ var validOptions = [ 'startView' , 'minView' , 'minuteStep' , 'dropdownSelector' , 'weekStart' ] ;
28
29
29
- for ( var prop in configuration ) {
30
- if ( configuration . hasOwnProperty ( prop ) ) {
31
- if ( validOptions . indexOf ( prop ) < 0 ) {
32
- throw ( "invalid option: " + prop ) ;
30
+ for ( var prop in configuration ) {
31
+ if ( configuration . hasOwnProperty ( prop ) ) {
32
+ if ( validOptions . indexOf ( prop ) < 0 ) {
33
+ throw ( "invalid option: " + prop ) ;
34
+ }
33
35
}
34
36
}
35
- }
36
-
37
- // Order of the elements in the validViews array is significant.
38
- var validViews = [ 'minute' , 'hour' , 'day' , 'month' , 'year' ] ;
39
-
40
- if ( validViews . indexOf ( configuration . startView ) < 0 ) {
41
- throw ( "invalid startView value: " + configuration . startView ) ;
42
- }
43
-
44
- if ( validViews . indexOf ( configuration . minView ) < 0 ) {
45
- throw ( "invalid minView value: " + configuration . minView ) ;
46
- }
47
-
48
- if ( validViews . indexOf ( configuration . minView ) > validViews . indexOf ( configuration . startView ) ) {
49
- throw ( "startView must be greater than minView" ) ;
50
- }
51
-
52
- if ( ! angular . isNumber ( configuration . minuteStep ) ) {
53
- throw ( "minuteStep must be numeric" ) ;
54
- }
55
- if ( configuration . minuteStep <= 0 || configuration . minuteStep >= 60 ) {
56
- throw ( "minuteStep must be greater than zero and less than 60" ) ;
57
- }
58
- if ( configuration . dropdownSelector !== null && ! angular . isString ( configuration . dropdownSelector ) ) {
59
- throw ( "dropdownSelector must be a string" ) ;
60
- }
61
-
62
- if ( ! angular . isNumber ( configuration . weekStart ) ) {
63
- throw ( "weekStart must be numeric" ) ;
64
- }
65
- if ( configuration . weekStart < 0 || configuration . weekStart > 6 ) {
66
- throw ( "weekStart must be greater than or equal to zero and less than 7" ) ;
67
- }
68
- }
69
- )
70
- . directive ( 'datetimepicker' , [ 'dateTimePickerConfig' , 'dateTimePickerConfigValidation' , function ( defaultConfig , validateConfigurationFunction ) {
71
- "use strict" ;
37
+
38
+ // Order of the elements in the validViews array is significant.
39
+ var validViews = [ 'minute' , 'hour' , 'day' , 'month' , 'year' ] ;
40
+
41
+ if ( validViews . indexOf ( configuration . startView ) < 0 ) {
42
+ throw ( "invalid startView value: " + configuration . startView ) ;
43
+ }
44
+
45
+ if ( validViews . indexOf ( configuration . minView ) < 0 ) {
46
+ throw ( "invalid minView value: " + configuration . minView ) ;
47
+ }
48
+
49
+ if ( validViews . indexOf ( configuration . minView ) > validViews . indexOf ( configuration . startView ) ) {
50
+ throw ( "startView must be greater than minView" ) ;
51
+ }
52
+
53
+ if ( ! angular . isNumber ( configuration . minuteStep ) ) {
54
+ throw ( "minuteStep must be numeric" ) ;
55
+ }
56
+ if ( configuration . minuteStep <= 0 || configuration . minuteStep >= 60 ) {
57
+ throw ( "minuteStep must be greater than zero and less than 60" ) ;
58
+ }
59
+ if ( configuration . dropdownSelector !== null && ! angular . isString ( configuration . dropdownSelector ) ) {
60
+ throw ( "dropdownSelector must be a string" ) ;
61
+ }
62
+
63
+ if ( ! angular . isNumber ( configuration . weekStart ) ) {
64
+ throw ( "weekStart must be numeric" ) ;
65
+ }
66
+ if ( configuration . weekStart < 0 || configuration . weekStart > 6 ) {
67
+ throw ( "weekStart must be greater than or equal to zero and less than 7" ) ;
68
+ }
69
+ } ;
72
70
73
71
return {
74
72
restrict : 'E' ,
@@ -78,31 +76,31 @@ angular.module('ui.bootstrap.datetimepicker', [])
78
76
" <thead>" +
79
77
" <tr>" +
80
78
" <th class='left'" +
81
- " data-ng-click=\" changeView(data.currentView, data.leftDate, $event)\" " +
79
+ " data-ng-click=' changeView(data.currentView, data.leftDate, $event)' " +
82
80
" ><i class='glyphicon glyphicon-arrow-left'/></th>" +
83
81
" <th class='switch' colspan='5'" +
84
- " data-ng-click=\" changeView(data.previousView, data.currentDate, $event)\" " +
82
+ " data-ng-click=' changeView(data.previousView, data.currentDate, $event)' " +
85
83
">{{ data.title }}</th>" +
86
84
" <th class='right'" +
87
- " data-ng-click=\" changeView(data.currentView, data.rightDate, $event)\" " +
85
+ " data-ng-click=' changeView(data.currentView, data.rightDate, $event)' " +
88
86
" ><i class='glyphicon glyphicon-arrow-right'/></th>" +
89
87
" </tr>" +
90
88
" <tr>" +
91
89
" <th class='dow' data-ng-repeat='day in data.dayNames' >{{ day }}</th>" +
92
90
" </tr>" +
93
91
" </thead>" +
94
92
" <tbody>" +
95
- ' <tr data-ng-class=\ '{ hide: data.currentView == "day" }\ ' >' +
93
+ " <tr data-ng-class='{ hide: data.currentView == \ "day\ " }' >" +
96
94
" <td colspan='7' >" +
97
95
" <span class='{{ data.currentView }}' " +
98
96
" data-ng-repeat='dateValue in data.dates' " +
99
97
" data-ng-class='{active: dateValue.active, past: dateValue.past, future: dateValue.future}' " +
100
98
" data-ng-click=\"changeView(data.nextView, dateValue.date, $event)\">{{ dateValue.display }}</span> " +
101
99
" </td>" +
102
100
" </tr>" +
103
- ' <tr data-ng-show=\ 'data.currentView == "day"\ ' data-ng-repeat=\ 'week in data.weeks\'>' +
101
+ " <tr data-ng-show='data.currentView == \ "day\" ' data-ng-repeat='week in data.weeks'>" +
104
102
" <td data-ng-repeat='dateValue in week.dates' " +
105
- " data-ng-click=\" changeView(data.nextView, dateValue.date, $event)\" " +
103
+ " data-ng-click=' changeView(data.nextView, dateValue.date, $event)' " +
106
104
" class='day' " +
107
105
" data-ng-class='{active: dateValue.active, past: dateValue.past, future: dateValue.future}' >{{ dateValue.display }}</td>" +
108
106
" </tr>" +
@@ -125,7 +123,7 @@ angular.module('ui.bootstrap.datetimepicker', [])
125
123
126
124
angular . extend ( configuration , defaultConfig , directiveConfig ) ;
127
125
128
- validateConfigurationFunction ( configuration ) ;
126
+ validateConfiguration ( configuration ) ;
129
127
130
128
var dataFactory = {
131
129
year : function ( unixDate ) {
0 commit comments