[SSE] Disable filters, sort, merge, hyperlinks when in pivot table.

This commit is contained in:
Julia Radzhabova 2017-06-21 12:47:22 +03:00
parent a22f2948c7
commit bafbdf6c3f
3 changed files with 22 additions and 13 deletions

View file

@ -1445,6 +1445,8 @@ define([
documentHolder.pmiInsertCells.menu.items[1].setDisabled(isApplyAutoFilter);
documentHolder.pmiDeleteCells.menu.items[1].setDisabled(isApplyAutoFilter);
var inPivot = !!cellinfo.asc_getPivotTableInfo();
_.each(documentHolder.ssMenu.items, function(item) {
item.setDisabled(isCellLocked);
});
@ -1455,9 +1457,12 @@ define([
documentHolder.pmiDeleteEntire.setDisabled(isCellLocked || isTableLocked);
documentHolder.pmiDeleteCells.setDisabled(isCellLocked || isTableLocked);
documentHolder.pmiDeleteTable.setDisabled(isCellLocked || isTableLocked);
documentHolder.pmiFilterCells.setDisabled(isCellLocked || isTableLocked|| (filterInfo==null));
documentHolder.pmiSortCells.setDisabled(isCellLocked || isTableLocked|| (filterInfo==null));
documentHolder.pmiFilterCells.setDisabled(isCellLocked || isTableLocked|| (filterInfo==null) || inPivot);
documentHolder.pmiSortCells.setDisabled(isCellLocked || isTableLocked|| (filterInfo==null) || inPivot);
documentHolder.pmiReapply.setDisabled(isCellLocked || isTableLocked|| (isApplyAutoFilter!==true));
documentHolder.menuHyperlink.setDisabled(isCellLocked || inPivot);
documentHolder.menuAddHyperlink.setDisabled(isCellLocked || inPivot);
if (showMenu) this.showPopupMenu(documentHolder.ssMenu, {}, event);
} else if (this.permissions.isEditDiagram && seltype == Asc.c_oAscSelectionType.RangeChartText) {
if (!showMenu && !documentHolder.textInShapeMenu.isVisible()) return;

View file

@ -2012,6 +2012,9 @@ define([
this._state.multiselect = info.asc_getFlags().asc_getMultiselect();
toolbar.lockToolbar(SSE.enumLock.multiselect, this._state.multiselect, { array: [toolbar.btnTableTemplate, toolbar.btnInsertHyperlink]});
need_disable = !!info.asc_getPivotTableInfo();
toolbar.lockToolbar(SSE.enumLock.editPivot, need_disable, { array: [toolbar.btnMerge, toolbar.btnInsertHyperlink, toolbar.btnSetAutofilter, toolbar.btnClearAutofilter, toolbar.btnSortDown, toolbar.btnSortUp, toolbar.btnAutofilter]});
}
val = info.asc_getNumFormatInfo();

View file

@ -61,6 +61,7 @@ define([
editCell: 'cell-editing',
editFormula: 'is-formula',
editText: 'is-text',
editPivot: 'is-pivot',
selImage: 'sel-image',
selShape: 'sel-shape',
selShapeText: 'sel-shape-txt',
@ -289,21 +290,21 @@ define([
id : 'id-toolbar-btn-sort-down',
cls : 'btn-toolbar',
iconCls : 'btn-sort-down',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter]
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot]
});
me.btnSortUp = new Common.UI.Button({
id : 'id-toolbar-btn-sort-up',
cls : 'btn-toolbar',
iconCls : 'btn-sort-up',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter]
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot]
});
me.btnSetAutofilter = new Common.UI.Button({
id : 'id-toolbar-btn-setautofilter',
cls : 'btn-toolbar',
iconCls : 'btn-autofilter',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot],
enableToggle: true
});
@ -311,7 +312,7 @@ define([
id : 'id-toolbar-btn-clearfilter',
cls : 'btn-toolbar',
iconCls : 'btn-clear-filter',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleDelFilter]
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleDelFilter, _set.editPivot]
});
} else {
Common.UI.Mixtbar.prototype.initialize.call(this, {
@ -493,7 +494,7 @@ define([
enableToggle: true,
allowDepress: true,
split : true,
lock : [_set.editCell, _set.selShape, _set.selShapeText, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleMerge],
lock : [_set.editCell, _set.selShape, _set.selShapeText, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleMerge, _set.editPivot],
menu : new Common.UI.Menu({
items: [
{
@ -617,7 +618,7 @@ define([
cls : 'btn-toolbar x-huge icon-top',
iconCls : 'btn-inserthyperlink',
caption : me.capInsertHyperlink,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selShape, _set.cantHyperlink, _set.multiselect, _set.lostConnect, _set.coAuth]
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selShape, _set.cantHyperlink, _set.multiselect, _set.lostConnect, _set.coAuth, _set.editPivot]
});
me.btnInsertChart = new Common.UI.Button({
@ -684,21 +685,21 @@ define([
id : 'id-toolbar-btn-sort-down',
cls : 'btn-toolbar',
iconCls : 'btn-sort-down',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter]
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot]
});
me.btnSortUp = new Common.UI.Button({
id : 'id-toolbar-btn-sort-up',
cls : 'btn-toolbar',
iconCls : 'btn-sort-up',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter]
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot]
});
me.btnSetAutofilter = new Common.UI.Button({
id : 'id-toolbar-btn-setautofilter',
cls : 'btn-toolbar',
iconCls : 'btn-autofilter',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot],
enableToggle: true
});
@ -706,7 +707,7 @@ define([
id : 'id-toolbar-btn-clearfilter',
cls : 'btn-toolbar',
iconCls : 'btn-clear-filter',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleDelFilter]
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleDelFilter, _set.editPivot]
});
me.btnTableTemplate = new Common.UI.Button({
@ -1151,7 +1152,7 @@ define([
id : 'id-toolbar-btn-autofilter',
cls : 'btn-toolbar',
iconCls : 'btn-autofilter',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot],
menu : new Common.UI.Menu({
items : [
me.mnuitemSortAZ = new Common.UI.MenuItem({