[SSE] Add conditional formatting from context menu

This commit is contained in:
Julia Radzhabova 2021-03-11 23:11:07 +03:00
parent 58c2a2ff7b
commit eecb45cb52
2 changed files with 28 additions and 1 deletions

View file

@ -196,6 +196,7 @@ define([
view.pmiSortCells.menu.on('item:click', _.bind(me.onSortCells, me));
view.pmiFilterCells.menu.on('item:click', _.bind(me.onFilterCells, me));
view.pmiReapply.on('click', _.bind(me.onReapply, me));
view.pmiCondFormat.on('click', _.bind(me.onCondFormat, me));
view.pmiClear.menu.on('item:click', _.bind(me.onClear, me));
view.pmiSelectTable.menu.on('item:click', _.bind(me.onSelectTable, me));
view.pmiInsertTable.menu.on('item:click', _.bind(me.onInsertTable, me));
@ -474,6 +475,24 @@ define([
this.api.asc_reapplyAutoFilter(this.documentHolder.ssMenu.formatTableName);
},
onCondFormat: function() {
var me = this,
value = me.api.asc_getLocale();
(!value) && (value = ((me.permissions.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(me.permissions.lang)) : 0x0409));
(new SSE.Views.FormatRulesEditDlg({
api: me.api,
props : null,
isEdit : false,
langId : value,
handler : function(result, settings) {
if (result == 'ok' && settings) {
me.api.asc_setCF([settings], []);
}
}
})).show();
},
onClear: function(menu, item) {
if (this.api) {
this.api.asc_emptyCells(item.value);
@ -1882,6 +1901,7 @@ define([
documentHolder.pmiSortCells.menu.items[4].setVisible(!internaleditor);
documentHolder.pmiFilterCells.setVisible(iscellmenu && !iscelledit && !internaleditor);
documentHolder.pmiReapply.setVisible((iscellmenu||isallmenu) && !iscelledit && !internaleditor);
documentHolder.pmiCondFormat.setVisible(!iscelledit && !internaleditor);
documentHolder.ssMenu.items[12].setVisible((iscellmenu||isallmenu||isinsparkline) && !iscelledit);
documentHolder.pmiInsFunction.setVisible(iscellmenu && !iscelledit);
documentHolder.pmiAddNamedRange.setVisible(iscellmenu && !iscelledit && !internaleditor);
@ -1961,6 +1981,7 @@ define([
documentHolder.pmiFilterCells.setDisabled(isCellLocked || isTableLocked|| (filterInfo==null) || inPivot || !filterInfo && !this.permissions.canModifyFilter);
documentHolder.pmiSortCells.setDisabled(isCellLocked || isTableLocked|| (filterInfo==null) || inPivot || !this.permissions.canModifyFilter);
documentHolder.pmiReapply.setDisabled(isCellLocked || isTableLocked|| (isApplyAutoFilter!==true));
documentHolder.pmiCondFormat.setDisabled(isCellLocked || isTableLocked);
documentHolder.menuHyperlink.setDisabled(isCellLocked || inPivot);
documentHolder.menuAddHyperlink.setDisabled(isCellLocked || inPivot);
documentHolder.pmiInsFunction.setDisabled(isCellLocked || inPivot);

View file

@ -539,6 +539,10 @@ define([
})
});
me.pmiCondFormat = new Common.UI.MenuItem({
caption : me.txtCondFormat
});
me.ssMenu = new Common.UI.Menu({
cls: 'shifted-right',
id : 'id-context-menu-cell',
@ -564,6 +568,7 @@ define([
me.pmiAddComment,
me.pmiCellMenuSeparator,
me.pmiNumFormat,
me.pmiCondFormat,
me.pmiEntriesList,
me.pmiAddNamedRange,
me.pmiInsFunction,
@ -1214,7 +1219,8 @@ define([
textStdDev: 'StdDev',
textVar: 'Var',
textMore: 'More functions',
txtCustomSort: 'Custom sort'
txtCustomSort: 'Custom sort',
txtCondFormat: 'Conditional Formatting'
}, SSE.Views.DocumentHolder || {}));
});