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

Function key_nav

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

Source from the content-addressed store, hash-verified

12860 };
12861}
12862function key_nav(scheduler2) {
12863 scheduler2.config.key_nav = true;
12864 scheduler2.config.key_nav_step = 30;
12865 scheduler2.addShortcut = function(shortcut, handler, scope) {
12866 var scopeObject = getScope(scope);
12867 if (scopeObject) {
12868 scopeObject.prototype.bind(shortcut, handler);
12869 }
12870 };
12871 scheduler2.getShortcutHandler = function(shortcut, scope) {
12872 var scopeObject = getScope(scope);
12873 if (scopeObject) {
12874 var commands = scheduler2.$keyboardNavigation.shortcuts.parse(shortcut);
12875 if (commands.length) {
12876 return scopeObject.prototype.findHandler(commands[0]);
12877 }
12878 }
12879 };
12880 scheduler2.removeShortcut = function(shortcut, scope) {
12881 var scopeObject = getScope(scope);
12882 if (scopeObject) {
12883 scopeObject.prototype.unbind(shortcut);
12884 }
12885 };
12886 scheduler2.focus = function() {
12887 if (!scheduler2.config.key_nav) {
12888 return;
12889 }
12890 var disp = scheduler2.$keyboardNavigation.dispatcher;
12891 disp.enable();
12892 var activeNode = disp.getActiveNode();
12893 if (!activeNode || activeNode instanceof scheduler2.$keyboardNavigation.MinicalButton || activeNode instanceof scheduler2.$keyboardNavigation.MinicalCell) {
12894 disp.setDefaultNode();
12895 } else {
12896 disp.focusNode(disp.getActiveNode());
12897 }
12898 };
12899 function getScope(mode) {
12900 var scopes = { minicalButton: scheduler2.$keyboardNavigation.MinicalButton, minicalDate: scheduler2.$keyboardNavigation.MinicalCell, scheduler: scheduler2.$keyboardNavigation.SchedulerNode, dataArea: scheduler2.$keyboardNavigation.DataArea, timeSlot: scheduler2.$keyboardNavigation.TimeSlot, event: scheduler2.$keyboardNavigation.Event };
12901 var searchMap = {};
12902 for (var i in scopes)
12903 searchMap[i.toLowerCase()] = scopes[i];
12904 mode = (mode + "").toLowerCase();
12905 return searchMap[mode] || scopes.scheduler;
12906 }
12907 scheduler2.$keyboardNavigation = {};
12908 scheduler2._compose = function() {
12909 var parts = Array.prototype.slice.call(arguments, 0);
12910 var res = {};
12911 for (var i = 0; i < parts.length; i++) {
12912 var obj = parts[i];
12913 if (typeof obj == "function") {
12914 obj = new obj();
12915 }
12916 for (var p in obj) {
12917 res[p] = obj[p];
12918 }
12919 }

Callers

nothing calls this directly

Calls 15

getScopeFunction · 0.70
keyboard_shortcutsFunction · 0.70
eventhandlerFunction · 0.70
trap_modal_focusFunction · 0.70
markerFunction · 0.70
scheduler_nodeFunction · 0.70
nav_nodeFunction · 0.70
header_cellFunction · 0.70
eventFunction · 0.70
time_slotFunction · 0.70
minical_buttonFunction · 0.70
minical_cellFunction · 0.70

Tested by

no test coverage detected