MCPcopy Create free account
hub / github.com/DHTMLX/scheduler / time_slot

Function time_slot

codebase/sources/dhtmlxscheduler.es.js:11472–12039  ·  view source on GitHub ↗
(scheduler2)

Source from the content-addressed store, hash-verified

11470 scheduler2.$keyboardNavigation.Event.prototype.bindAll(scheduler2.$keyboardNavigation.Event.prototype.keys);
11471}
11472function time_slot(scheduler2) {
11473 scheduler2.$keyboardNavigation.TimeSlot = function(from, to, section, movingDate) {
11474 var state = scheduler2.getState();
11475 var timeline = scheduler2.matrix && scheduler2.matrix[state.mode];
11476 if (!from) {
11477 from = this.getDefaultDate();
11478 }
11479 if (!to) {
11480 if (timeline) {
11481 to = scheduler2.date.add(from, timeline.x_step, timeline.x_unit);
11482 } else {
11483 to = scheduler2.date.add(from, scheduler2.config.key_nav_step, "minute");
11484 }
11485 }
11486 this.section = section || this._getDefaultSection();
11487 this.start_date = new Date(from);
11488 this.end_date = new Date(to);
11489 this.movingDate = movingDate || null;
11490 };
11491 scheduler2.$keyboardNavigation.TimeSlot.prototype = scheduler2._compose(scheduler2.$keyboardNavigation.KeyNavNode, { _handlers: null, getDefaultDate: function() {
11492 var from;
11493 var state = scheduler2.getState();
11494 var visibleTime = new Date(state.date);
11495 visibleTime.setSeconds(0);
11496 visibleTime.setMilliseconds(0);
11497 var nowTime = /* @__PURE__ */ new Date();
11498 nowTime.setSeconds(0);
11499 nowTime.setMilliseconds(0);
11500 var timeline = scheduler2.matrix && scheduler2.matrix[state.mode];
11501 var showNowTime = false;
11502 if (visibleTime.valueOf() === nowTime.valueOf()) {
11503 showNowTime = true;
11504 }
11505 if (timeline) {
11506 if (showNowTime) {
11507 if (timeline.x_unit === "day") {
11508 nowTime.setHours(0);
11509 nowTime.setMinutes(0);
11510 } else if (timeline.x_unit === "hour") {
11511 nowTime.setMinutes(0);
11512 }
11513 from = nowTime;
11514 } else {
11515 from = scheduler2.date[timeline.name + "_start"](new Date(state.date));
11516 }
11517 from = this.findVisibleColumn(from);
11518 } else {
11519 from = new Date(scheduler2.getState().min_date);
11520 if (showNowTime) {
11521 from = nowTime;
11522 }
11523 from = this.findVisibleColumn(from);
11524 if (!showNowTime) {
11525 from.setHours(scheduler2.config.first_hour);
11526 }
11527 if (!scheduler2._table_view) {
11528 var dataContainer = scheduler2.$container.querySelector(".dhx_cal_data");
11529 if (dataContainer.scrollTop) {

Callers 1

key_navFunction · 0.70

Calls 8

getStateMethod · 0.65
addMethod · 0.65
getViewMethod · 0.65
renderMethod · 0.65
day_startMethod · 0.65
date_partMethod · 0.65
setCurrentViewMethod · 0.65
addEventNowMethod · 0.65

Tested by

no test coverage detected