[SSE] Add examples in customize statusbar menu, fix update width of sheets box

This commit is contained in:
JuliaSvinareva 2020-06-23 22:05:25 +03:00
parent 1c7745666e
commit f539f5cf9e

View file

@ -353,19 +353,64 @@ define([
});
});
var customizeStatusBarMenuTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem">'+
'<div style="position: relative;">'+
'<div style="position: absolute; left: 0; width: 100px;"><%= caption %></div>' +
'<label style="width: 100%; overflow: hidden; text-overflow: ellipsis; text-align: right; vertical-align: bottom; padding-left: 100px; color: silver;cursor: pointer;"><%= options.exampleval ? options.exampleval : "" %></label>' +
'</div></a>');
this.customizeStatusBarMenu = new Common.UI.Menu({
style: 'margin-top: -14px; margin-left: -7px;',
menuAlign: 'bl-tl',
items: [
//{template: _.template('<div style="padding-left: 6px; padding-top: 2px;">' + this.textCustomizeStatusBar + '</div>')},
//{caption: '--'},
{caption: this.itemAverage, value: 'average', checkable: true, checked: true, leaveopen: true},
{caption: this.itemCount, value: 'count', checkable: true, checked: true, leaveopen: true},
{caption: this.itemMinimum, value: 'min', checkable: true, checked: true, leaveopen: true},
{caption: this.itemMaximum, value: 'max', checkable: true, checked: true, leaveopen: true},
{caption: this.itemSum, value: 'sum', checkable: true, checked: true, leaveopen: true}
],
leaveopen: true
{
id: 'math-item-average',
caption: this.itemAverage,
value: 'average',
checkable: true,
checked: true,
template: customizeStatusBarMenuTemplate,
exampleval: ''
},
{
id: 'math-item-count',
caption: this.itemCount,
value: 'count',
checkable: true,
checked: true,
template: customizeStatusBarMenuTemplate,
exampleval: ''
},
{
id: 'math-item-min',
caption: this.itemMinimum,
value: 'min',
checkable: true,
checked: true,
template: customizeStatusBarMenuTemplate,
exampleval: ''
},
{
id: 'math-item-max',
caption: this.itemMaximum,
value: 'max',
checkable: true,
checked: true,
template: customizeStatusBarMenuTemplate,
exampleval: ''
},
{
id: 'math-item-sum',
caption: this.itemSum,
value: 'sum',
checkable: true,
checked: true,
template: customizeStatusBarMenuTemplate,
exampleval: ''
}
]
});
this.tabbar.$el.append('<div class="dropdown-toggle" data-toggle="dropdown" style="width:0; height:0;"></div>');
@ -498,7 +543,28 @@ define([
this.labelMax.text((info.max && info.max.length) ? (this.textMax + ': ' + info.max.substring(0,11) + (info.max.length > 11 ? '...' : '')) : '');
this.labelSum.text((info.sum && info.sum.length) ? (this.textSum + ': ' + info.sum.substring(0,11) + (info.sum.length > 11 ? '...' : '')) : '');
this.labelAverage.text((info.average && info.average.length) ? (this.textAverage + ': ' + info.average.substring(0,11) + (info.average.length > 11 ? '...' : '')) : '');
this.customizeStatusBarMenu.items.forEach(function (item) {
if (item.options.id === 'math-item-average') {
item.options.exampleval = (info.average && info.average.length) ? info.average : '';
} else if (item.options.id === 'math-item-min') {
item.options.exampleval = (info.min && info.min.length) ? info.min : '';
} else if (item.options.id === 'math-item-max') {
item.options.exampleval = (info.max && info.max.length) ? info.max : '';
} else if (item.options.id === 'math-item-count') {
item.options.exampleval = (info.count) ? String(info.count) : '';
} else if (item.options.id === 'math-item-sum') {
item.options.exampleval = (info.sum && info.sum.length) ? info.sum : '';
} else {
item.options.exampleval = '';
}
$(item.el).find('label').text(item.options.exampleval);
});
} else {
this.customizeStatusBarMenu.items.forEach(function (item) {
item.options.exampleval = '';
$(item.el).find('label').text('');
});
if (this.boxMath.is(':visible')) this.boxMath.hide();
}
@ -720,6 +786,7 @@ define([
this.boxMath.find('.separator').show();
}
}
this.updateTabbarBorders();
event.stopPropagation();
item.$el.find('a').blur();
},