| 1 |
define([ |
| 2 |
"dojo/_base/declare", |
| 3 |
"dojo/_base/sniff", |
| 4 |
"dojo/_base/event", |
| 5 |
"dojo/_base/lang", |
| 6 |
"dojo/_base/array", |
| 7 |
"dojo/cldr/supplemental", |
| 8 |
"dojo/dom", |
| 9 |
"dojo/dom-class", |
| 10 |
"dojo/dom-style", |
| 11 |
"dojo/dom-construct", |
| 12 |
"dojo/dom-geometry", |
| 13 |
"dojo/date", |
| 14 |
"dojo/date/locale", |
| 15 |
"dojo/_base/fx", |
| 16 |
"dojo/fx", |
| 17 |
"dojo/on", |
| 18 |
"dijit/_WidgetBase", |
| 19 |
"dijit/_TemplatedMixin", |
| 20 |
"dijit/_WidgetsInTemplateMixin", |
| 21 |
"./StoreMixin", |
| 22 |
"./StoreManager", |
| 23 |
"dojox/widget/_Invalidating", |
| 24 |
"dojox/widget/Selection", |
| 25 |
"./time", |
| 26 |
"dojo/i18n!./nls/buttons"], |
| 27 |
function( |
| 28 |
declare, |
| 29 |
has, |
| 30 |
event, |
| 31 |
lang, |
| 32 |
arr, |
| 33 |
cldr, |
| 34 |
dom, |
| 35 |
domClass, |
| 36 |
domStyle, |
| 37 |
domConstruct, |
| 38 |
domGeometry, |
| 39 |
date, |
| 40 |
locale, |
| 41 |
coreFx, |
| 42 |
fx, |
| 43 |
on, |
| 44 |
_WidgetBase, |
| 45 |
_TemplatedMixin, |
| 46 |
_WidgetsInTemplateMixin, |
| 47 |
StoreMixin, |
| 48 |
StoreManager, |
| 49 |
_Invalidating, |
| 50 |
Selection, |
| 51 |
timeUtil, |
| 52 |
_nls){ |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 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 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
return declare("dojox.calendar.CalendarBase", [_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, StoreMixin, _Invalidating, Selection], { |
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
baseClass: "dojoxCalendar", |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
datePackage: date, |
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
startDate: null, |
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
endDate: null, |
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
date: null, |
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
minDate: null, |
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
maxDate: null, |
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
dateInterval: "week", |
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
dateIntervalSteps: 1, |
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
viewContainer: null, |
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
firstDayOfWeek: -1, |
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
formatItemTimeFunc: null, |
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
editable: true, |
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
moveEnabled: true, |
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
resizeEnabled: true, |
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
columnView: null, |
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
matrixView: null, |
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
columnViewProps: null, |
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
matrixViewProps: null, |
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
createOnGridClick: false, |
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
createItemFunc: null, |
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
currentView: null, |
| 281 |
|
| 282 |
_currentViewIndex: -1, |
| 283 |
|
| 284 |
views: null, |
| 285 |
|
| 286 |
_calendar: "gregorian", |
| 287 |
|
| 288 |
constructor: function(args){ |
| 289 |
this.views = []; |
| 290 |
|
| 291 |
this.invalidatingProperties = ["store", "items", "startDate", "endDate", "views", |
| 292 |
"date", "minDate", "maxDate", "dateInterval", "dateIntervalSteps", "firstDayOfWeek"]; |
| 293 |
|
| 294 |
args = args || {}; |
| 295 |
this._calendar = args.datePackage ? args.datePackage.substr(args.datePackage.lastIndexOf(".")+1) : this._calendar; |
| 296 |
this.dateModule = args.datePackage ? lang.getObject(args.datePackage, false) : date; |
| 297 |
this.dateClassObj = this.dateModule.Date || Date; |
| 298 |
this.dateLocaleModule = args.datePackage ? lang.getObject(args.datePackage+".locale", false) : locale; |
| 299 |
|
| 300 |
this.invalidateRendering(); |
| 301 |
|
| 302 |
this.storeManager = new StoreManager({owner: this, _ownerItemsProperty: "items"}); |
| 303 |
this.storeManager.on("layoutInvalidated", lang.hitch(this, this._refreshItemsRendering)); |
| 304 |
this.storeManager.on("renderersInvalidated", lang.hitch(this, this._updateRenderers)); |
| 305 |
this.storeManager.on("dataLoaded", lang.hitch(this, function(items){ |
| 306 |
this.set("items", items); |
| 307 |
})); |
| 308 |
|
| 309 |
this.decorationStoreManager = new StoreManager({owner: this, _ownerItemsProperty: "decorationItems"}); |
| 310 |
this.decorationStoreManager.on("layoutInvalidated", lang.hitch(this, this._refreshDecorationItemsRendering)); |
| 311 |
this.decorationStoreManager.on("dataLoaded", lang.hitch(this, function(items){ |
| 312 |
this.set("decorationItems", items); |
| 313 |
})); |
| 314 |
}, |
| 315 |
|
| 316 |
buildRendering: function(){ |
| 317 |
this.inherited(arguments); |
| 318 |
if(this.views == null || this.views.length == 0){ |
| 319 |
this.set("views", this._createDefaultViews()); |
| 320 |
} |
| 321 |
}, |
| 322 |
|
| 323 |
_applyAttributes: function(){ |
| 324 |
this._applyAttr = true; |
| 325 |
this.inherited(arguments); |
| 326 |
delete this._applyAttr; |
| 327 |
}, |
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
|
| 335 |
_setStartDateAttr: function(value){ |
| 336 |
this._set("startDate", value); |
| 337 |
this._timeRangeInvalidated = true; |
| 338 |
this._startDateChanged = true; |
| 339 |
}, |
| 340 |
|
| 341 |
_setEndDateAttr: function(value){ |
| 342 |
this._set("endDate", value); |
| 343 |
this._timeRangeInvalidated = true; |
| 344 |
this._endDateChanged = true; |
| 345 |
}, |
| 346 |
|
| 347 |
_setDateAttr: function(value){ |
| 348 |
this._set("date", value); |
| 349 |
this._timeRangeInvalidated = true; |
| 350 |
this._dateChanged = true; |
| 351 |
}, |
| 352 |
|
| 353 |
_setDateIntervalAttr: function(value){ |
| 354 |
this._set("dateInterval", value); |
| 355 |
this._timeRangeInvalidated = true; |
| 356 |
}, |
| 357 |
|
| 358 |
_setDateIntervalStepsAttr: function(value){ |
| 359 |
this._set("dateIntervalSteps", value); |
| 360 |
this._timeRangeInvalidated = true; |
| 361 |
}, |
| 362 |
|
| 363 |
_setFirstDayOfWeekAttr: function(value){ |
| 364 |
this._set("firstDayOfWeek", value); |
| 365 |
if(this.get("date") != null && this.get("dateInterval") == "week"){ |
| 366 |
this._timeRangeInvalidated = true; |
| 367 |
} |
| 368 |
}, |
| 369 |
|
| 370 |
_setTextDirAttr: function(value){ |
| 371 |
arr.forEach(this.views, function(view){ |
| 372 |
view.set("textDir", value); |
| 373 |
}); |
| 374 |
}, |
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
refreshRendering: function(){ |
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
this.inherited(arguments); |
| 389 |
this._validateProperties(); |
| 390 |
}, |
| 391 |
|
| 392 |
_refreshItemsRendering: function(){ |
| 393 |
if(this.currentView){ |
| 394 |
this.currentView._refreshItemsRendering(); |
| 395 |
} |
| 396 |
}, |
| 397 |
|
| 398 |
_updateRenderers: function(item){ |
| 399 |
if(this.currentView){ |
| 400 |
this.currentView.updateRenderers(item); |
| 401 |
} |
| 402 |
}, |
| 403 |
|
| 404 |
_refreshDecorationItemsRendering: function(){ |
| 405 |
if(this.currentView){ |
| 406 |
this.currentView._refreshDecorationItemsRendering(); |
| 407 |
} |
| 408 |
}, |
| 409 |
|
| 410 |
resize: function(changeSize){ |
| 411 |
if(changeSize){ |
| 412 |
domGeometry.setMarginBox(this.domNode, changeSize); |
| 413 |
} |
| 414 |
if(this.currentView){ |
| 415 |
|
| 416 |
this.currentView.resize(); |
| 417 |
} |
| 418 |
}, |
| 419 |
|
| 420 |
_validateProperties: function(){ |
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
var cal = this.dateModule; |
| 425 |
var startDate = this.get("startDate"); |
| 426 |
var endDate = this.get("endDate"); |
| 427 |
var date = this.get("date"); |
| 428 |
|
| 429 |
if(this.firstDayOfWeek < -1 || this.firstDayOfWeek > 6){ |
| 430 |
this._set("firstDayOfWeek", 0); |
| 431 |
} |
| 432 |
|
| 433 |
var minDate = this.get("minDate"); |
| 434 |
var maxDate = this.get("maxDate"); |
| 435 |
|
| 436 |
if(minDate && maxDate){ |
| 437 |
if(cal.compare(minDate, maxDate) > 0){ |
| 438 |
var t = minDate; |
| 439 |
this._set("minDate", maxDate); |
| 440 |
this._set("maxDate", t); |
| 441 |
} |
| 442 |
} |
| 443 |
|
| 444 |
if(date == null && (startDate != null || endDate != null)){ |
| 445 |
|
| 446 |
if(startDate == null){ |
| 447 |
startDate = new this.dateClassObj(); |
| 448 |
this._set("startDate", startDate); |
| 449 |
this._timeRangeInvalidated = true; |
| 450 |
} |
| 451 |
|
| 452 |
if(endDate == null){ |
| 453 |
endDate = new this.dateClassObj(); |
| 454 |
this._set("endDate", endDate); |
| 455 |
this._timeRangeInvalidated = true; |
| 456 |
} |
| 457 |
|
| 458 |
if(cal.compare(startDate, endDate) > 0){ |
| 459 |
endDate = cal.add(startDate, "day", 1); |
| 460 |
this._set("endDate", endDate); |
| 461 |
this._timeRangeInvalidated = true; |
| 462 |
} |
| 463 |
|
| 464 |
}else{ |
| 465 |
|
| 466 |
if(this.date == null){ |
| 467 |
this._set("date", new this.dateClassObj()); |
| 468 |
this._timeRangeInvalidated = true; |
| 469 |
} |
| 470 |
|
| 471 |
var dint = this.get("dateInterval"); |
| 472 |
if(dint != "day" && dint != "week" && dint != "month"){ |
| 473 |
this._set("dateInterval", "day"); |
| 474 |
this._timeRangeInvalidated = true; |
| 475 |
} |
| 476 |
|
| 477 |
var dis = this.get("dateIntervalSteps"); |
| 478 |
if(lang.isString(dis)){ |
| 479 |
dis = parseInt(dis); |
| 480 |
this._set("dateIntervalSteps", dis); |
| 481 |
} |
| 482 |
if(dis <= 0) { |
| 483 |
this.set("dateIntervalSteps", 1); |
| 484 |
this._timeRangeInvalidated = true; |
| 485 |
} |
| 486 |
} |
| 487 |
|
| 488 |
if(this._timeRangeInvalidated){ |
| 489 |
this._timeRangeInvalidated = false; |
| 490 |
|
| 491 |
var timeInterval = this.computeTimeInterval(); |
| 492 |
|
| 493 |
if(this._timeInterval == null || |
| 494 |
cal.compare(this._timeInterval[0], timeInterval[0]) != 0 || |
| 495 |
cal.compare(this._timeInterval[1], timeInterval[1]) != 0){ |
| 496 |
|
| 497 |
if(this._dateChanged){ |
| 498 |
this._lastValidDate = this.get("date");; |
| 499 |
this._dateChanged = false; |
| 500 |
}else if(this._startDateChanged || this._endDateChanged){ |
| 501 |
this._lastValidStartDate = this.get("startDate"); |
| 502 |
this._lastValidEndDate = this.get("endDate"); |
| 503 |
this._startDateChanged = false; |
| 504 |
this._endDateChanged = false; |
| 505 |
} |
| 506 |
|
| 507 |
this.onTimeIntervalChange({ |
| 508 |
oldStartTime: this._timeInterval == null ? null : this._timeInterval[0], |
| 509 |
oldEndTime: this._timeInterval == null ? null : this._timeInterval[1], |
| 510 |
startTime: timeInterval[0], |
| 511 |
endTime: timeInterval[1] |
| 512 |
}); |
| 513 |
}else{ |
| 514 |
|
| 515 |
if(this._dateChanged){ |
| 516 |
this._dateChanged = false; |
| 517 |
if(this.lastValidDate != null){ |
| 518 |
this._set("date", this.lastValidDate); |
| 519 |
} |
| 520 |
}else if(this._startDateChanged || this._endDateChanged){ |
| 521 |
this._startDateChanged = false; |
| 522 |
this._endDateChanged = false; |
| 523 |
this._set("startDate", this._lastValidStartDate); |
| 524 |
this._set("endDate", this._lastValidEndDate); |
| 525 |
} |
| 526 |
return; |
| 527 |
} |
| 528 |
|
| 529 |
this._timeInterval = timeInterval; |
| 530 |
|
| 531 |
var duration = this.dateModule.difference(this._timeInterval[0], this._timeInterval[1], "day"); |
| 532 |
var view = this._computeCurrentView(timeInterval[0], timeInterval[1], duration); |
| 533 |
|
| 534 |
var index = arr.indexOf(this.views, view); |
| 535 |
|
| 536 |
if(view == null || index == -1){ |
| 537 |
return; |
| 538 |
} |
| 539 |
|
| 540 |
this._performViewTransition(view, index, timeInterval, duration); |
| 541 |
} |
| 542 |
}, |
| 543 |
|
| 544 |
_performViewTransition: function(view, index, timeInterval, duration){ |
| 545 |
var oldView = this.currentView; |
| 546 |
|
| 547 |
if(this.animateRange && (!has("ie") || has("ie")>8) ){ |
| 548 |
if(oldView){ |
| 549 |
oldView.beforeDeactivate(); |
| 550 |
var ltr = this.isLeftToRight(); |
| 551 |
var inLeft = this._animRangeInDir=="left" || this._animRangeInDir == null; |
| 552 |
var outLeft = this._animRangeOutDir=="left" || this._animRangeOutDir == null; |
| 553 |
this._animateRange(this.currentView.domNode, outLeft && ltr, false, 0, outLeft ? -100 : 100, |
| 554 |
lang.hitch(this, function(){ |
| 555 |
oldView.afterDeactivate(); |
| 556 |
view.beforeActivate(); |
| 557 |
this.animateRangeTimer = setTimeout(lang.hitch(this, function(){ |
| 558 |
this._applyViewChange(view, index, timeInterval, duration); |
| 559 |
this._animateRange(this.currentView.domNode, inLeft && ltr, true, inLeft ? -100 : 100, 0, function(){ |
| 560 |
view.afterActivate(); |
| 561 |
}); |
| 562 |
this._animRangeInDir = null; |
| 563 |
this._animRangeOutDir = null; |
| 564 |
}), 100); |
| 565 |
})); |
| 566 |
}else{ |
| 567 |
view.beforeActivate(); |
| 568 |
this._applyViewChange(view, index, timeInterval, duration); |
| 569 |
view.afterActivate(); |
| 570 |
} |
| 571 |
}else{ |
| 572 |
if(oldView){ |
| 573 |
oldView.beforeDeactivate(); |
| 574 |
} |
| 575 |
view.beforeActivate(); |
| 576 |
this._applyViewChange(view, index, timeInterval, duration); |
| 577 |
if(oldView){ |
| 578 |
oldView.afterDeactivate(); |
| 579 |
} |
| 580 |
view.afterActivate(); |
| 581 |
} |
| 582 |
}, |
| 583 |
|
| 584 |
onViewConfigurationChange: function(view){ |
| 585 |
|
| 586 |
|
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
}, |
| 594 |
|
| 595 |
_applyViewChange: function(view, index, timeInterval, duration){ |
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
|
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
this._configureView(view, index, timeInterval, duration); |
| 610 |
this.onViewConfigurationChange(view); |
| 611 |
|
| 612 |
if(index != this._currentViewIndex){ |
| 613 |
if(this.currentView == null){ |
| 614 |
view.set("items", this.items); |
| 615 |
view.set("decorationItems", this.decorationItems); |
| 616 |
this.set("currentView", view); |
| 617 |
}else{ |
| 618 |
if(this.items == null || this.items.length == 0){ |
| 619 |
this.set("currentView", view); |
| 620 |
if(this.animateRange && (!has("ie") || has("ie")>8) ){ |
| 621 |
domStyle.set(this.currentView.domNode, "opacity", 0); |
| 622 |
} |
| 623 |
view.set("items", this.items); |
| 624 |
view.set("decorationItems", this.decorationItems); |
| 625 |
}else{ |
| 626 |
this.currentView = view; |
| 627 |
view.set("items", this.items); |
| 628 |
view.set("decorationItems", this.decorationItems); |
| 629 |
this.set("currentView", view); |
| 630 |
if(this.animateRange && (!has("ie") || has("ie")>8) ){ |
| 631 |
domStyle.set(this.currentView.domNode, "opacity", 0); |
| 632 |
} |
| 633 |
} |
| 634 |
} |
| 635 |
} |
| 636 |
}, |
| 637 |
|
| 638 |
_timeInterval: null, |
| 639 |
|
| 640 |
computeTimeInterval: function(){ |
| 641 |
|
| 642 |
var d = this.get("date"); |
| 643 |
var minDate = this.get("minDate"); |
| 644 |
var maxDate = this.get("maxDate"); |
| 645 |
var cal = this.dateModule; |
| 646 |
|
| 647 |
if(d == null){ |
| 648 |
var startDate = this.get("startDate"); |
| 649 |
var endDate = cal.add(this.get("endDate"), "day", 1); |
| 650 |
|
| 651 |
if(minDate != null || maxDate != null){ |
| 652 |
var dur = this.dateModule.difference(startDate, endDate, "day"); |
| 653 |
if(cal.compare(minDate, startDate) > 0){ |
| 654 |
startDate = minDate; |
| 655 |
endDate = cal.add(startDate, "day", dur); |
| 656 |
} |
| 657 |
if(cal.compare(maxDate, endDate) < 0){ |
| 658 |
endDate = maxDate; |
| 659 |
startDate = cal.add(endDate, "day", -dur); |
| 660 |
} |
| 661 |
if(cal.compare(minDate, startDate) > 0){ |
| 662 |
startDate = minDate; |
| 663 |
endDate = maxDate; |
| 664 |
} |
| 665 |
} |
| 666 |
return [ this.floorToDay(startDate), this.floorToDay(endDate) ]; |
| 667 |
|
| 668 |
}else{ |
| 669 |
|
| 670 |
var interval = this._computeTimeIntervalImpl(d); |
| 671 |
|
| 672 |
if(minDate != null){ |
| 673 |
var minInterval = this._computeTimeIntervalImpl(minDate); |
| 674 |
if(cal.compare(minInterval[0], interval[0]) > 0){ |
| 675 |
interval = minInterval; |
| 676 |
} |
| 677 |
} |
| 678 |
|
| 679 |
if(maxDate != null){ |
| 680 |
var maxInterval = this._computeTimeIntervalImpl(maxDate); |
| 681 |
if(cal.compare(maxInterval[1], interval[1]) < 0){ |
| 682 |
interval = maxInterval; |
| 683 |
} |
| 684 |
} |
| 685 |
|
| 686 |
return interval; |
| 687 |
} |
| 688 |
}, |
| 689 |
|
| 690 |
_computeTimeIntervalImpl: function(d){ |
| 691 |
|
| 692 |
|
| 693 |
|
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
var cal = this.dateModule; |
| 698 |
|
| 699 |
var s = this.floorToDay(d); |
| 700 |
var di = this.get("dateInterval"); |
| 701 |
var dis = this.get("dateIntervalSteps"); |
| 702 |
var e; |
| 703 |
|
| 704 |
switch(di){ |
| 705 |
case "day": |
| 706 |
e = cal.add(s, "day", dis); |
| 707 |
break; |
| 708 |
case "week": |
| 709 |
s = this.floorToWeek(s); |
| 710 |
e = cal.add(s, "week", dis); |
| 711 |
break; |
| 712 |
case "month": |
| 713 |
s.setDate(1); |
| 714 |
e = cal.add(s, "month", dis); |
| 715 |
break; |
| 716 |
default: |
| 717 |
e = cal.add(s, "day", 1); |
| 718 |
} |
| 719 |
return [s, e]; |
| 720 |
}, |
| 721 |
|
| 722 |
onTimeIntervalChange: function(e){ |
| 723 |
|
| 724 |
|
| 725 |
|
| 726 |
|
| 727 |
|
| 728 |
|
| 729 |
}, |
| 730 |
|
| 731 |
|
| 732 |
|
| 733 |
|
| 734 |
|
| 735 |
|
| 736 |
|
| 737 |
|
| 738 |
|
| 739 |
|
| 740 |
views: null, |
| 741 |
|
| 742 |
_setViewsAttr: function(views){ |
| 743 |
if(!this._applyAttr){ |
| 744 |
|
| 745 |
|
| 746 |
|
| 747 |
for(var i=0;i<this.views.length;i++){ |
| 748 |
this._onViewRemoved(this.views[i]); |
| 749 |
} |
| 750 |
} |
| 751 |
if(views != null){ |
| 752 |
for(var i=0;i<views.length;i++){ |
| 753 |
this._onViewAdded(views[i]); |
| 754 |
} |
| 755 |
} |
| 756 |
this._set("views", views == null ? [] : views.concat()); |
| 757 |
}, |
| 758 |
|
| 759 |
_getViewsAttr: function(){ |
| 760 |
return this.views.concat(); |
| 761 |
}, |
| 762 |
|
| 763 |
_createDefaultViews: function(){ |
| 764 |
|
| 765 |
|
| 766 |
|
| 767 |
|
| 768 |
|
| 769 |
}, |
| 770 |
|
| 771 |
addView: function(view, index){ |
| 772 |
|
| 773 |
|
| 774 |
|
| 775 |
|
| 776 |
|
| 777 |
|
| 778 |
|
| 779 |
|
| 780 |
|
| 781 |
if(index <= 0 || index > this.views.length){ |
| 782 |
index = this.views.length; |
| 783 |
} |
| 784 |
this.views.splice(index, view); |
| 785 |
this._onViewAdded(view); |
| 786 |
}, |
| 787 |
|
| 788 |
removeView: function(view){ |
| 789 |
|
| 790 |
|
| 791 |
|
| 792 |
|
| 793 |
|
| 794 |
|
| 795 |
|
| 796 |
if(index < 0 || index >= this.views.length){ |
| 797 |
return; |
| 798 |
} |
| 799 |
|
| 800 |
this._onViewRemoved(this.views[index]); |
| 801 |
this.views.splice(index, 1); |
| 802 |
}, |
| 803 |
|
| 804 |
_onViewAdded: function(view){ |
| 805 |
view.owner = this; |
| 806 |
view.buttonContainer = this.buttonContainer; |
| 807 |
view._calendar = this._calendar; |
| 808 |
view.datePackage = this.datePackage; |
| 809 |
view.dateModule = this.dateModule; |
| 810 |
view.dateClassObj = this.dateClassObj; |
| 811 |
view.dateLocaleModule = this.dateLocaleModule; |
| 812 |
domStyle.set(view.domNode, "display", "none"); |
| 813 |
domClass.add(view.domNode, "view"); |
| 814 |
domConstruct.place(view.domNode, this.viewContainer); |
| 815 |
this.onViewAdded(view); |
| 816 |
}, |
| 817 |
|
| 818 |
onViewAdded: function(view){ |
| 819 |
|
| 820 |
|
| 821 |
|
| 822 |
|
| 823 |
|
| 824 |
|
| 825 |
|
| 826 |
}, |
| 827 |
|
| 828 |
_onViewRemoved: function(view){ |
| 829 |
view.owner = null; |
| 830 |
view.buttonContainer = null; |
| 831 |
domClass.remove(view.domNode, "view"); |
| 832 |
this.viewContainer.removeChild(view.domNode); |
| 833 |
this.onViewRemoved(view); |
| 834 |
}, |
| 835 |
|
| 836 |
onViewRemoved: function(view){ |
| 837 |
|
| 838 |
|
| 839 |
|
| 840 |
|
| 841 |
|
| 842 |
|
| 843 |
|
| 844 |
}, |
| 845 |
|
| 846 |
_setCurrentViewAttr: function(view){ |
| 847 |
var index = arr.indexOf(this.views, view); |
| 848 |
if(index != -1){ |
| 849 |
var oldView = this.get("currentView"); |
| 850 |
this._currentViewIndex = index; |
| 851 |
this._set("currentView", view); |
| 852 |
|
| 853 |
this._showView(oldView, view); |
| 854 |
this.onCurrentViewChange({ |
| 855 |
oldView: oldView, |
| 856 |
newView: view |
| 857 |
}); |
| 858 |
} |
| 859 |
}, |
| 860 |
|
| 861 |
_getCurrentViewAttr: function(){ |
| 862 |
return this.views[this._currentViewIndex]; |
| 863 |
}, |
| 864 |
|
| 865 |
onCurrentViewChange: function(e){ |
| 866 |
|
| 867 |
|
| 868 |
|
| 869 |
|
| 870 |
|
| 871 |
|
| 872 |
|
| 873 |
}, |
| 874 |
|
| 875 |
_configureView: function(view, index, timeInterval, duration){ |
| 876 |
|
| 877 |
|
| 878 |
|
| 879 |
|
| 880 |
|
| 881 |
|
| 882 |
|
| 883 |
|
| 884 |
|
| 885 |
|
| 886 |
|
| 887 |
|
| 888 |
|
| 889 |
|
| 890 |
|
| 891 |
|
| 892 |
|
| 893 |
var cal = this.dateModule; |
| 894 |
if(view.viewKind == "columns"){ |
| 895 |
view.set("startDate", timeInterval[0]); |
| 896 |
view.set("columnCount", duration); |
| 897 |
}else if(view.viewKind == "matrix"){ |
| 898 |
if(duration > 7){ |
| 899 |
var s = this.floorToWeek(timeInterval[0]); |
| 900 |
var e = this.floorToWeek(timeInterval[1]); |
| 901 |
if(cal.compare(e, timeInterval[1]) != 0){ |
| 902 |
e = this.dateModule.add(e, "week", 1); |
| 903 |
} |
| 904 |
duration = this.dateModule.difference(s, e, "day"); |
| 905 |
view.set("startDate", s); |
| 906 |
view.set("columnCount", 7); |
| 907 |
view.set("rowCount", Math.ceil(duration/7)); |
| 908 |
view.set("refStartTime", timeInterval[0]); |
| 909 |
view.set("refEndTime", timeInterval[1]); |
| 910 |
}else{ |
| 911 |
view.set("startDate", timeInterval[0]); |
| 912 |
view.set("columnCount", duration); |
| 913 |
view.set("rowCount", 1); |
| 914 |
view.set("refStartTime", null); |
| 915 |
view.set("refEndTime", null); |
| 916 |
} |
| 917 |
} |
| 918 |
}, |
| 919 |
|
| 920 |
_computeCurrentView: function(startDate, endDate, duration){ |
| 921 |
|
| 922 |
|
| 923 |
|
| 924 |
|
| 925 |
|
| 926 |
|
| 927 |
|
| 928 |
|
| 929 |
|
| 930 |
|
| 931 |
|
| 932 |
|
| 933 |
|
| 934 |
return duration <= 7 ? this.columnView : this.matrixView; |
| 935 |
}, |
| 936 |
|
| 937 |
matrixViewRowHeaderClick: function(e){ |
| 938 |
|
| 939 |
|
| 940 |
|
| 941 |
|
| 942 |
|
| 943 |
|
| 944 |
|
| 945 |
|
| 946 |
|
| 947 |
|
| 948 |
|
| 949 |
var expIndex = this.matrixView.getExpandedRowIndex(); |
| 950 |
if(expIndex == e.index){ |
| 951 |
this.matrixView.collapseRow(); |
| 952 |
}else if(expIndex == -1){ |
| 953 |
this.matrixView.expandRow(e.index); |
| 954 |
}else{ |
| 955 |
var h = this.matrixView.on("expandAnimationEnd", lang.hitch(this, function(){ |
| 956 |
h.remove(); |
| 957 |
this.matrixView.expandRow(e.index); |
| 958 |
})); |
| 959 |
this.matrixView.collapseRow(); |
| 960 |
} |
| 961 |
}, |
| 962 |
|
| 963 |
columnViewColumnHeaderClick: function(e){ |
| 964 |
|
| 965 |
|
| 966 |
|
| 967 |
|
| 968 |
|
| 969 |
|
| 970 |
|
| 971 |
|
| 972 |
var cal = this.dateModule; |
| 973 |
if(cal.compare(e.date, this._timeInterval[0]) == 0 && this.dateInterval == "day" && this.dateIntervalSteps == 1){ |
| 974 |
this.set("dateInterval", "week"); |
| 975 |
}else{ |
| 976 |
this.set("date", e.date); |
| 977 |
this.set("dateInterval", "day"); |
| 978 |
this.set("dateIntervalSteps", 1); |
| 979 |
} |
| 980 |
}, |
| 981 |
|
| 982 |
|
| 983 |
|
| 984 |
viewChangeDuration: 0, |
| 985 |
|
| 986 |
_showView: function(oldView, newView){ |
| 987 |
|
| 988 |
|
| 989 |
|
| 990 |
|
| 991 |
|
| 992 |
|
| 993 |
|
| 994 |
|
| 995 |
|
| 996 |
if(oldView != null){ |
| 997 |
domStyle.set(oldView.domNode, "display", "none"); |
| 998 |
} |
| 999 |
if(newView != null){ |
| 1000 |
domStyle.set(newView.domNode, "display", "block"); |
| 1001 |
newView.resize(); |
| 1002 |
if(!has("ie") || has("ie") > 7){ |
| 1003 |
domStyle.set(newView.domNode, "opacity", "1"); |
| 1004 |
} |
| 1005 |
} |
| 1006 |
}, |
| 1007 |
|
| 1008 |
|
| 1009 |
|
| 1010 |
|
| 1011 |
|
| 1012 |
|
| 1013 |
|
| 1014 |
_setItemsAttr: function(value){ |
| 1015 |
this._set("items", value); |
| 1016 |
if(this.currentView){ |
| 1017 |
this.currentView.set("items", value); |
| 1018 |
if(!this._isEditing){ |
| 1019 |
this.currentView.invalidateRendering(); |
| 1020 |
} |
| 1021 |
} |
| 1022 |
}, |
| 1023 |
|
| 1024 |
_setDecorationItemsAttr: function(value){ |
| 1025 |
this._set("decorationItems", value); |
| 1026 |
if(this.currentView){ |
| 1027 |
this.currentView.set("decorationItems", value); |
| 1028 |
this.currentView.invalidateRendering(); |
| 1029 |
} |
| 1030 |
}, |
| 1031 |
|
| 1032 |
_setDecorationStoreAttr: function(value){ |
| 1033 |
this._set("decorationStore", value); |
| 1034 |
this.decorationStore = value; |
| 1035 |
this.decorationStoreManager.set("store", value); |
| 1036 |
}, |
| 1037 |
|
| 1038 |
|
| 1039 |
|
| 1040 |
|
| 1041 |
|
| 1042 |
|
| 1043 |
|
| 1044 |
floorToDay: function(date, reuse){ |
| 1045 |
|
| 1046 |
|
| 1047 |
|
| 1048 |
|
| 1049 |
|
| 1050 |
|
| 1051 |
|
| 1052 |
return timeUtil.floorToDay(date, reuse, this.dateClassObj); |
| 1053 |
}, |
| 1054 |
|
| 1055 |
floorToWeek: function(d){ |
| 1056 |
|
| 1057 |
|
| 1058 |
|
| 1059 |
|
| 1060 |
return timeUtil.floorToWeek(d, this.dateClassObj, this.dateModule, this.firstDayOfWeek, this.locale); |
| 1061 |
}, |
| 1062 |
|
| 1063 |
newDate: function(obj){ |
| 1064 |
|
| 1065 |
|
| 1066 |
|
| 1067 |
|
| 1068 |
|
| 1069 |
|
| 1070 |
|
| 1071 |
return timeUtil.newDate(obj, this.dateClassObj); |
| 1072 |
}, |
| 1073 |
|
| 1074 |
isToday: function(date){ |
| 1075 |
|
| 1076 |
|
| 1077 |
|
| 1078 |
|
| 1079 |
|
| 1080 |
|
| 1081 |
|
| 1082 |
return timeUtil.isToday(date, this.dateClassObj); |
| 1083 |
}, |
| 1084 |
|
| 1085 |
isStartOfDay: function(d){ |
| 1086 |
|
| 1087 |
|
| 1088 |
|
| 1089 |
|
| 1090 |
|
| 1091 |
return timeUtil.isStartOfDay(d, this.dateClassObj, this.dateModule); |
| 1092 |
}, |
| 1093 |
|
| 1094 |
floorDate: function(date, unit, steps, reuse){ |
| 1095 |
|
| 1096 |
|
| 1097 |
|
| 1098 |
|
| 1099 |
|
| 1100 |
|
| 1101 |
|
| 1102 |
|
| 1103 |
|
| 1104 |
|
| 1105 |
|
| 1106 |
return timeUtil.floor(date, unit, steps, reuse, this.classFuncObj); |
| 1107 |
}, |
| 1108 |
|
| 1109 |
isOverlapping: function(renderData, start1, end1, start2, end2, includeLimits){ |
| 1110 |
|
| 1111 |
|
| 1112 |
|
| 1113 |
|
| 1114 |
|
| 1115 |
|
| 1116 |
|
| 1117 |
|
| 1118 |
|
| 1119 |
|
| 1120 |
|
| 1121 |
|
| 1122 |
|
| 1123 |
|
| 1124 |
|
| 1125 |
|
| 1126 |
return timeUtil.isOverlapping(renderData, start1, end1, start2, end2, includeLimits); |
| 1127 |
}, |
| 1128 |
|
| 1129 |
|
| 1130 |
|
| 1131 |
|
| 1132 |
|
| 1133 |
|
| 1134 |
|
| 1135 |
|
| 1136 |
|
| 1137 |
|
| 1138 |
animateRange: true, |
| 1139 |
|
| 1140 |
|
| 1141 |
|
| 1142 |
animationRangeDuration: 400, |
| 1143 |
|
| 1144 |
_animateRange : function(node, toLeft, fadeIn, xFrom, xTo, onEnd){ |
| 1145 |
|
| 1146 |
|
| 1147 |
|
| 1148 |
|
| 1149 |
|
| 1150 |
|
| 1151 |
|
| 1152 |
|
| 1153 |
|
| 1154 |
|
| 1155 |
|
| 1156 |
|
| 1157 |
|
| 1158 |
|
| 1159 |
|
| 1160 |
|
| 1161 |
if(this.animateRangeTimer){ |
| 1162 |
clearTimeout(this.animateRangeTimer); |
| 1163 |
delete this.animateRangeTimer; |
| 1164 |
} |
| 1165 |
|
| 1166 |
var fadeFunc = fadeIn ? coreFx.fadeIn : coreFx.fadeOut; |
| 1167 |
domStyle.set(node, {left: xFrom + "px", right: (-xFrom) + "px"}); |
| 1168 |
|
| 1169 |
fx.combine([ |
| 1170 |
coreFx.animateProperty({ |
| 1171 |
node: node, |
| 1172 |
properties: {left: xTo, right: -xTo}, |
| 1173 |
duration: this.animationRangeDuration/2, |
| 1174 |
onEnd: onEnd |
| 1175 |
}), |
| 1176 |
fadeFunc({node: node, duration: this.animationRangeDuration/2}) |
| 1177 |
]).play(); |
| 1178 |
}, |
| 1179 |
|
| 1180 |
|
| 1181 |
|
| 1182 |
|
| 1183 |
|
| 1184 |
|
| 1185 |
|
| 1186 |
_animRangeOutDir: null, |
| 1187 |
|
| 1188 |
|
| 1189 |
|
| 1190 |
|
| 1191 |
|
| 1192 |
|
| 1193 |
|
| 1194 |
_animRangeOutDir: null, |
| 1195 |
|
| 1196 |
nextRange: function(){ |
| 1197 |
this._animRangeOutDir = "left"; |
| 1198 |
this._animRangeInDir = "right"; |
| 1199 |
this._navigate(1); |
| 1200 |
}, |
| 1201 |
|
| 1202 |
previousRange: function(){ |
| 1203 |
this._animRangeOutDir = "right"; |
| 1204 |
this._animRangeInDir = "left"; |
| 1205 |
this._navigate(-1); |
| 1206 |
}, |
| 1207 |
|
| 1208 |
_navigate: function(dir){ |
| 1209 |
|
| 1210 |
|
| 1211 |
|
| 1212 |
var d = this.get("date"); |
| 1213 |
var cal = this.dateModule; |
| 1214 |
|
| 1215 |
if(d == null){ |
| 1216 |
var s = this.get("startDate"); |
| 1217 |
var e = this.get("endDate"); |
| 1218 |
var dur = cal.difference(s, e, "day"); |
| 1219 |
if(dir == 1){ |
| 1220 |
e = cal.add(e, "day", 1); |
| 1221 |
this.set("startDate", e); |
| 1222 |
this.set("endDate", cal.add(e, "day", dur)); |
| 1223 |
}else{ |
| 1224 |
s = cal.add(s, "day", -1); |
| 1225 |
this.set("startDate", cal.add(s, "day", -dur)); |
| 1226 |
this.set("endDate", s); |
| 1227 |
} |
| 1228 |
}else{ |
| 1229 |
var di = this.get("dateInterval"); |
| 1230 |
var dis = this.get("dateIntervalSteps"); |
| 1231 |
this.set("date", cal.add(d, di, dir * dis)); |
| 1232 |
} |
| 1233 |
}, |
| 1234 |
|
| 1235 |
goToday: function(){ |
| 1236 |
|
| 1237 |
|
| 1238 |
|
| 1239 |
|
| 1240 |
this.set("date", this.floorToDay(new this.dateClassObj(), true)); |
| 1241 |
this.set("dateInterval", "day"); |
| 1242 |
this.set("dateIntervalSteps", 1); |
| 1243 |
}, |
| 1244 |
|
| 1245 |
|
| 1246 |
|
| 1247 |
|
| 1248 |
|
| 1249 |
|
| 1250 |
|
| 1251 |
postCreate: function(){ |
| 1252 |
this.inherited(arguments); |
| 1253 |
this.configureButtons(); |
| 1254 |
}, |
| 1255 |
|
| 1256 |
configureButtons: function(){ |
| 1257 |
|
| 1258 |
|
| 1259 |
|
| 1260 |
|
| 1261 |
|
| 1262 |
var rtl = !this.isLeftToRight(); |
| 1263 |
|
| 1264 |
if(this.previousButton){ |
| 1265 |
this.previousButton.set("label", _nls[rtl?"nextButton":"previousButton"]); |
| 1266 |
this.own( |
| 1267 |
on(this.previousButton, "click", lang.hitch(this, this.previousRange)) |
| 1268 |
); |
| 1269 |
} |
| 1270 |
|
| 1271 |
if(this.nextButton){ |
| 1272 |
this.nextButton.set("label", _nls[rtl?"previousButton":"nextButton"]); |
| 1273 |
this.own( |
| 1274 |
on(this.nextButton, "click", lang.hitch(this, this.nextRange)) |
| 1275 |
); |
| 1276 |
} |
| 1277 |
|
| 1278 |
if(rtl && this.previousButton && this.nextButton){ |
| 1279 |
var t = this.previousButton; |
| 1280 |
this.previousButton = this.nextButton; |
| 1281 |
this.nextButton = t; |
| 1282 |
} |
| 1283 |
|
| 1284 |
if(this.todayButton){ |
| 1285 |
this.todayButton.set("label", _nls.todayButton); |
| 1286 |
this.own( |
| 1287 |
on(this.todayButton, "click", lang.hitch(this, this.todayButtonClick)) |
| 1288 |
); |
| 1289 |
} |
| 1290 |
|
| 1291 |
if(this.dayButton){ |
| 1292 |
this.dayButton.set("label", _nls.dayButton); |
| 1293 |
this.own( |
| 1294 |
on(this.dayButton, "click", lang.hitch(this, this.dayButtonClick)) |
| 1295 |
); |
| 1296 |
} |
| 1297 |
|
| 1298 |
if(this.weekButton){ |
| 1299 |
this.weekButton.set("label", _nls.weekButton); |
| 1300 |
this.own( |
| 1301 |
on(this.weekButton, "click", lang.hitch(this, this.weekButtonClick)) |
| 1302 |
); |
| 1303 |
} |
| 1304 |
|
| 1305 |
if(this.fourDaysButton){ |
| 1306 |
this.fourDaysButton.set("label", _nls.fourDaysButton); |
| 1307 |
this.own( |
| 1308 |
on(this.fourDaysButton, "click", lang.hitch(this, this.fourDaysButtonClick)) |
| 1309 |
); |
| 1310 |
} |
| 1311 |
|
| 1312 |
if(this.monthButton){ |
| 1313 |
this.monthButton.set("label", _nls.monthButton); |
| 1314 |
this.own( |
| 1315 |
on(this.monthButton, "click", lang.hitch(this, this.monthButtonClick)) |
| 1316 |
); |
| 1317 |
} |
| 1318 |
}, |
| 1319 |
|
| 1320 |
todayButtonClick: function(e){ |
| 1321 |
|
| 1322 |
|
| 1323 |
|
| 1324 |
|
| 1325 |
this.goToday(); |
| 1326 |
}, |
| 1327 |
dayButtonClick: function(e){ |
| 1328 |
|
| 1329 |
|
| 1330 |
|
| 1331 |
|
| 1332 |
|
| 1333 |
if(this.get("date") == null){ |
| 1334 |
this.set("date", this.floorToDay(new this.dateClassObj(), true)); |
| 1335 |
} |
| 1336 |
this.set("dateInterval", "day"); |
| 1337 |
this.set("dateIntervalSteps", 1); |
| 1338 |
}, |
| 1339 |
|
| 1340 |
weekButtonClick: function(e){ |
| 1341 |
|
| 1342 |
|
| 1343 |
|
| 1344 |
|
| 1345 |
this.set("dateInterval", "week"); |
| 1346 |
this.set("dateIntervalSteps", 1); |
| 1347 |
}, |
| 1348 |
fourDaysButtonClick: function(e){ |
| 1349 |
|
| 1350 |
|
| 1351 |
|
| 1352 |
|
| 1353 |
this.set("dateInterval", "day"); |
| 1354 |
this.set("dateIntervalSteps", 4); |
| 1355 |
}, |
| 1356 |
monthButtonClick: function(e){ |
| 1357 |
|
| 1358 |
|
| 1359 |
|
| 1360 |
|
| 1361 |
this.set("dateInterval", "month"); |
| 1362 |
this.set("dateIntervalSteps", 1); |
| 1363 |
}, |
| 1364 |
|
| 1365 |
|
| 1366 |
|
| 1367 |
|
| 1368 |
|
| 1369 |
|
| 1370 |
|
| 1371 |
updateRenderers: function(obj, stateOnly){ |
| 1372 |
if(this.currentView){ |
| 1373 |
this.currentView.updateRenderers(obj, stateOnly); |
| 1374 |
} |
| 1375 |
}, |
| 1376 |
|
| 1377 |
getIdentity: function(item){ |
| 1378 |
return item ? item.id : null; |
| 1379 |
}, |
| 1380 |
|
| 1381 |
_setHoveredItem: function(item, renderer){ |
| 1382 |
if(this.hoveredItem && item && this.hoveredItem.id != item.id || |
| 1383 |
item == null || this.hoveredItem == null){ |
| 1384 |
var old = this.hoveredItem; |
| 1385 |
this.hoveredItem = item; |
| 1386 |
|
| 1387 |
this.updateRenderers([old, this.hoveredItem], true); |
| 1388 |
|
| 1389 |
if(item && renderer){ |
| 1390 |
this.currentView._updateEditingCapabilities(item._item ? item._item : item, renderer); |
| 1391 |
} |
| 1392 |
} |
| 1393 |
}, |
| 1394 |
|
| 1395 |
|
| 1396 |
|
| 1397 |
hoveredItem: null, |
| 1398 |
|
| 1399 |
isItemHovered: function(item){ |
| 1400 |
|
| 1401 |
|
| 1402 |
|
| 1403 |
|
| 1404 |
|
| 1405 |
return this.hoveredItem != null && this.hoveredItem.id == item.id; |
| 1406 |
}, |
| 1407 |
|
| 1408 |
|
| 1409 |
|
| 1410 |
|
| 1411 |
|
| 1412 |
|
| 1413 |
|
| 1414 |
isItemEditable: function(item, rendererKind){ |
| 1415 |
|
| 1416 |
|
| 1417 |
|
| 1418 |
|
| 1419 |
|
| 1420 |
|
| 1421 |
|
| 1422 |
|
| 1423 |
return this.editable; |
| 1424 |
}, |
| 1425 |
|
| 1426 |
isItemMoveEnabled: function(item, rendererKind){ |
| 1427 |
|
| 1428 |
|
| 1429 |
|
| 1430 |
|
| 1431 |
|
| 1432 |
|
| 1433 |
|
| 1434 |
|
| 1435 |
return this.isItemEditable(item, rendererKind) && this.moveEnabled; |
| 1436 |
}, |
| 1437 |
|
| 1438 |
isItemResizeEnabled: function(item, rendererKind){ |
| 1439 |
|
| 1440 |
|
| 1441 |
|
| 1442 |
|
| 1443 |
|
| 1444 |
|
| 1445 |
|
| 1446 |
|
| 1447 |
|
| 1448 |
return this.isItemEditable(item, rendererKind) && this.resizeEnabled; |
| 1449 |
}, |
| 1450 |
|
| 1451 |
|
| 1452 |
|
| 1453 |
|
| 1454 |
|
| 1455 |
|
| 1456 |
|
| 1457 |
|
| 1458 |
onGridClick: function(e){ |
| 1459 |
|
| 1460 |
|
| 1461 |
|
| 1462 |
|
| 1463 |
|
| 1464 |
|
| 1465 |
|
| 1466 |
}, |
| 1467 |
|
| 1468 |
onGridDoubleClick: function(e){ |
| 1469 |
|
| 1470 |
|
| 1471 |
|
| 1472 |
|
| 1473 |
|
| 1474 |
|
| 1475 |
}, |
| 1476 |
|
| 1477 |
onItemClick: function(e){ |
| 1478 |
|
| 1479 |
|
| 1480 |
|
| 1481 |
|
| 1482 |
|
| 1483 |
|
| 1484 |
}, |
| 1485 |
|
| 1486 |
onItemDoubleClick: function(e){ |
| 1487 |
|
| 1488 |
|
| 1489 |
|
| 1490 |
|
| 1491 |
|
| 1492 |
|
| 1493 |
}, |
| 1494 |
|
| 1495 |
onItemContextMenu: function(e){ |
| 1496 |
|
| 1497 |
|
| 1498 |
|
| 1499 |
|
| 1500 |
|
| 1501 |
|
| 1502 |
}, |
| 1503 |
|
| 1504 |
onItemEditBegin: function(e){ |
| 1505 |
|
| 1506 |
|
| 1507 |
|
| 1508 |
|
| 1509 |
|
| 1510 |
|
| 1511 |
}, |
| 1512 |
|
| 1513 |
onItemEditEnd: function(e){ |
| 1514 |
|
| 1515 |
|
| 1516 |
|
| 1517 |
|
| 1518 |
|
| 1519 |
|
| 1520 |
}, |
| 1521 |
|
| 1522 |
onItemEditBeginGesture: function(e){ |
| 1523 |
|
| 1524 |
|
| 1525 |
|
| 1526 |
|
| 1527 |
|
| 1528 |
|
| 1529 |
}, |
| 1530 |
|
| 1531 |
onItemEditMoveGesture: function(e){ |
| 1532 |
|
| 1533 |
|
| 1534 |
|
| 1535 |
|
| 1536 |
|
| 1537 |
|
| 1538 |
}, |
| 1539 |
|
| 1540 |
onItemEditResizeGesture: function(e){ |
| 1541 |
|
| 1542 |
|
| 1543 |
|
| 1544 |
|
| 1545 |
|
| 1546 |
|
| 1547 |
}, |
| 1548 |
|
| 1549 |
onItemEditEndGesture: function(e){ |
| 1550 |
|
| 1551 |
|
| 1552 |
|
| 1553 |
|
| 1554 |
|
| 1555 |
|
| 1556 |
}, |
| 1557 |
|
| 1558 |
onItemRollOver: function(e){ |
| 1559 |
|
| 1560 |
|
| 1561 |
|
| 1562 |
|
| 1563 |
|
| 1564 |
|
| 1565 |
}, |
| 1566 |
|
| 1567 |
onItemRollOut: function(e){ |
| 1568 |
|
| 1569 |
|
| 1570 |
|
| 1571 |
|
| 1572 |
|
| 1573 |
|
| 1574 |
}, |
| 1575 |
|
| 1576 |
onColumnHeaderClick: function(e){ |
| 1577 |
|
| 1578 |
|
| 1579 |
|
| 1580 |
|
| 1581 |
|
| 1582 |
|
| 1583 |
}, |
| 1584 |
|
| 1585 |
onRowHeaderClick: function(e){ |
| 1586 |
|
| 1587 |
|
| 1588 |
|
| 1589 |
|
| 1590 |
|
| 1591 |
|
| 1592 |
}, |
| 1593 |
|
| 1594 |
onExpandRendererClick: function(e){ |
| 1595 |
|
| 1596 |
|
| 1597 |
|
| 1598 |
|
| 1599 |
|
| 1600 |
|
| 1601 |
}, |
| 1602 |
|
| 1603 |
_onRendererCreated: function(e){ |
| 1604 |
this.onRendererCreated(e); |
| 1605 |
}, |
| 1606 |
|
| 1607 |
onRendererCreated: function(e){ |
| 1608 |
|
| 1609 |
|
| 1610 |
|
| 1611 |
|
| 1612 |
|
| 1613 |
|
| 1614 |
}, |
| 1615 |
|
| 1616 |
_onRendererRecycled: function(e){ |
| 1617 |
this.onRendererRecycled(e); |
| 1618 |
}, |
| 1619 |
|
| 1620 |
onRendererRecycled: function(e){ |
| 1621 |
|
| 1622 |
|
| 1623 |
|
| 1624 |
|
| 1625 |
|
| 1626 |
|
| 1627 |
}, |
| 1628 |
|
| 1629 |
_onRendererReused: function(e){ |
| 1630 |
this.onRendererReused(e); |
| 1631 |
}, |
| 1632 |
|
| 1633 |
onRendererReused: function(e){ |
| 1634 |
|
| 1635 |
|
| 1636 |
|
| 1637 |
|
| 1638 |
|
| 1639 |
|
| 1640 |
}, |
| 1641 |
|
| 1642 |
_onRendererDestroyed: function(e){ |
| 1643 |
this.onRendererDestroyed(e); |
| 1644 |
}, |
| 1645 |
|
| 1646 |
onRendererDestroyed: function(e){ |
| 1647 |
|
| 1648 |
|
| 1649 |
|
| 1650 |
|
| 1651 |
|
| 1652 |
|
| 1653 |
}, |
| 1654 |
|
| 1655 |
_onRenderersLayoutDone: function(view){ |
| 1656 |
this.onRenderersLayoutDone(view); |
| 1657 |
}, |
| 1658 |
|
| 1659 |
onRenderersLayoutDone: function(view){ |
| 1660 |
|
| 1661 |
|
| 1662 |
|
| 1663 |
|
| 1664 |
|
| 1665 |
|
| 1666 |
} |
| 1667 |
|
| 1668 |
}); |
| 1669 |
}); |