diff --git a/apps/common/main/lib/component/FocusManager.js b/apps/common/main/lib/component/FocusManager.js index 1557905d1..c1b361446 100644 --- a/apps/common/main/lib/component/FocusManager.js +++ b/apps/common/main/lib/component/FocusManager.js @@ -46,90 +46,7 @@ if (Common.UI === undefined) { Common.UI = {}; } -Common.UI.FocusManager = function (tabindex, parent) { - var register = function(fields, options, tabindex) { - var arr = [], - selector, - el; - if (typeof options==='string') { - selector = options; - } else { - el = options; - } - if (!fields.forEach) { - fields = [fields]; - if (el) - el = [el]; - } - - fields.forEach(function(cmp, index) { - var elem = selector ? (cmp.$el || $(cmp.el)).find(selector).addBack().filter(selector) : (el && el[index] ? el[index] : cmp); - elem && elem.attr && elem.attr('tabindex', tabindex.toString()); - arr.push({ - cmp: cmp, - el: elem, - selector: selector - }); - }); - return arr; - }; - - return { - tabindex: tabindex || 0, - parent: parent, - fields: [], - - add: function(fields, options) { // options may be selector or component.el - this.fields = this.fields.concat(register(fields, options, this.tabindex)); - !this.trapFirst && this.addTraps(); - }, - - insert: function(field, index, options) { - this.fields.splice(index, 0, register(field, options, this.tabindex)); - }, - - remove: function(index) { - this.fields.splice(index, 1); - }, - - addTraps: function() { - if (!this.parent || !this.parent.$window) return; - - var me = this; - this.trapFirst = $(''); - this.trapFirst.on('focus', function() { - for (var i=0; i