Remove unused component
This commit is contained in:
parent
1fa941a435
commit
c7c3008c3a
|
@ -46,90 +46,7 @@ if (Common.UI === undefined) {
|
||||||
Common.UI = {};
|
Common.UI = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
Common.UI.FocusManager = function (tabindex, parent) {
|
Common.UI.FocusManager = new(function() {
|
||||||
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 = $('<span aria-hidden="true" tabindex="' + this.tabindex + '"></span>');
|
|
||||||
this.trapFirst.on('focus', function() {
|
|
||||||
for (var i=0; i<me.fields.length; i++) {
|
|
||||||
var field = me.fields[i];
|
|
||||||
if ((field.cmp.isVisible ? field.cmp.isVisible() : field.cmp.is(':visible')) && !(field.cmp.isDisabled && field.cmp.isDisabled())) {
|
|
||||||
var el = (field.selector) ? (field.cmp.$el || $(field.cmp.el)).find(field.selector).addBack().filter(field.selector) : field.el;
|
|
||||||
el.focus();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.parent.$window.prepend(this.trapFirst);
|
|
||||||
|
|
||||||
this.trapLast = $('<span aria-hidden="true" tabindex="' + (this.tabindex+1) + '"></span>');
|
|
||||||
this.trapLast.on('focus', function() {
|
|
||||||
for (var i=me.fields.length-1; i>=0; i--) {
|
|
||||||
var field = me.fields[i];
|
|
||||||
if ((field.cmp.isVisible ? field.cmp.isVisible() : field.cmp.is(':visible')) && !(field.cmp.isDisabled && field.cmp.isDisabled())) {
|
|
||||||
var el = (field.selector) ? (field.cmp.$el || $(field.cmp.el)).find(field.selector).addBack().filter(field.selector) : field.el;
|
|
||||||
el.focus();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.parent.$window.append(this.trapLast);
|
|
||||||
},
|
|
||||||
|
|
||||||
setTabIndex: function (tabindex) {
|
|
||||||
this.tabindex = tabindex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Common.UI.FocusManager2 = new(function() {
|
|
||||||
var _tabindex = 1,
|
var _tabindex = 1,
|
||||||
_windows = [],
|
_windows = [],
|
||||||
_count = 0;
|
_count = 0;
|
||||||
|
|
|
@ -613,9 +613,6 @@ define([
|
||||||
!this.initConfig.id && (this.initConfig.id = 'window-' + this.cid);
|
!this.initConfig.id && (this.initConfig.id = 'window-' + this.cid);
|
||||||
!this.initConfig.tpl && (this.initConfig.tpl = '');
|
!this.initConfig.tpl && (this.initConfig.tpl = '');
|
||||||
|
|
||||||
if (options.focusManager)
|
|
||||||
this.focusManager = Common.UI.FocusManager(1, this);
|
|
||||||
|
|
||||||
Common.UI.BaseView.prototype.initialize.call(this, this.initConfig);
|
Common.UI.BaseView.prototype.initialize.call(this, this.initConfig);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -282,7 +282,7 @@ define([
|
||||||
me.args[argcount].lblName.html(me.args[argcount].argName);
|
me.args[argcount].lblName.html(me.args[argcount].argName);
|
||||||
me.args[argcount].lblValue.html('= '+ ( argres!==null && argres!==undefined ? argres : '<span style="opacity: 0.6; font-weight: bold;">' + me.args[argcount].argTypeName + '</span>'));
|
me.args[argcount].lblValue.html('= '+ ( argres!==null && argres!==undefined ? argres : '<span style="opacity: 0.6; font-weight: bold;">' + me.args[argcount].argTypeName + '</span>'));
|
||||||
|
|
||||||
Common.UI.FocusManager2.add(this, txt);
|
Common.UI.FocusManager.add(this, txt);
|
||||||
},
|
},
|
||||||
|
|
||||||
onInputChanging: function(input, newValue, oldValue, e) {
|
onInputChanging: function(input, newValue, oldValue, e) {
|
||||||
|
|
Loading…
Reference in a new issue