commit
b3553013cf
|
@ -997,23 +997,27 @@ jQuery.fn.extend({
|
||||||
var _el = document.getElementById(id.substring(1));
|
var _el = document.getElementById(id.substring(1));
|
||||||
if ( !_el ) {
|
if ( !_el ) {
|
||||||
parent = parent || this;
|
parent = parent || this;
|
||||||
if ( parent instanceof jQuery ) {
|
if ( parent && parent.length > 0 ) {
|
||||||
parent.each(function (i, node) {
|
parent.each(function (i, node) {
|
||||||
_el = node.querySelectorAll(id);
|
if (node.querySelectorAll) {
|
||||||
if ( _el.length == 0 ) {
|
_el = node.querySelectorAll(id);
|
||||||
if ( ('#' + node.id) == id ) {
|
if ( _el.length == 0 ) {
|
||||||
_el = node;
|
if ( ('#' + node.id) == id ) {
|
||||||
|
_el = node;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if ( _el.length ) {
|
||||||
|
_el = _el[0];
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
if ( _el.length ) {
|
|
||||||
_el = _el[0];
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
_el = parent.querySelectorAll(id);
|
if (parent && parent.querySelectorAll) {
|
||||||
if ( _el && _el.length ) return _el[0];
|
_el = parent.querySelectorAll(id);
|
||||||
|
if ( _el && _el.length ) return _el[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2143,9 +2143,29 @@ define([
|
||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
|
|
||||||
onTableTplMenuOpen: function(cmp) {
|
onTableTplMenuOpen: function(menu) {
|
||||||
this.onApiInitTableTemplates(this.api.asc_getTablePictures(this.api.asc_getCellInfo().asc_getFormatTableInfo()));
|
this.onApiInitTableTemplates(this.api.asc_getTablePictures(this.api.asc_getCellInfo().asc_getFormatTableInfo()));
|
||||||
|
|
||||||
|
if (menu && this.toolbar.mnuTableTemplatePicker) {
|
||||||
|
var picker = this.toolbar.mnuTableTemplatePicker,
|
||||||
|
columnCount = 7;
|
||||||
|
|
||||||
|
if (picker.cmpEl) {
|
||||||
|
var itemEl = $(picker.cmpEl.find('.dataview.inner .item-template').get(0)).parent(),
|
||||||
|
itemMargin = 8,
|
||||||
|
itemWidth = itemEl.is(':visible') ? parseFloat(itemEl.css('width')) : 60;
|
||||||
|
|
||||||
|
var menuWidth = columnCount * (itemMargin + itemWidth) + 11, // for scroller
|
||||||
|
menuMargins = parseFloat(picker.cmpEl.css('margin-left')) + parseFloat(picker.cmpEl.css('margin-right'));
|
||||||
|
if (menuWidth + menuMargins>Common.Utils.innerWidth())
|
||||||
|
menuWidth = Math.max(Math.floor((Common.Utils.innerWidth()-menuMargins-11)/(itemMargin + itemWidth)), 2) * (itemMargin + itemWidth) + 11;
|
||||||
|
picker.cmpEl.css({
|
||||||
|
'width': menuWidth
|
||||||
|
});
|
||||||
|
menu.alignPosition();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var scroller = this.toolbar.mnuTableTemplatePicker.scroller;
|
var scroller = this.toolbar.mnuTableTemplatePicker.scroller;
|
||||||
if (scroller) {
|
if (scroller) {
|
||||||
scroller.update({alwaysVisibleY: true});
|
scroller.update({alwaysVisibleY: true});
|
||||||
|
|
Loading…
Reference in a new issue