(scheduler2)
| 11115 | } }; |
| 11116 | } |
| 11117 | function scheduler_node(scheduler2) { |
| 11118 | scheduler2.$keyboardNavigation.SchedulerNode = function() { |
| 11119 | }; |
| 11120 | scheduler2.$keyboardNavigation.SchedulerNode.prototype = scheduler2._compose(scheduler2.$keyboardNavigation.EventHandler, { getDefaultNode: function() { |
| 11121 | var node = new scheduler2.$keyboardNavigation.TimeSlot(); |
| 11122 | if (!node.isValid()) { |
| 11123 | node = node.fallback(); |
| 11124 | } |
| 11125 | return node; |
| 11126 | }, _modes: { month: "month", year: "year", dayColumns: "dayColumns", timeline: "timeline", units: "units", weekAgenda: "weekAgenda", list: "list" }, getMode: function() { |
| 11127 | var state = scheduler2.getState(); |
| 11128 | var mode = state.mode; |
| 11129 | if (scheduler2.matrix && scheduler2.matrix[mode]) { |
| 11130 | return this._modes.timeline; |
| 11131 | } else if (scheduler2._props && scheduler2._props[mode]) { |
| 11132 | return this._modes.units; |
| 11133 | } else if (mode == "month") { |
| 11134 | return this._modes.month; |
| 11135 | } else if (mode == "year") { |
| 11136 | return this._modes.year; |
| 11137 | } else if (mode == "week_agenda") { |
| 11138 | return this._modes.weekAgenda; |
| 11139 | } else if (mode == "map" || mode == "agenda" || scheduler2._grid && scheduler2["grid_" + mode]) { |
| 11140 | return this._modes.list; |
| 11141 | } else { |
| 11142 | return this._modes.dayColumns; |
| 11143 | } |
| 11144 | }, focus: function() { |
| 11145 | scheduler2.focus(); |
| 11146 | }, blur: function() { |
| 11147 | }, disable: function() { |
| 11148 | scheduler2.$container.setAttribute("tabindex", "0"); |
| 11149 | }, enable: function() { |
| 11150 | if (scheduler2.$container) |
| 11151 | scheduler2.$container.removeAttribute("tabindex"); |
| 11152 | }, isEnabled: function() { |
| 11153 | return scheduler2.$container.hasAttribute("tabindex"); |
| 11154 | }, _compareEvents: function(a, b) { |
| 11155 | if (a.start_date.valueOf() == b.start_date.valueOf()) |
| 11156 | return a.id > b.id ? 1 : -1; |
| 11157 | return a.start_date.valueOf() > b.start_date.valueOf() ? 1 : -1; |
| 11158 | }, _pickEvent: function(from, to, startId, reverse) { |
| 11159 | var range2 = scheduler2.getState(); |
| 11160 | from = new Date(Math.max(range2.min_date.valueOf(), from.valueOf())); |
| 11161 | to = new Date(Math.min(range2.max_date.valueOf(), to.valueOf())); |
| 11162 | var evs = scheduler2.getEvents(from, to); |
| 11163 | evs.sort(this._compareEvents); |
| 11164 | if (reverse) { |
| 11165 | evs = evs.reverse(); |
| 11166 | } |
| 11167 | var trim = !!startId; |
| 11168 | for (var i = 0; i < evs.length && trim; i++) { |
| 11169 | if (evs[i].id == startId) { |
| 11170 | trim = false; |
| 11171 | } |
| 11172 | evs.splice(i, 1); |
| 11173 | i--; |
| 11174 | } |
no test coverage detected