[SSE] Add named ranges button to formula tab
This commit is contained in:
parent
49898f77e3
commit
54335503c4
|
@ -129,6 +129,10 @@ define([
|
|||
'data:sort': this.onSortType,
|
||||
'data:setfilter': this.onAutoFilter,
|
||||
'data:clearfilter': this.onClearFilter
|
||||
},
|
||||
'FormulaTab': {
|
||||
'function:namedrange': this.onNamedRangeMenu,
|
||||
'function:namedrange-open': this.onNamedRangeMenuOpen
|
||||
}
|
||||
});
|
||||
Common.NotificationCenter.on('page:settings', _.bind(this.onApiSheetChanged, this));
|
||||
|
@ -1284,10 +1288,10 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
onNamedRangeMenuOpen: function() {
|
||||
if (this.api) {
|
||||
onNamedRangeMenuOpen: function(menu) {
|
||||
if (this.api && menu) {
|
||||
var names = this.api.asc_getDefinedNames(Asc.c_oAscGetDefinedNamesList.WorksheetWorkbook);
|
||||
this.toolbar.btnNamedRange.menu.items[2].setDisabled(names.length<1);
|
||||
menu.items[2].setDisabled(names.length<1);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1711,7 +1715,7 @@ define([
|
|||
toolbar.btnClearStyle.menu.items[4],
|
||||
toolbar.btnNamedRange.menu.items[0],
|
||||
toolbar.btnNamedRange.menu.items[1]
|
||||
],
|
||||
].concat(toolbar.itemsNamedRange),
|
||||
merge: true,
|
||||
clear: [SSE.enumLock.editFormula, SSE.enumLock.editText]
|
||||
});
|
||||
|
@ -3169,6 +3173,8 @@ define([
|
|||
formulatab.setConfig({toolbar: me});
|
||||
formulatab = formulatab.getView('FormulaTab');
|
||||
me.toolbar.btnsFormula = formulatab.getButtons('formula');
|
||||
var namedRange = formulatab.getButtons('range');
|
||||
me.toolbar.itemsNamedRange = (namedRange && namedRange.menu && namedRange.menu.items) ? [namedRange.menu.items[0], namedRange.menu.items[1]] : [];
|
||||
Array.prototype.push.apply(me.toolbar.lockControls, formulatab.getButtons());
|
||||
|
||||
if ( !config.isOffline ) {
|
||||
|
|
|
@ -179,6 +179,10 @@
|
|||
<span class="btn-slot text x-huge" id="slot-btn-more"></span>
|
||||
</div>
|
||||
<div class="separator long"></div>
|
||||
<div class="group">
|
||||
<span class="btn-slot text x-huge" id="slot-btn-named-range-huge"></span>
|
||||
</div>
|
||||
<div class="separator long"></div>
|
||||
<div class="group">
|
||||
<span class="btn-slot text x-huge" id="slot-btn-calculate"></span>
|
||||
</div>
|
||||
|
|
|
@ -63,6 +63,12 @@ define([
|
|||
me.btnCalculate.menu.on('item:click', function (menu, item, e) {
|
||||
me.fireEvent('function:calculate', [{type: item.value}]);
|
||||
});
|
||||
me.btnNamedRange.menu.on('show:after', function (menu) {
|
||||
me.fireEvent('function:namedrange-open', [menu]);
|
||||
});
|
||||
me.btnNamedRange.menu.on('item:click', function (menu, item, e) {
|
||||
me.fireEvent('function:namedrange', [menu, item, e]);
|
||||
});
|
||||
}
|
||||
return {
|
||||
options: {},
|
||||
|
@ -73,6 +79,7 @@ define([
|
|||
this.formulasGroups = options.formulasGroups;
|
||||
|
||||
this.lockedControls = [];
|
||||
this.formulaControls = [];
|
||||
|
||||
var me = this,
|
||||
$host = me.toolbar.$el,
|
||||
|
@ -92,6 +99,7 @@ define([
|
|||
});
|
||||
Common.Utils.injectComponent($host.find('#slot-btn-financial'), this.btnFinancial);
|
||||
this.lockedControls.push(this.btnFinancial);
|
||||
this.formulaControls.push(this.btnFinancial);
|
||||
|
||||
this.btnLogical = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
|
@ -105,6 +113,7 @@ define([
|
|||
});
|
||||
Common.Utils.injectComponent($host.find('#slot-btn-logical'), this.btnLogical);
|
||||
this.lockedControls.push(this.btnLogical);
|
||||
this.formulaControls.push(this.btnLogical);
|
||||
|
||||
this.btnTextData = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
|
@ -118,6 +127,7 @@ define([
|
|||
});
|
||||
Common.Utils.injectComponent($host.find('#slot-btn-text'), this.btnTextData);
|
||||
this.lockedControls.push(this.btnTextData);
|
||||
this.formulaControls.push(this.btnTextData);
|
||||
|
||||
this.btnDateTime = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
|
@ -131,6 +141,7 @@ define([
|
|||
});
|
||||
Common.Utils.injectComponent($host.find('#slot-btn-datetime'), this.btnDateTime);
|
||||
this.lockedControls.push(this.btnDateTime);
|
||||
this.formulaControls.push(this.btnDateTime);
|
||||
|
||||
this.btnReference = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
|
@ -144,6 +155,7 @@ define([
|
|||
});
|
||||
Common.Utils.injectComponent($host.find('#slot-btn-lookup'), this.btnReference);
|
||||
this.lockedControls.push(this.btnReference);
|
||||
this.formulaControls.push(this.btnReference);
|
||||
|
||||
this.btnMath = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
|
@ -157,6 +169,7 @@ define([
|
|||
});
|
||||
Common.Utils.injectComponent($host.find('#slot-btn-math'), this.btnMath);
|
||||
this.lockedControls.push(this.btnMath);
|
||||
this.formulaControls.push(this.btnMath);
|
||||
|
||||
this.btnRecent = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
|
@ -170,6 +183,7 @@ define([
|
|||
});
|
||||
Common.Utils.injectComponent($host.find('#slot-btn-recent'), this.btnRecent);
|
||||
this.lockedControls.push(this.btnRecent);
|
||||
this.formulaControls.push(this.btnRecent);
|
||||
|
||||
this.btnAutosum = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
|
@ -195,6 +209,7 @@ define([
|
|||
});
|
||||
Common.Utils.injectComponent($host.find('#slot-btn-autosum'), this.btnAutosum);
|
||||
this.lockedControls.push(this.btnAutosum);
|
||||
this.formulaControls.push(this.btnAutosum);
|
||||
|
||||
this.btnFormula = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
|
@ -206,6 +221,7 @@ define([
|
|||
});
|
||||
Common.Utils.injectComponent($host.find('#slot-btn-additional-formula'), this.btnFormula);
|
||||
this.lockedControls.push(this.btnFormula);
|
||||
this.formulaControls.push(this.btnFormula);
|
||||
|
||||
this.btnMore = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
|
@ -219,6 +235,7 @@ define([
|
|||
});
|
||||
Common.Utils.injectComponent($host.find('#slot-btn-more'), this.btnMore);
|
||||
this.lockedControls.push(this.btnMore);
|
||||
this.formulaControls.push(this.btnMore);
|
||||
|
||||
this.btnCalculate = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
|
@ -231,6 +248,37 @@ define([
|
|||
});
|
||||
Common.Utils.injectComponent($host.find('#slot-btn-calculate'), this.btnCalculate);
|
||||
this.lockedControls.push(this.btnCalculate);
|
||||
this.formulaControls.push(this.btnCalculate);
|
||||
|
||||
this.btnNamedRange = new Common.UI.Button({
|
||||
cls : 'btn-toolbar x-huge icon-top',
|
||||
iconCls : 'toolbar__icon btn-named-range',
|
||||
caption: this.toolbar.txtNamedRange,
|
||||
hint: this.toolbar.txtNamedRange,
|
||||
split: false,
|
||||
disabled: true,
|
||||
lock : [_set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.selRangeEdit],
|
||||
menu: new Common.UI.Menu({
|
||||
items: [
|
||||
{
|
||||
caption: me.toolbar.txtManageRange,
|
||||
lock : [_set.editCell],
|
||||
value: 'manage'
|
||||
},
|
||||
{
|
||||
caption: me.toolbar.txtNewRange,
|
||||
lock : [_set.editCell],
|
||||
value: 'new'
|
||||
},
|
||||
{
|
||||
caption: me.toolbar.txtPasteRange,
|
||||
value: 'paste'
|
||||
}
|
||||
]
|
||||
})
|
||||
});
|
||||
Common.Utils.injectComponent($host.find('#slot-btn-named-range-huge'), this.btnNamedRange);
|
||||
this.lockedControls.push(this.btnNamedRange);
|
||||
|
||||
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
||||
},
|
||||
|
@ -265,6 +313,11 @@ define([
|
|||
},
|
||||
|
||||
getButtons: function(type) {
|
||||
if (type == 'formula')
|
||||
return this.formulaControls;
|
||||
else if (type == 'range')
|
||||
return this.btnNamedRange;
|
||||
else
|
||||
return this.lockedControls;
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue