diff --git a/apps/common/main/lib/component/FocusManager.js b/apps/common/main/lib/component/FocusManager.js index a10b1bb16..14aeb9e59 100644 --- a/apps/common/main/lib/component/FocusManager.js +++ b/apps/common/main/lib/component/FocusManager.js @@ -128,3 +128,109 @@ Common.UI.FocusManager = function (tabindex, parent) { } } }; + +Common.UI.FocusManager2 = new(function() { + var _tabindex = 1, + _windows = []; + + var register = function(fields) { + var arr = []; + if (!fields.forEach) { + fields = [fields]; + } + fields.forEach(function(field) { + if (field) { + var item = (field.cmp && typeof field.selector == 'string') ? field : {cmp: field, selector: '.form-control'}; + item.el = (item.cmp.$el || $(item.cmp.el)).find(item.selector).addBack().filter(item.selector); + item.el && item.el.attr && item.el.attr('tabindex', _tabindex.toString()); + arr.push(item); + } + }); + return arr; + }; + + var addTraps = function(current) { + if (!current || current.traps || !current.fields || current.fields.length<1) return; + + var trapFirst = $(''); + trapFirst.on('focus', function() { + if (current.hidden) return; + var fields = current.fields; + for (var i=0; i