From a9f022503d96bd1dbb2afbdb8e4e738654198d1f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 2 Feb 2021 11:03:27 +0300 Subject: [PATCH] [SSE] Change settings for conditional formatting --- .../main/app/view/FormatRulesEditDlg.js | 86 ++++++++++++++++--- .../main/app/view/FormatRulesManagerDlg.js | 70 ++++++++++++--- 2 files changed, 129 insertions(+), 27 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 31321d759..26b365455 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -130,6 +130,14 @@ define([ '', '', '', + '', + '', + '', + '
', + '
', + '
', + '', + '', '', '', '
', @@ -1121,6 +1129,11 @@ define([ value = props.asc_getColorScaleOrDataBarOrIconSetRule(); break; } + if (type == Asc.c_oAscCFType.containsText || type == Asc.c_oAscCFType.notContainsText || type == Asc.c_oAscCFType.beginsWith || + type == Asc.c_oAscCFType.endsWith || type == Asc.c_oAscCFType.timePeriod || type == Asc.c_oAscCFType.aboveAverage || + type == Asc.c_oAscCFType.top10 || type == Asc.c_oAscCFType.cellIs || type == Asc.c_oAscCFType.expression) { + this.xfsFormat = props.asc_getDxf(); + } } var rec = this.ruleStore.where({type: type}); @@ -1158,13 +1171,6 @@ define([ this.refreshRules(rec.get('index'), ruleType); } - if (props) { - if (type == Asc.c_oAscCFType.containsText || type == Asc.c_oAscCFType.notContainsText || type == Asc.c_oAscCFType.beginsWith || - type == Asc.c_oAscCFType.endsWith || type == Asc.c_oAscCFType.timePeriod || type == Asc.c_oAscCFType.aboveAverage || - type == Asc.c_oAscCFType.top10 || type == Asc.c_oAscCFType.cellIs || type == Asc.c_oAscCFType.expression) { - this.xfsFormat = props.asc_getDxf(); - } - } var xfs = this.xfsFormat ? this.xfsFormat : (new AscCommonExcel.CellXfs()); if (xfs) { this.btnBold.toggle(xfs.asc_getFontBold() === true, true); @@ -1240,7 +1246,7 @@ define([ case Asc.c_oAscCFType.colorScale: var scaleProps = new AscCommonExcel.CColorScale(); var scalesCount = rec.get('num'); - var arr = (scalesCount) ? [this.scaleControls[0], this.scaleControls[2]] : this.scaleControls; + var arr = (scalesCount==2) ? [this.scaleControls[0], this.scaleControls[2]] : this.scaleControls; var colors = [], scales = []; for (var i=0; i0) && this.cmbRule.setValue((ruleType!==undefined) ? ruleType : cmbData[0].value); } this.setControls(index, this.cmbRule.getValue()); + + if (rec) { + var type = rec.get('type'); + this._changedProps = new AscCommonExcel.CConditionalFormattingRule(); + this._changedProps.asc_setType(type); + if (type == Asc.c_oAscCFType.containsText || type == Asc.c_oAscCFType.containsBlanks || type == Asc.c_oAscCFType.duplicateValues || + type == Asc.c_oAscCFType.timePeriod || type == Asc.c_oAscCFType.aboveAverage || + type == Asc.c_oAscCFType.top10 || type == Asc.c_oAscCFType.cellIs || type == Asc.c_oAscCFType.expression) { + this.xfsFormat && this._changedProps.asc_setDxf(this.xfsFormat); + } else if (type == Asc.c_oAscCFType.colorScale) { + var scalesCount = rec.get('num'); + var arr = (scalesCount==2) ? [this.scaleControls[0], this.scaleControls[2]] : this.scaleControls; + var colors = [], scales = []; + for (var i=0; i=this.listSettings.min; i--) { + if (store.at(i).get('cls')!=='hidden') { + return i; + } + } + return this.listSettings.min; + } + }, + + getNextRuleIndex: function(index) { + var store = this.rulesList.store; + if (this.cmbScope.getValue() == Asc.c_oAscSelectionForCFType.worksheet) { + return Math.min(store.length-1, index+1); + } else { + for (var i=index+1; i<=this.listSettings.max; i++) { + if (store.at(i).get('cls')!=='hidden') { + return i; + } + } + return this.listSettings.max; + } + }, + updateRulesCount: function() { var store = this.rulesList.store; if (this.cmbScope.getValue() == Asc.c_oAscSelectionForCFType.worksheet) { @@ -621,6 +655,14 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa } }, + + updateRulesPriority: function(store) { + for (var i=1; i