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

Function minical_cell

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

Source from the content-addressed store, hash-verified

12081 scheduler2.$keyboardNavigation.MinicalButton.prototype.bindAll(scheduler2.$keyboardNavigation.MinicalButton.prototype.keys);
12082}
12083function minical_cell(scheduler2) {
12084 scheduler2.$keyboardNavigation.MinicalCell = function(div, row, col) {
12085 this.container = div;
12086 this.row = row || 0;
12087 this.col = col || 0;
12088 };
12089 scheduler2.$keyboardNavigation.MinicalCell.prototype = scheduler2._compose(scheduler2.$keyboardNavigation.KeyNavNode, { isValid: function() {
12090 var grid = this._getGrid();
12091 return !!(grid[this.row] && grid[this.row][this.col]);
12092 }, fallback: function() {
12093 var row = this.row;
12094 var col = this.col;
12095 var grid = this._getGrid();
12096 if (!grid[row]) {
12097 row = 0;
12098 }
12099 var dir = true;
12100 if (row > grid.length / 2) {
12101 dir = false;
12102 }
12103 if (!grid[row]) {
12104 var defaultSlot = new scheduler2.$keyboardNavigation.TimeSlot();
12105 if (defaultSlot.isValid()) {
12106 return defaultSlot;
12107 } else {
12108 return new scheduler2.$keyboardNavigation.DataArea();
12109 }
12110 }
12111 if (dir) {
12112 for (var c = col; grid[row] && c < grid[row].length; c++) {
12113 if (!grid[row][c] && c == grid[row].length - 1) {
12114 row++;
12115 col = 0;
12116 }
12117 if (grid[row][c]) {
12118 return new scheduler2.$keyboardNavigation.MinicalCell(this.container, row, c);
12119 }
12120 }
12121 } else {
12122 for (var c = col; grid[row] && c < grid[row].length; c--) {
12123 if (!grid[row][c] && !c) {
12124 row--;
12125 col = grid[row].length - 1;
12126 }
12127 if (grid[row][c]) {
12128 return new scheduler2.$keyboardNavigation.MinicalCell(this.container, row, c);
12129 }
12130 }
12131 }
12132 return new scheduler2.$keyboardNavigation.MinicalButton(this.container, 0);
12133 }, focus: function() {
12134 scheduler2.$keyboardNavigation.dispatcher.globalNode.disable();
12135 this.container.removeAttribute("tabindex");
12136 scheduler2.$keyboardNavigation.KeyNavNode.prototype.focus.apply(this);
12137 }, blur: function() {
12138 this.container.setAttribute("tabindex", "0");
12139 scheduler2.$keyboardNavigation.KeyNavNode.prototype.blur.apply(this);
12140 }, _getNode: function(row, col) {

Callers 1

key_navFunction · 0.70

Calls 1

getNodeMethod · 0.45

Tested by

no test coverage detected