[SSE] Fix rule descriptions

This commit is contained in:
Julia Radzhabova 2020-04-28 15:42:19 +03:00
parent a4e93cefd8
commit ab2ff6f06f
2 changed files with 130 additions and 21 deletions

View file

@ -236,8 +236,8 @@ define([
rules: [ rules: [
{ name: 'Above', subtype: 0}, { name: 'Above', subtype: 0},
{ name: 'Below', subtype: 1}, { name: 'Below', subtype: 1},
{ name: 'Equal or above', subtype: 2}, { name: 'Equal to or above', subtype: 2},
{ name: 'Equal or below', subtype: 3}, { name: 'Equal to or below', subtype: 3},
{ name: '1 std dev above', subtype: 4}, { name: '1 std dev above', subtype: 4},
{ name: '1 std dev below', subtype: 5}, { name: '1 std dev below', subtype: 5},
{ name: '2 std dev above', subtype: 6}, { name: '2 std dev above', subtype: 6},
@ -823,7 +823,7 @@ define([
if (eq) if (eq)
subtype += 2; subtype += 2;
else if (stddev) { else if (stddev) {
subtype += (3 + stddev); subtype += (2 + stddev*2);
} }
break; break;
case Asc.c_oAscCFType.top10: case Asc.c_oAscCFType.top10:
@ -837,7 +837,6 @@ define([
this.txtRange2.setValue(props.asc_getValue2() || ''); this.txtRange2.setValue(props.asc_getValue2() || '');
break; break;
case Asc.c_oAscCFType.expression: case Asc.c_oAscCFType.expression:
subtype = props.asc_getOperator();
this.txtRange1.setValue(props.asc_getValue1() || ''); this.txtRange1.setValue(props.asc_getValue1() || '');
break; break;
case Asc.c_oAscCFType.colorScale: case Asc.c_oAscCFType.colorScale:

View file

@ -191,10 +191,12 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa
var arr = []; var arr = [];
if (levels) { if (levels) {
for (var i=0; i<levels.length; i++) { for (var i=0; i<levels.length; i++) {
var level = levels[i]; var level = levels[i],
name = this.getRuleName(level);
arr.push({ arr.push({
levelIndex: i, levelIndex: i,
name: this.getRuleName(level), name: name,
tip: name,
range: level.asc_getLocation(), range: level.asc_getLocation(),
props: level props: level
}); });
@ -211,57 +213,165 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa
switch (rule.asc_getType()) { switch (rule.asc_getType()) {
case Asc.c_oAscCFType.aboveAverage: case Asc.c_oAscCFType.aboveAverage:
name = 'Above average'; name = 'Above average';
var above = rule.asc_getAboveAverage(),
eq = rule.asc_getEqualAverage(),
stddev = rule.asc_getStdDev();
subtype = (above) ? 0 : 1;
if (eq)
subtype += 2;
else if (stddev) {
subtype += (2 + stddev*2);
}
switch (subtype) {
case 0:
name = 'Above average';
break;
case 1:
name = 'Below average';
break;
case 2:
name = 'Equal to or above average';
break;
case 3:
name = 'Equal to or below average';
break;
case 4:
name = '1 std dev above average';
break;
case 5:
name = '1 std dev below average';
break;
case 6:
name = '2 std dev above average';
break;
case 7:
name = '2 std dev below average';
break;
case 8:
name = '3 std dev above average';
break;
case 9:
name = '3 std dev below average';
break;
}
break; break;
case Asc.c_oAscCFType.beginsWith: case Asc.c_oAscCFType.beginsWith:
name = 'Begins with'; name = 'Cell value begins with ' + (rule.asc_getContainsText() || '');
break; break;
case Asc.c_oAscCFType.cellIs: case Asc.c_oAscCFType.cellIs:
name = 'Value is'; name = 'Cell value';
var subtype = rule.asc_getOperator(),
op;
switch (subtype) {
case Asc.c_oAscCFOperator.greaterThan:
op = '>';
name = name + ' ' + op + ' ' + (rule.asc_getValue1() || '');
break;
case Asc.c_oAscCFOperator.greaterThanOrEqual:
op = '>=';
name = name + ' ' + op + ' ' + (rule.asc_getValue1() || '');
break;
case Asc.c_oAscCFOperator.lessThan:
op = '<';
name = name + ' ' + op + ' ' + (rule.asc_getValue1() || '');
break;
case Asc.c_oAscCFOperator.lessThanOrEqual:
op = '<=';
name = name + ' ' + op + ' ' + (rule.asc_getValue1() || '');
break;
case Asc.c_oAscCFOperator.equal:
op = '=';
name = name + ' ' + op + ' ' + (rule.asc_getValue1() || '');
break;
case Asc.c_oAscCFOperator.notEqual:
op = '<>';
name = name + ' ' + op + ' ' + (rule.asc_getValue1() || '');
break;
case Asc.c_oAscCFOperator.between:
name = name + ' ' + Common.Utils.String.format('is between {0} and {1}', (rule.asc_getValue1() || ''), (rule.asc_getValue2() || ''));
break;
case Asc.c_oAscCFOperator.notBetween:
name = name + ' ' + Common.Utils.String.format('is not between {0} and {1}', (rule.asc_getValue1() || ''), (rule.asc_getValue2() || ''));
break;
}
break; break;
case Asc.c_oAscCFType.colorScale: case Asc.c_oAscCFType.colorScale:
name = 'Color scale'; name = 'Graded color scale';
break; break;
case Asc.c_oAscCFType.containsBlanks: case Asc.c_oAscCFType.containsBlanks:
name = 'Contains blanks'; name = 'Cell contains a blank value';
break; break;
case Asc.c_oAscCFType.containsErrors: case Asc.c_oAscCFType.containsErrors:
name = 'Contains errors'; name = 'Cell contains an error';
break; break;
case Asc.c_oAscCFType.containsText: case Asc.c_oAscCFType.containsText:
name = 'Contains text'; name = 'Cell value contains ' + (rule.asc_getContainsText() || '');
break; break;
case Asc.c_oAscCFType.dataBar: case Asc.c_oAscCFType.dataBar:
name = 'Data bar'; name = 'Column';
break; break;
case Asc.c_oAscCFType.duplicateValues: case Asc.c_oAscCFType.duplicateValues:
name = 'Duplicate values'; name = 'Duplicate values';
break; break;
case Asc.c_oAscCFType.expression: case Asc.c_oAscCFType.expression:
name = 'Expression'; name = 'Formula: ' + (rule.asc_getValue1() || '');
break; break;
case Asc.c_oAscCFType.iconSet: case Asc.c_oAscCFType.iconSet:
name = 'Icon sets'; name = 'Icon set';
break; break;
case Asc.c_oAscCFType.notContainsBlanks: case Asc.c_oAscCFType.notContainsBlanks:
name = 'Not contains blanks'; name = 'Cell does not contain a blank value';
break; break;
case Asc.c_oAscCFType.notContainsErrors: case Asc.c_oAscCFType.notContainsErrors:
name = 'Not contains errors'; name = 'Cell does not contain an error';
break; break;
case Asc.c_oAscCFType.notContainsText: case Asc.c_oAscCFType.notContainsText:
name = 'Not contains text'; name = 'Cell value does not contain ' + (rule.asc_getContainsText() || '');
break; break;
case Asc.c_oAscCFType.timePeriod: case Asc.c_oAscCFType.timePeriod:
name = 'Date'; var subtype = rule.asc_getTimePeriod();
switch (subtype) {
case Asc.c_oAscTimePeriod.yesterday:
name = 'Yesterday';
break;
case Asc.c_oAscTimePeriod.today:
name = 'Today';
break;
case Asc.c_oAscTimePeriod.tomorrow:
name = 'Tomorrow';
break;
case Asc.c_oAscTimePeriod.last7Days:
name = 'In the last 7 days';
break;
case Asc.c_oAscTimePeriod.lastWeek:
name = 'Last week';
break;
case Asc.c_oAscTimePeriod.thisWeek:
name = 'This week';
break;
case Asc.c_oAscTimePeriod.nextWeek:
name = 'Next week';
break;
case Asc.c_oAscTimePeriod.lastMonth:
name = 'Last month';
break;
case Asc.c_oAscTimePeriod.thisMonth:
name = 'This month';
break;
case Asc.c_oAscTimePeriod.nextMonth:
name = 'Next month';
break;
}
break; break;
case Asc.c_oAscCFType.top10: case Asc.c_oAscCFType.top10:
name = 'Top 10 values'; name = rule.asc_getBottom() ? 'Bottom' : 'Top';
name = name + ' ' + (rule.asc_getRank()) + (rule.asc_getPercent() ? '%' : '');
break; break;
case Asc.c_oAscCFType.uniqueValues: case Asc.c_oAscCFType.uniqueValues:
name = 'Unique values'; name = 'Unique values';
break; break;
case Asc.c_oAscCFType.endsWith: case Asc.c_oAscCFType.endsWith:
name = 'Ends with'; name = 'Cell value ends with ' + (rule.asc_getContainsText() || '');
break; break;
} }
return name; return name;