1
1
define ( [
2
2
"dcl/dcl" ,
3
3
"dojo/_base/lang" ,
4
- "dojo/date" ,
5
- "dojo/date/locale" ,
6
4
"dojo/dom-class" ,
7
5
"dojo/dom-style" ,
8
6
"dojo/dom-construct" ,
9
7
"dojo/dom-geometry" ,
10
8
"./metrics" ,
11
9
"./StoreBase" ,
12
- "./time " ,
10
+ "./TimeBase " ,
13
11
"dojo/i18n!./nls/buttons"
14
12
] , function (
15
13
dcl ,
16
14
lang ,
17
- date ,
18
- locale ,
19
15
domClass ,
20
16
domStyle ,
21
17
domConstruct ,
22
18
domGeometry ,
23
19
metrics ,
24
20
StoreBase ,
25
- timeUtil ,
21
+ TimeBase ,
26
22
_nls
27
23
) {
28
24
/*=====
@@ -139,19 +135,13 @@ define([
139
135
};
140
136
=====*/
141
137
142
- return dcl ( StoreBase , {
143
-
138
+ return dcl ( [ StoreBase , TimeBase ] , {
144
139
// summary:
145
140
// This class defines a generic calendar widget that manages several views to display event in time.
146
141
// It needs to be subclassed, specifically defining `_computeCurrentView()`.
147
142
148
143
baseClass : "d-calendar" ,
149
144
150
- // datePackage: Object
151
- // JavaScript namespace to find Calendar routines.
152
- // Uses Gregorian Calendar routines at dojo.date by default.
153
- datePackage : date ,
154
-
155
145
// startDate: Date
156
146
// The start date of the displayed time interval.
157
147
startDate : null ,
@@ -195,13 +185,6 @@ define([
195
185
// The DOM node that will contains the views.
196
186
viewContainer : null ,
197
187
198
- // firstDayOfWeek: Integer
199
- // (Optional) The first day of week override. By default the first day of week is determined
200
- // for the current locale (extracted from the CLDR).
201
- // 0 = Sunday, 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday.
202
- // Special value -1 (default value) means to use the locale dependent value.
203
- firstDayOfWeek : - 1 ,
204
-
205
188
// formatItemTime: Function?
206
189
// Optional function to format the time of day of the item renderers.
207
190
// The function takes the date, the render data object, the view and
@@ -262,7 +245,7 @@ define([
262
245
forwardProperties : [
263
246
"source" , "query" , "queryOptions" , "startTimeAttr" , "endTimeAttr" , "summaryAttr" , "allDayAttr" ,
264
247
"subColumnAttr" , "decodeDate" , "encodeDate" , "itemToRenderItem" , "renderItemToItem" , "cssClassFunc" ,
265
- "datePackage " ,
248
+ "dateClassObj" , "dateModule" , "dateLocaleModule" , "_calendar ",
266
249
"endDate" , "date" , "minDate" , "maxDate" , "dateInterval" , "dateIntervalSteps" ,
267
250
"firstDayOfWeek" ,
268
251
"formatItemTime" ,
@@ -279,20 +262,9 @@ define([
279
262
// The currentViewChange event can be used to react on a view change.
280
263
currentView : null ,
281
264
282
- _calendar : "gregorian" ,
283
-
284
265
// Make nls strings available to template
285
266
_nls : _nls ,
286
267
287
- createdCallback : function ( /*Object*/ args ) {
288
- args = args || { } ;
289
- this . _calendar = args . datePackage ? args . datePackage . substr ( args . datePackage . lastIndexOf ( "." ) + 1 ) :
290
- this . _calendar ;
291
- this . dateModule = args . datePackage ? lang . getObject ( args . datePackage , false ) : date ;
292
- this . dateClassObj = this . dateModule . Date || Date ;
293
- this . dateLocaleModule = args . datePackage ? lang . getObject ( args . datePackage + ".locale" , false ) : locale ;
294
- } ,
295
-
296
268
postRender : function ( ) {
297
269
this . viewContainer . on ( "delite-add-child" , function ( evt ) {
298
270
this . _onViewAdded ( evt . child ) ;
@@ -550,7 +522,6 @@ define([
550
522
view . owner = this ;
551
523
view . buttonContainer = this . buttonContainer ;
552
524
view . _calendar = this . _calendar ;
553
- view . datePackage = this . datePackage ;
554
525
view . dateModule = this . dateModule ;
555
526
view . dateClassObj = this . dateClassObj ;
556
527
view . dateLocaleModule = this . dateLocaleModule ;
@@ -681,82 +652,6 @@ define([
681
652
}
682
653
} ,
683
654
684
-
685
- /////////////////////////////////////////////////////
686
- //
687
- // Time utilities
688
- //
689
- ////////////////////////////////////////////////////
690
-
691
- floorToDay : function ( date , reuse ) {
692
- // summary:
693
- // Floors the specified date to the start of day.
694
- // date: Date
695
- // The date to floor.
696
- // reuse: Boolean
697
- // Whether use the specified instance or create a new one. Default is false.
698
- // returns: Date
699
-
700
- return timeUtil . floorToDay ( date , reuse , this . dateClassObj ) ;
701
- } ,
702
-
703
- floorToWeek : function ( d ) {
704
- // summary:
705
- // Floors the specified date to the beginning of week.
706
- // date: Date
707
- // Date to floor.
708
-
709
- return timeUtil . floorToWeek ( d , this . dateClassObj , this . dateModule , this . firstDayOfWeek , this . locale ) ;
710
- } ,
711
-
712
- newDate : function ( obj ) {
713
- // summary:
714
- // Creates a new Date object.
715
- // obj: Object
716
- // This object can have several values:
717
- // - the time in milliseconds since gregorian epoch.
718
- // - a Date instance
719
- // returns: Date
720
-
721
- return timeUtil . newDate ( obj , this . dateClassObj ) ;
722
- } ,
723
-
724
- isToday : function ( date ) {
725
- // summary:
726
- // Returns whether the specified date is in the current day.
727
- // date: Date
728
- // The date to test.
729
- // returns: Boolean
730
-
731
- return timeUtil . isToday ( date , this . dateClassObj ) ;
732
- } ,
733
-
734
- isStartOfDay : function ( d ) {
735
- // summary:
736
- // Tests if the specified date represents the starts of day.
737
- // d:Date
738
- // The date to test.
739
- // returns: Boolean
740
-
741
- return timeUtil . isStartOfDay ( d , this . dateClassObj , this . dateModule ) ;
742
- } ,
743
-
744
- floorDate : function ( date , unit , steps , reuse ) {
745
- // summary:
746
- // floors the date to the unit.
747
- // date: Date
748
- // The date/time to floor.
749
- // unit: String
750
- // The unit. Valid values are "minute", "hour", "day".
751
- // steps: Integer
752
- // For "day" only 1 is valid.
753
- // reuse: Boolean
754
- // Whether use the specified instance or create a new one. Default is false.
755
- // returns: Date
756
-
757
- return timeUtil . floor ( date , unit , steps , reuse , this . classFuncObj ) ;
758
- } ,
759
-
760
655
nextRange : function ( ) {
761
656
this . _navigate ( 1 ) ;
762
657
} ,
0 commit comments