Merge pull request #981 from ONLYOFFICE/fix/bugfix

Fix/bugfix
This commit is contained in:
Julia Radzhabova 2021-07-14 19:04:51 +03:00 committed by GitHub
commit b36ee48a72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View file

@ -1322,7 +1322,8 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
if (rec) {
props = this._originalProps || new Asc.asc_CConditionalFormattingRule();
var type = rec.get('type');
var type = rec.get('type'),
type_changed = (type!==props.asc_getType());
props.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 ||
@ -1364,7 +1365,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
props.asc_setValue1(this.txtRange1.getValue());
break;
case Asc.c_oAscCFType.colorScale:
var scaleProps = new Asc.asc_CColorScale();
var scaleProps = !type_changed ? props.asc_getColorScaleOrDataBarOrIconSetRule() : new Asc.asc_CColorScale();
var scalesCount = rec.get('num');
var arr = (scalesCount==2) ? [this.scaleControls[0], this.scaleControls[2]] : this.scaleControls;
var colors = [], scales = [];
@ -1381,7 +1382,8 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
props.asc_setColorScaleOrDataBarOrIconSetRule(scaleProps);
break;
case Asc.c_oAscCFType.dataBar:
var barProps = new Asc.asc_CDataBar();
var barProps = !type_changed ? props.asc_getColorScaleOrDataBarOrIconSetRule() : new Asc.asc_CDataBar();
type_changed && barProps.asc_setInterfaceDefault();
var arr = this.barControls;
var bars = [];
for (var i=0; i<arr.length; i++) {
@ -1417,7 +1419,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
props.asc_setColorScaleOrDataBarOrIconSetRule(barProps);
break;
case Asc.c_oAscCFType.iconSet:
var iconsProps = new Asc.asc_CIconSet();
var iconsProps = !type_changed ? props.asc_getColorScaleOrDataBarOrIconSetRule() : new Asc.asc_CIconSet();
iconsProps.asc_setShowValue(this.chIconShow.getValue()!=='checked');
iconsProps.asc_setReverse(!!this.iconsProps.isReverse);
iconsProps.asc_setIconSet(this.iconsProps.iconsSet);
@ -1506,6 +1508,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
this._changedProps.asc_setColorScaleOrDataBarOrIconSetRule(this.scaleProps);
} else if (type == Asc.c_oAscCFType.dataBar) {
this.barProps = new Asc.asc_CDataBar();
this.barProps.asc_setInterfaceDefault();
this.barProps.asc_setGradient(this.cmbFill.getValue());
this.barProps.asc_setColor(Common.Utils.ThemeColor.getRgbColor(this.btnPosFill.colorPicker.currentColor));
var hasBorder = !this.cmbBorder.getValue();

View file

@ -674,11 +674,13 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa
rec = this.rulesList.getSelectedRec();
if (rec) {
var index = store.indexOf(rec);
var newrec = store.at(up ? this.getPrevRuleIndex(index) : this.getNextRuleIndex(index)),
var newindex = up ? this.getPrevRuleIndex(index) : this.getNextRuleIndex(index),
newrec = store.at(newindex),
prioritynew = newrec.get('priority');
newrec.set('priority', rec.get('priority'));
rec.set('priority', prioritynew);
store.add(store.remove(rec), {at: up ? Math.max(0, index-1) : Math.min(length-1, index+1)});
store.add(store.remove(rec), {at: up ? Math.max(0, newindex) : Math.min(length-1, newindex)});
store.add(store.remove(newrec), {at: up ? Math.max(0, index) : Math.min(length-1, index)});
this.rulesList.selectRecord(rec);
this.rulesList.scrollToRecord(rec);
}