mirror of
https://github.com/storytold/gridcraft.git
synced 2026-11-28 17:30:24 +01:00
Conditional formatting: colour-scale editor and New Rule list (part of #1165)
New Formatting Rule offers Excel's six rule types. The colour-scale branch edits per-stop type, value and colour, and Manage Rules edits a rule in place. Formula rules refuse an empty or unparseable formula: the dialog keeps OK disabled until a formula is typed, and the command rejects both an empty rule and a formula that does not parse (#1999), so neither a rule that never applies nor a workbook Excel cannot open is written. Percent and percentile stops are clamped to 0-100, and an edit past the last rule names home.manageRules and leaves no undo step.
This commit is contained in:
1 parent
41769f1d16
commit
c693db2b9f
18 files changed
+1179
-89
No files matched your search
@@ -245,6 +245,7 @@ Ranked; estimates in Opus 5.5 agent-hours. Detail and the full beta-gate list in
|
||||
| 2026-10-20 | minor | Dutch (nl) listed under other shipped languages; progress log row |
|
||||
| 2026-10-19 | minor | Progress log: long flat operator chains (#916) |
|
||||
| 2026-10-19 | trivial | Progress log: desktop theme portal read timeout |
|
||||
| 2026-10-17 | minor | Conditional formatting: 2-/3-colour scale editor with per-stop type/value/colour, and in-place rule editing (part of #1165) |
|
||||
| 2026-10-16 | minor | Progress log: undo steps share picture and macro bytes |
|
||||
| 2026-10-16 | minor | Progress log: floating pictures' textures bounded and kept per workbook |
|
||||
| 2026-10-16 | trivial | Progress log: web preferences kept between visits (#1562) |
|
||||
|
||||
+340
-83
@@ -190,7 +190,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Conditional Formatting",
|
||||
["Home", "Styles"],
|
||||
None,
|
||||
"{range?, rule: {type: cellIs|expression|containsText|beginsWith|endsWith|blanks|noBlanks|errors|noErrors|duplicate|unique|top10|aboveAverage|timePeriod|colorScale|dataBar|iconSet, operator?, value?, value2?, formula?, text?, rank?, bottom?, percent?, below?, period?, colors?: [..], color?, set?, style?: {font?: {bold?, italic?, color?}, fill?: \"#FFC7CE\" | {pattern?, fg?, bg?}, borders?, num_fmt?} (colours \"#RRGGBB\") | preset?: lightRedFill|redText|yellowFill|greenFill|redBorder|lightRedFillDarkRedText…}; a text `value` is matched as text, or kept when already a quoted literal}",
|
||||
"{range?, rule: {type: cellIs|expression|containsText|beginsWith|endsWith|blanks|noBlanks|errors|noErrors|duplicate|unique|top10|aboveAverage|timePeriod|colorScale|dataBar|iconSet, operator?, value?, value2?, formula?, text?, rank?, bottom?, percent?, below?, period?, colors?: [..], stops?: [{type: min|max|num|percent|percentile|formula, value?, color}], color?, set?, style?: {font?: {bold?, italic?, color?}, fill?: \"#FFC7CE\" | {pattern?, fg?, bg?}, borders?, num_fmt?} (colours \"#RRGGBB\") | preset?: lightRedFill|redText|yellowFill|greenFill|redBorder|lightRedFillDarkRedText…}; a text `value` is matched as text, or kept when already a quoted literal}",
|
||||
has_doc,
|
||||
add_cf
|
||||
),
|
||||
@@ -200,7 +200,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Manage Rules…",
|
||||
["Home", "Styles", "Conditional Formatting"],
|
||||
None,
|
||||
"{delete?: index, moveUp?: index, moveDown?: index}",
|
||||
"{delete?: index, moveUp?: index, moveDown?: index, edit?: index, rule?: {...} (with edit)}",
|
||||
has_doc,
|
||||
manage_cf
|
||||
),
|
||||
@@ -1493,36 +1493,40 @@ fn cf_style_json(st: &Json) -> Result<Json> {
|
||||
fn check_cf_formula(cmd: &str, what: &str, formula: &str) -> Result<()> {
|
||||
// Strip exactly one leading '=', the way the XLSX writer does: a value like '===A1'
|
||||
// only parses after several strips and would still be saved unparseable. (#1999 review)
|
||||
if gridcraft_formula::parse(formula.strip_prefix('=').unwrap_or(formula)).is_err() {
|
||||
let parsed = formula.strip_prefix('=').unwrap_or(formula);
|
||||
// A rule with no formula never applies; the dialog also keeps OK disabled for it.
|
||||
if parsed.trim().is_empty() {
|
||||
return Err(bad(cmd, format!("the {what} formula is empty")));
|
||||
}
|
||||
if gridcraft_formula::parse(parsed).is_err() {
|
||||
return Err(bad(cmd, format!("invalid {what} formula `{formula}` — it does not parse; Excel would reject the saved file")));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn check_cf_value(what: &str, v: &gridcraft_model::features::CfValueKind) -> Result<()> {
|
||||
fn check_cf_value(cmd: &str, what: &str, v: &gridcraft_model::features::CfValueKind) -> Result<()> {
|
||||
if let gridcraft_model::features::CfValueKind::Formula(f) = v {
|
||||
check_cf_formula("home.conditionalFormat", what, f)?;
|
||||
check_cf_formula(cmd, what, f)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn check_cf_rule(rule: &CfRule) -> Result<()> {
|
||||
const CMD: &str = "home.conditionalFormat";
|
||||
fn check_cf_rule(cmd: &str, rule: &CfRule) -> Result<()> {
|
||||
match rule {
|
||||
CfRule::CellIs { a, b, .. } => {
|
||||
check_cf_formula(CMD, "comparison value", a)?;
|
||||
check_cf_formula(cmd, "comparison value", a)?;
|
||||
if let Some(b) = b {
|
||||
check_cf_formula(CMD, "second comparison value", b)?;
|
||||
check_cf_formula(cmd, "second comparison value", b)?;
|
||||
}
|
||||
}
|
||||
CfRule::Expression { formula, .. } => check_cf_formula(CMD, "rule", formula)?,
|
||||
CfRule::Expression { formula, .. } => check_cf_formula(cmd, "rule", formula)?,
|
||||
CfRule::DataBar { min, max, .. } => {
|
||||
check_cf_value("data bar minimum", min)?;
|
||||
check_cf_value("data bar maximum", max)?;
|
||||
check_cf_value(cmd, "data bar minimum", min)?;
|
||||
check_cf_value(cmd, "data bar maximum", max)?;
|
||||
}
|
||||
CfRule::ColorScale { stops } => {
|
||||
for (kind, _) in stops {
|
||||
check_cf_value("color scale threshold", kind)?;
|
||||
check_cf_value(cmd, "color scale threshold", kind)?;
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
@@ -1530,41 +1534,50 @@ fn check_cf_rule(rule: &CfRule) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn add_cf(s: &mut Session, p: &Json) -> Result<Json> {
|
||||
let ranges = target_ranges(s, p)?;
|
||||
let sheet = target_sheet(s, p)?;
|
||||
let Some(rule) = p.get("rule") else {
|
||||
s.ui_requests.push(crate::UiRequest::Dialog("newFormattingRule".into(), json!({})));
|
||||
return ok();
|
||||
};
|
||||
fn cf_style(rule: &Json, cmd: &str) -> Result<Style> {
|
||||
let g = |k: &str| rule.get(k).and_then(Json::as_str).map(str::to_string);
|
||||
let style = Box::new(match rule.get("style") {
|
||||
match rule.get("style") {
|
||||
Some(st) if !st.is_null() => {
|
||||
let st = cf_style_json(st)?;
|
||||
let base = serde_json::to_value(Style::default()).map_err(|e| EngineError::Other(e.to_string()))?;
|
||||
serde_json::from_value(super::format::merge_json(base, &st)).map_err(|e| bad("home.conditionalFormat", e.to_string()))?
|
||||
Ok(serde_json::from_value(super::format::merge_json(base, &st)).map_err(|e| bad(cmd, e.to_string()))?)
|
||||
}
|
||||
_ => preset_style(g("preset").as_deref().unwrap_or("lightRedFillDarkRedText")),
|
||||
});
|
||||
let kind = g("type").unwrap_or_else(|| "cellIs".into());
|
||||
let value_kind = |v: Option<&Json>, default: CfValueKind| -> CfValueKind {
|
||||
match v {
|
||||
Some(Json::Object(o)) => {
|
||||
let t = o.get("type").and_then(Json::as_str).unwrap_or("num");
|
||||
let val = o.get("value").and_then(Json::as_f64).unwrap_or(0.0);
|
||||
match t {
|
||||
"min" => CfValueKind::Min,
|
||||
"max" => CfValueKind::Max,
|
||||
"percent" => CfValueKind::Percent(val),
|
||||
"percentile" => CfValueKind::Percentile(val),
|
||||
"formula" => CfValueKind::Formula(o.get("value").and_then(Json::as_str).unwrap_or("").into()),
|
||||
_ => CfValueKind::Number(val),
|
||||
_ => Ok(preset_style(g("preset").as_deref().unwrap_or("lightRedFillDarkRedText"))),
|
||||
}
|
||||
}
|
||||
|
||||
fn cf_value_kind(v: Option<&Json>, default: CfValueKind, cmd: &str) -> Result<CfValueKind> {
|
||||
match v {
|
||||
Some(Json::Object(o)) => {
|
||||
let t = o.get("type").and_then(Json::as_str).unwrap_or("num");
|
||||
let val = o.get("value").and_then(Json::as_f64).unwrap_or(0.0);
|
||||
Ok(match t {
|
||||
"min" => CfValueKind::Min,
|
||||
"max" => CfValueKind::Max,
|
||||
// The dialog clamps these to 0-100; engine callers get the same range.
|
||||
"percent" => CfValueKind::Percent(val.clamp(0.0, 100.0)),
|
||||
"percentile" => CfValueKind::Percentile(val.clamp(0.0, 100.0)),
|
||||
"formula" => {
|
||||
let f = o.get("value").and_then(Json::as_str).unwrap_or("");
|
||||
if f.trim().is_empty() {
|
||||
return Err(bad(cmd, "a formula stop needs a formula"));
|
||||
}
|
||||
// Stored exactly: the evaluator takes the formula as written.
|
||||
CfValueKind::Formula(f.into())
|
||||
}
|
||||
}
|
||||
_ => default,
|
||||
"num" => CfValueKind::Number(val),
|
||||
other => return Err(bad(cmd, format!("unknown stop type `{other}`"))),
|
||||
})
|
||||
}
|
||||
};
|
||||
let rule = match kind.as_str() {
|
||||
_ => Ok(default),
|
||||
}
|
||||
}
|
||||
|
||||
fn cf_rule(rule: &Json, cmd: &str) -> Result<CfRule> {
|
||||
let g = |k: &str| rule.get(k).and_then(Json::as_str).map(str::to_string);
|
||||
let style = Box::new(cf_style(rule, cmd)?);
|
||||
let kind = g("type").unwrap_or_else(|| "cellIs".into());
|
||||
match kind.as_str() {
|
||||
"cellIs" => {
|
||||
// Excel's file and VBA names (`lessThan`, …) are accepted too.
|
||||
let op = match g("operator").as_deref().unwrap_or("greater") {
|
||||
@@ -1576,7 +1589,7 @@ fn add_cf(s: &mut Session, p: &Json) -> Result<Json> {
|
||||
"greaterOrEqual" | "greaterThanOrEqual" => CfOperator::GreaterOrEqual,
|
||||
"lessOrEqual" | "lessThanOrEqual" => CfOperator::LessOrEqual,
|
||||
"greater" | "greaterThan" => CfOperator::Greater,
|
||||
other => return Err(bad("home.conditionalFormat", format!("unknown operator `{other}`"))),
|
||||
other => return Err(bad(cmd, format!("unknown operator `{other}`"))),
|
||||
};
|
||||
let a = rule.get("value").map(super::edit::json_to_input).unwrap_or_default();
|
||||
let b = rule.get("value2").map(super::edit::json_to_input);
|
||||
@@ -1591,59 +1604,83 @@ fn add_cf(s: &mut Session, p: &Json) -> Result<Json> {
|
||||
format!("\"{}\"", v.replace('"', "\"\""))
|
||||
}
|
||||
};
|
||||
CfRule::CellIs { op, a: quote(a), b: b.map(quote), style }
|
||||
Ok(CfRule::CellIs { op, a: quote(a), b: b.map(quote), style })
|
||||
}
|
||||
"expression" => CfRule::Expression { formula: g("formula").unwrap_or_default().trim_start_matches('=').to_string(), style },
|
||||
"containsText" => CfRule::ContainsText { text: g("text").unwrap_or_default(), style },
|
||||
"notContainsText" => CfRule::NotContainsText { text: g("text").unwrap_or_default(), style },
|
||||
"beginsWith" => CfRule::BeginsWith { text: g("text").unwrap_or_default(), style },
|
||||
"endsWith" => CfRule::EndsWith { text: g("text").unwrap_or_default(), style },
|
||||
"blanks" => CfRule::Blanks { style },
|
||||
"noBlanks" => CfRule::NoBlanks { style },
|
||||
"errors" => CfRule::Errors { style },
|
||||
"noErrors" => CfRule::NoErrors { style },
|
||||
"duplicate" => CfRule::Duplicate { style },
|
||||
"unique" => CfRule::Unique { style },
|
||||
"top10" => CfRule::Top10 {
|
||||
"expression" => Ok(CfRule::Expression { formula: g("formula").unwrap_or_default().trim_start_matches('=').to_string(), style }),
|
||||
"containsText" => Ok(CfRule::ContainsText { text: g("text").unwrap_or_default(), style }),
|
||||
"notContainsText" => Ok(CfRule::NotContainsText { text: g("text").unwrap_or_default(), style }),
|
||||
"beginsWith" => Ok(CfRule::BeginsWith { text: g("text").unwrap_or_default(), style }),
|
||||
"endsWith" => Ok(CfRule::EndsWith { text: g("text").unwrap_or_default(), style }),
|
||||
"blanks" => Ok(CfRule::Blanks { style }),
|
||||
"noBlanks" => Ok(CfRule::NoBlanks { style }),
|
||||
"errors" => Ok(CfRule::Errors { style }),
|
||||
"noErrors" => Ok(CfRule::NoErrors { style }),
|
||||
"duplicate" => Ok(CfRule::Duplicate { style }),
|
||||
"unique" => Ok(CfRule::Unique { style }),
|
||||
"top10" => Ok(CfRule::Top10 {
|
||||
bottom: rule.get("bottom").and_then(Json::as_bool).unwrap_or(false),
|
||||
percent: rule.get("percent").and_then(Json::as_bool).unwrap_or(false),
|
||||
rank: rule.get("rank").and_then(Json::as_u64).unwrap_or(10) as u32,
|
||||
style,
|
||||
},
|
||||
"aboveAverage" => CfRule::AboveAverage { below: rule.get("below").and_then(Json::as_bool).unwrap_or(false), equal: false, std_dev: 0, style },
|
||||
"timePeriod" => CfRule::TimePeriod { period: g("period").unwrap_or_else(|| "today".into()), style },
|
||||
"colorScale" => {
|
||||
let cols: Vec<Color> = rule
|
||||
.get("colors")
|
||||
.and_then(Json::as_array)
|
||||
.map(|a| a.iter().filter_map(|c| super::format::color_param(Some(c))).collect())
|
||||
.unwrap_or_else(|| vec![Color::rgb(0xF8, 0x69, 0x6B), Color::rgb(0xFF, 0xEB, 0x84), Color::rgb(0x63, 0xBE, 0x7B)]);
|
||||
let stops = match cols.len() {
|
||||
2 => vec![(CfValueKind::Min, cols[0]), (CfValueKind::Max, cols[1])],
|
||||
_ => vec![
|
||||
(CfValueKind::Min, cols.first().copied().unwrap_or_default()),
|
||||
(CfValueKind::Percentile(50.0), cols.get(1).copied().unwrap_or_default()),
|
||||
(CfValueKind::Max, cols.get(2).copied().unwrap_or_default()),
|
||||
],
|
||||
};
|
||||
CfRule::ColorScale { stops }
|
||||
}),
|
||||
"aboveAverage" => {
|
||||
Ok(CfRule::AboveAverage { below: rule.get("below").and_then(Json::as_bool).unwrap_or(false), equal: false, std_dev: 0, style })
|
||||
}
|
||||
"dataBar" => CfRule::DataBar {
|
||||
min: value_kind(rule.get("min"), CfValueKind::Min),
|
||||
max: value_kind(rule.get("max"), CfValueKind::Max),
|
||||
"timePeriod" => Ok(CfRule::TimePeriod { period: g("period").unwrap_or_else(|| "today".into()), style }),
|
||||
"colorScale" => {
|
||||
let stops = if let Some(list) = rule.get("stops").and_then(Json::as_array) {
|
||||
let mut out = Vec::with_capacity(list.len().min(3));
|
||||
for stop in list {
|
||||
let color = super::format::color_param(stop.get("color")).ok_or_else(|| bad(cmd, "a colour-scale stop needs a colour"))?;
|
||||
out.push((cf_value_kind(Some(stop), CfValueKind::Min, cmd)?, color));
|
||||
}
|
||||
if !(2..=3).contains(&out.len()) {
|
||||
return Err(bad(cmd, "a colour scale needs two or three stops"));
|
||||
}
|
||||
out
|
||||
} else {
|
||||
let cols: Vec<Color> = rule
|
||||
.get("colors")
|
||||
.and_then(Json::as_array)
|
||||
.map(|a| a.iter().filter_map(|c| super::format::color_param(Some(c))).collect())
|
||||
.unwrap_or_else(|| vec![Color::rgb(0xF8, 0x69, 0x6B), Color::rgb(0xFF, 0xEB, 0x84), Color::rgb(0x63, 0xBE, 0x7B)]);
|
||||
match cols.len() {
|
||||
2 => vec![(CfValueKind::Min, cols[0]), (CfValueKind::Max, cols[1])],
|
||||
_ => vec![
|
||||
(CfValueKind::Min, cols.first().copied().unwrap_or_default()),
|
||||
(CfValueKind::Percentile(50.0), cols.get(1).copied().unwrap_or_default()),
|
||||
(CfValueKind::Max, cols.get(2).copied().unwrap_or_default()),
|
||||
],
|
||||
}
|
||||
};
|
||||
Ok(CfRule::ColorScale { stops })
|
||||
}
|
||||
"dataBar" => Ok(CfRule::DataBar {
|
||||
min: cf_value_kind(rule.get("min"), CfValueKind::Min, cmd)?,
|
||||
max: cf_value_kind(rule.get("max"), CfValueKind::Max, cmd)?,
|
||||
color: super::format::color_param(rule.get("color")).unwrap_or(Color::rgb(0x63, 0x8E, 0xC6)),
|
||||
gradient: rule.get("gradient").and_then(Json::as_bool).unwrap_or(true),
|
||||
show_value: true,
|
||||
},
|
||||
"iconSet" => CfRule::IconSet {
|
||||
}),
|
||||
"iconSet" => Ok(CfRule::IconSet {
|
||||
set: g("set").unwrap_or_else(|| "3TrafficLights1".into()),
|
||||
thresholds: vec![],
|
||||
reverse: rule.get("reverse").and_then(Json::as_bool).unwrap_or(false),
|
||||
show_value: true,
|
||||
},
|
||||
other => return Err(bad("home.conditionalFormat", format!("unknown rule type `{other}`"))),
|
||||
}),
|
||||
other => Err(bad(cmd, format!("unknown rule type `{other}`"))),
|
||||
}
|
||||
}
|
||||
|
||||
fn add_cf(s: &mut Session, p: &Json) -> Result<Json> {
|
||||
let ranges = target_ranges(s, p)?;
|
||||
let sheet = target_sheet(s, p)?;
|
||||
let Some(rule) = p.get("rule") else {
|
||||
s.ui_requests.push(crate::UiRequest::Dialog("newFormattingRule".into(), json!({})));
|
||||
return ok();
|
||||
};
|
||||
check_cf_rule(&rule)?;
|
||||
let rule = cf_rule(rule, "home.conditionalFormat")?;
|
||||
check_cf_rule("home.conditionalFormat", &rule)?;
|
||||
edit(s, |cx| {
|
||||
let sh = cx.sheet_mut(sheet)?;
|
||||
let priority = sh.cond_formats.iter().map(|c| c.priority).max().unwrap_or(0) + 1;
|
||||
@@ -1677,17 +1714,30 @@ fn clear_cf(s: &mut Session, p: &Json) -> Result<Json> {
|
||||
|
||||
fn manage_cf(s: &mut Session, p: &Json) -> Result<Json> {
|
||||
let sheet = target_sheet(s, p)?;
|
||||
if p.get("delete").is_none() && p.get("moveUp").is_none() && p.get("moveDown").is_none() {
|
||||
if p.get("delete").is_none() && p.get("moveUp").is_none() && p.get("moveDown").is_none() && p.get("edit").is_none() {
|
||||
let list: Vec<Json> = s
|
||||
.doc()?
|
||||
.wb
|
||||
.sheet(sheet)
|
||||
.map(|sh| {
|
||||
sh.cond_formats.iter().map(|c| json!({"ranges": c.ranges.iter().map(|r| r.a1()).collect::<Vec<_>>(), "rule": c.rule})).collect()
|
||||
sh.cond_formats
|
||||
.iter()
|
||||
.map(|c| json!({"ranges": c.ranges.iter().map(|r| r.a1()).collect::<Vec<_>>(), "rule": c.rule, "priority": c.priority}))
|
||||
.collect()
|
||||
})
|
||||
.unwrap_or_default();
|
||||
return Ok(json!({"rules": list}));
|
||||
}
|
||||
let edited = match (p.get("edit"), p.get("rule")) {
|
||||
(None, _) => None,
|
||||
(Some(_), None) => return Err(bad("home.manageRules", "missing `rule` for an edit")),
|
||||
(Some(e), Some(rule)) => {
|
||||
let i = e.as_u64().ok_or_else(|| bad("home.manageRules", "`edit` must be a rule index"))?;
|
||||
let rule = cf_rule(rule, "home.manageRules")?;
|
||||
check_cf_rule("home.manageRules", &rule)?;
|
||||
Some((i as usize, rule))
|
||||
}
|
||||
};
|
||||
edit(s, |cx| {
|
||||
let sh = cx.sheet_mut(sheet)?;
|
||||
// The count is taken again after each step: a delete shortens the list.
|
||||
@@ -1696,6 +1746,10 @@ fn manage_cf(s: &mut Session, p: &Json) -> Result<Json> {
|
||||
{
|
||||
sh.cond_formats.remove(i);
|
||||
}
|
||||
if let Some((i, rule)) = edited {
|
||||
let cf = sh.cond_formats.get_mut(i).ok_or_else(|| bad("home.manageRules", format!("no conditional format at index {i}")))?;
|
||||
cf.rule = rule;
|
||||
}
|
||||
if let Some(i) = u32_param(p, "moveUp").map(|v| v as usize)
|
||||
&& i > 0
|
||||
&& i < sh.cond_formats.len()
|
||||
@@ -1801,4 +1855,207 @@ mod tests {
|
||||
s.execute("table.rename", json!({"table": "Table1", "name": "Table1"})).unwrap();
|
||||
s.execute("table.rename", json!({"table": "Table1", "name": "Rates"})).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn colour_scale_thresholds_are_clamped_to_the_percent_range() {
|
||||
let mut s = Session::new();
|
||||
s.new_workbook();
|
||||
s.execute(
|
||||
"home.conditionalFormat",
|
||||
json!({"range": "A1:A3", "rule": {"type": "colorScale", "stops": [
|
||||
{"type": "percent", "value": -5, "color": "#112233"},
|
||||
{"type": "percentile", "value": 150, "color": "#445566"},
|
||||
{"type": "max", "color": "#778899"},
|
||||
]}}),
|
||||
)
|
||||
.unwrap();
|
||||
let list = s.execute("home.manageRules", json!({})).unwrap();
|
||||
let rule: CfRule = serde_json::from_value(list["rules"][0]["rule"].clone()).unwrap();
|
||||
let CfRule::ColorScale { stops } = rule else { panic!("expected a colour scale") };
|
||||
assert_eq!(
|
||||
stops,
|
||||
vec![
|
||||
(CfValueKind::Percent(0.0), Color::Rgb(0x112233)),
|
||||
(CfValueKind::Percentile(100.0), Color::Rgb(0x445566)),
|
||||
(CfValueKind::Max, Color::Rgb(0x778899)),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn colour_scale_stops_reject_empty_formulas_and_unknown_types() {
|
||||
let mut s = Session::new();
|
||||
s.new_workbook();
|
||||
let with_stops = |stops: Json| json!({"range": "A1:A3", "rule": {"type": "colorScale", "stops": stops}});
|
||||
let err = s
|
||||
.execute(
|
||||
"home.conditionalFormat",
|
||||
with_stops(json!([
|
||||
{"type": "min", "color": "#112233"},
|
||||
{"type": "formula", "value": " ", "color": "#445566"},
|
||||
{"type": "max", "color": "#778899"},
|
||||
])),
|
||||
)
|
||||
.unwrap_err()
|
||||
.to_string();
|
||||
assert!(err.contains("home.conditionalFormat"), "{err}");
|
||||
assert!(err.contains("formula"), "{err}");
|
||||
|
||||
let err = s
|
||||
.execute(
|
||||
"home.conditionalFormat",
|
||||
with_stops(json!([
|
||||
{"type": "min", "color": "#112233"},
|
||||
{"type": "median", "value": 50, "color": "#445566"},
|
||||
{"type": "max", "color": "#778899"},
|
||||
])),
|
||||
)
|
||||
.unwrap_err()
|
||||
.to_string();
|
||||
assert!(err.contains("unknown stop type `median`"), "{err}");
|
||||
let rules = s.execute("home.manageRules", json!({})).unwrap();
|
||||
assert_eq!(rules["rules"].as_array().map(Vec::len), Some(0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn colour_scale_formulas_are_stored_verbatim() {
|
||||
let mut s = Session::new();
|
||||
s.new_workbook();
|
||||
s.execute(
|
||||
"home.conditionalFormat",
|
||||
json!({"range": "A1:A3", "rule": {"type": "colorScale", "stops": [
|
||||
{"type": "min", "color": "#112233"},
|
||||
{"type": "formula", "value": "=$Z$1", "color": "#445566"},
|
||||
{"type": "max", "color": "#778899"},
|
||||
]}}),
|
||||
)
|
||||
.unwrap();
|
||||
let list = s.execute("home.manageRules", json!({})).unwrap();
|
||||
let rule: CfRule = serde_json::from_value(list["rules"][0]["rule"].clone()).unwrap();
|
||||
let CfRule::ColorScale { stops } = rule else { panic!("expected a colour scale") };
|
||||
assert_eq!(stops[1].0, CfValueKind::Formula("=$Z$1".into()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn manage_rules_rejects_a_non_index_edit() {
|
||||
let mut s = Session::new();
|
||||
s.new_workbook();
|
||||
s.execute("home.conditionalFormat", json!({"range": "A1:A3", "rule": {"type": "colorScale", "colors": ["#112233", "#778899"]}})).unwrap();
|
||||
for bad in [json!("0"), json!(1.5), json!(-1), json!(true)] {
|
||||
let err = s
|
||||
.execute("home.manageRules", json!({"edit": bad, "rule": {"type": "colorScale", "colors": ["#112233", "#778899"]}}))
|
||||
.unwrap_err()
|
||||
.to_string();
|
||||
assert!(err.contains("`edit` must be a rule index"), "{err}");
|
||||
}
|
||||
let rules = s.execute("home.manageRules", json!({})).unwrap();
|
||||
assert_eq!(rules["rules"].as_array().map(Vec::len), Some(1));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn manage_rules_rejects_an_edit_past_the_last_rule() {
|
||||
let mut s = Session::new();
|
||||
s.new_workbook();
|
||||
s.execute("home.conditionalFormat", json!({"range": "A1:A3", "rule": {"type": "colorScale", "colors": ["#112233", "#778899"]}})).unwrap();
|
||||
let err = s
|
||||
.execute("home.manageRules", json!({"edit": 1, "rule": {"type": "colorScale", "colors": ["#112233", "#778899"]}}))
|
||||
.unwrap_err()
|
||||
.to_string();
|
||||
assert!(err.contains("home.manageRules"), "{err}");
|
||||
assert!(err.contains("index 1"), "{err}");
|
||||
let rules = s.execute("home.manageRules", json!({})).unwrap();
|
||||
assert_eq!(rules["rules"].as_array().map(Vec::len), Some(1), "the failed edit leaves the rule alone");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn manage_rules_names_itself_in_a_stop_count_error() {
|
||||
let mut s = Session::new();
|
||||
s.new_workbook();
|
||||
let err = s
|
||||
.execute(
|
||||
"home.manageRules",
|
||||
json!({"edit": 0, "rule": {"type": "colorScale", "stops": [
|
||||
{"type": "min", "color": "#112233"},
|
||||
]}}),
|
||||
)
|
||||
.unwrap_err()
|
||||
.to_string();
|
||||
assert!(err.contains("home.manageRules"), "{err}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_formula_rule_needs_a_formula_that_parses() {
|
||||
let mut s = Session::new();
|
||||
s.new_workbook();
|
||||
// An empty box used to create a rule that never applies.
|
||||
let err =
|
||||
s.execute("home.conditionalFormat", json!({"range": "A1:A3", "rule": {"type": "expression", "formula": ""}})).unwrap_err().to_string();
|
||||
assert!(err.contains("formula is empty"), "{err}");
|
||||
// `=C1>` used to be written as `<formula>C1></formula>`, which Excel refuses to open.
|
||||
let err = s
|
||||
.execute("home.conditionalFormat", json!({"range": "A1:A3", "rule": {"type": "expression", "formula": "=C1>"}}))
|
||||
.unwrap_err()
|
||||
.to_string();
|
||||
assert!(err.contains("invalid"), "{err}");
|
||||
assert!(err.contains("does not parse"), "{err}");
|
||||
let rules = s.execute("home.manageRules", json!({})).unwrap();
|
||||
assert_eq!(rules["rules"].as_array().map(Vec::len), Some(0), "a refused rule is not stored");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_invalid_formula_on_edit_leaves_the_rule_alone() {
|
||||
let mut s = Session::new();
|
||||
s.new_workbook();
|
||||
s.execute("home.conditionalFormat", json!({"range": "A1:A3", "rule": {"type": "expression", "formula": "A1>2"}})).unwrap();
|
||||
let err = s.execute("home.manageRules", json!({"edit": 0, "rule": {"type": "expression", "formula": "=C1>"}})).unwrap_err().to_string();
|
||||
assert!(err.contains("home.manageRules"), "{err}");
|
||||
let rule: CfRule = serde_json::from_value(s.execute("home.manageRules", json!({})).unwrap()["rules"][0]["rule"].clone()).unwrap();
|
||||
let CfRule::Expression { formula, .. } = rule else { panic!("expected a formula rule, got {rule:?}") };
|
||||
assert_eq!(formula, "A1>2");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn colour_scale_stops_keep_their_thresholds_and_can_be_edited() {
|
||||
let mut s = Session::new();
|
||||
s.new_workbook();
|
||||
s.execute(
|
||||
"home.conditionalFormat",
|
||||
json!({"range": "A1:A3", "rule": {"type": "colorScale", "stops": [
|
||||
{"type": "min", "color": "#112233"},
|
||||
{"type": "num", "value": 5, "color": "#445566"},
|
||||
{"type": "percentile", "value": 90, "color": "#778899"},
|
||||
]}}),
|
||||
)
|
||||
.unwrap();
|
||||
let list = s.execute("home.manageRules", json!({})).unwrap();
|
||||
let rule: CfRule = serde_json::from_value(list["rules"][0]["rule"].clone()).unwrap();
|
||||
let stops = match rule {
|
||||
CfRule::ColorScale { stops } => stops,
|
||||
_ => Vec::new(),
|
||||
};
|
||||
assert_eq!(
|
||||
stops,
|
||||
vec![
|
||||
(CfValueKind::Min, Color::Rgb(0x112233)),
|
||||
(CfValueKind::Number(5.0), Color::Rgb(0x445566)),
|
||||
(CfValueKind::Percentile(90.0), Color::Rgb(0x778899)),
|
||||
]
|
||||
);
|
||||
|
||||
s.execute(
|
||||
"home.manageRules",
|
||||
json!({"edit": 0, "rule": {"type": "colorScale", "stops": [
|
||||
{"type": "formula", "value": "$B$1", "color": "#ABCABC"},
|
||||
{"type": "max", "color": "#DEFDEF"},
|
||||
]}}),
|
||||
)
|
||||
.unwrap();
|
||||
let list = s.execute("home.manageRules", json!({})).unwrap();
|
||||
let rule: CfRule = serde_json::from_value(list["rules"][0]["rule"].clone()).unwrap();
|
||||
let stops = match rule {
|
||||
CfRule::ColorScale { stops } => stops,
|
||||
_ => Vec::new(),
|
||||
};
|
||||
assert_eq!(stops, vec![(CfValueKind::Formula("$B$1".into()), Color::Rgb(0xABCABC)), (CfValueKind::Max, Color::Rgb(0xDEFDEF))]);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
//! `ui.dialog.set {field, value}` edits a field and `ui.dialog.confirm` presses OK.
|
||||
|
||||
use egui::{Color32, Key, Sense, Stroke, StrokeKind, vec2};
|
||||
use gridcraft_engine::model::{CfRule, CfValueKind, Color as CellColor};
|
||||
|
||||
use crate::icons::{self, Icon};
|
||||
use gridcraft_engine::core::{CellRef, RangeRef};
|
||||
@@ -786,6 +787,12 @@ impl Dialog {
|
||||
d.values.insert("operator".into(), p("operator"));
|
||||
d
|
||||
}
|
||||
"newFormattingRule" => {
|
||||
let theme = app.session.active().map(|d| d.wb.theme.clone()).unwrap_or_default();
|
||||
let mut d = Dialog::custom("newFormattingRule", "New Formatting Rule", new_rule_defaults(¶ms, &theme));
|
||||
d.command = Some(if params.get("edit").is_some() { "home.manageRules" } else { "home.conditionalFormat" });
|
||||
d
|
||||
}
|
||||
"formatCells" => {
|
||||
let mut d = Dialog::custom("formatCells", "Format Cells", json!({}));
|
||||
d.tab = p("tab").as_str().unwrap_or("Number").to_string();
|
||||
@@ -1230,6 +1237,24 @@ pub(crate) fn build_params(d: &Dialog) -> Json {
|
||||
v["range"] = json!(pick.applies_to);
|
||||
}
|
||||
}
|
||||
"newFormattingRule" => {
|
||||
let mut out = match d.values.get("ruleType").and_then(Json::as_str).unwrap_or("allCells") {
|
||||
"formula" => {
|
||||
let formula = d.values.get("formula").and_then(Json::as_str).unwrap_or("").to_string();
|
||||
let preset = d.values.get("preset").and_then(Json::as_str).unwrap_or("lightRedFillDarkRedText");
|
||||
json!({"rule": {"type": "expression", "formula": formula, "preset": preset}})
|
||||
}
|
||||
_ => {
|
||||
let stops: Vec<Json> =
|
||||
d.values.get("stops").and_then(Json::as_array).map(|a| a.iter().map(cf_stop_params).collect()).unwrap_or_default();
|
||||
json!({"rule": {"type": "colorScale", "stops": stops}})
|
||||
}
|
||||
};
|
||||
if let Some(edit) = d.values.get("edit").and_then(Json::as_u64) {
|
||||
out["edit"] = json!(edit);
|
||||
}
|
||||
v = out;
|
||||
}
|
||||
"series" => {
|
||||
if let Some(s) = d.values.get("stop").and_then(Json::as_str).and_then(|s| s.parse::<f64>().ok()) {
|
||||
v["stop"] = json!(s);
|
||||
@@ -1263,7 +1288,7 @@ pub fn show(app: &mut SheetApp, ctx: &egui::Context) {
|
||||
let width = match d.name.as_str() {
|
||||
"formatCells" => 560.0,
|
||||
"about" => 660.0,
|
||||
"insertFunction" | "commandSearch" | "nameManager" | "manageRules" | "journal" | "agents" | "macros" => 520.0,
|
||||
"insertFunction" | "commandSearch" | "nameManager" | "manageRules" | "newFormattingRule" | "journal" | "agents" | "macros" => 520.0,
|
||||
"recommendedCharts" => 600.0,
|
||||
"analysisToolPak" => 420.0,
|
||||
"solver" => 460.0,
|
||||
@@ -1299,6 +1324,7 @@ pub fn show(app: &mut SheetApp, ctx: &egui::Context) {
|
||||
"nameManager" => name_manager(app, ui, &mut d, &mut open),
|
||||
"pasteName" => paste_name(app, ui, &mut d, &mut confirm, &mut open),
|
||||
"manageRules" => manage_rules(app, ui),
|
||||
"newFormattingRule" => new_formatting_rule(ui, &mut d, &mut confirm, &mut open),
|
||||
"recommendedCharts" => recommended_charts(app, ui, &mut d, &mut confirm, &mut open),
|
||||
"selectData" => select_data(app, ui, &mut d, &mut confirm, &mut open),
|
||||
"commandSearch" => command_search(app, ui, &mut d, &mut confirm),
|
||||
@@ -1703,6 +1729,11 @@ fn paste_special_shortcuts(d: &mut Dialog, ctx: &egui::Context) {
|
||||
}
|
||||
|
||||
fn ok_cancel(ui: &mut egui::Ui, confirm: &mut bool, open: &mut bool) {
|
||||
ok_cancel_enabled(ui, confirm, open, true);
|
||||
}
|
||||
|
||||
/// Like [`ok_cancel`], but OK (and Enter) do nothing while `enabled` is false.
|
||||
fn ok_cancel_enabled(ui: &mut egui::Ui, confirm: &mut bool, open: &mut bool, enabled: bool) {
|
||||
ui.add_space(8.0);
|
||||
// A row as tall as the buttons: a right-to-left layout straight in the window takes all the
|
||||
// height it is offered, which stretched every form dialog to the screen's height.
|
||||
@@ -1710,14 +1741,17 @@ fn ok_cancel(ui: &mut egui::Ui, confirm: &mut bool, open: &mut bool) {
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
||||
let lang = crate::i18n::current(ui.ctx());
|
||||
let t = crate::theme::Tokens::get(ui.ctx());
|
||||
let ok = ui.add(egui::Button::new(egui::RichText::new(format!(" {} ", lang.tr("OK"))).color(t.on_accent)).fill(t.accent));
|
||||
if ok.clicked() || ui.input(|i| i.key_pressed(Key::Enter)) {
|
||||
let ok = ui.add_enabled(
|
||||
enabled,
|
||||
egui::Button::new(egui::RichText::new(format!(" {} ", lang.tr("OK"))).color(t.on_accent)).fill(t.accent),
|
||||
);
|
||||
if enabled && (ok.clicked() || ui.input(|i| i.key_pressed(Key::Enter))) {
|
||||
*confirm = true;
|
||||
}
|
||||
if ui.button(format!(" {} ", lang.tr("Cancel"))).clicked() {
|
||||
*open = false;
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1931,6 +1965,280 @@ fn macros(app: &mut SheetApp, ui: &mut egui::Ui, d: &mut Dialog) {
|
||||
});
|
||||
}
|
||||
|
||||
fn cf_stop_json(kind: CfValueKind, color: &CellColor, theme: &gridcraft_engine::model::Theme) -> Json {
|
||||
let (ty, value) = match kind {
|
||||
CfValueKind::Min => ("min", Json::Null),
|
||||
CfValueKind::Max => ("max", Json::Null),
|
||||
CfValueKind::Number(n) => ("num", json!(n)),
|
||||
CfValueKind::Percent(n) => ("percent", json!(n)),
|
||||
CfValueKind::Percentile(n) => ("percentile", json!(n)),
|
||||
CfValueKind::Formula(f) => ("formula", json!(f)),
|
||||
};
|
||||
let hex = color.hex(theme).unwrap_or_else(|| "#000000".into());
|
||||
// `source` keeps a theme colour by reference: OK without touching the picker sends it back
|
||||
// unchanged, instead of freezing the theme's current RGB into the rule.
|
||||
json!({"type": ty, "value": value, "color": hex.clone(), "source": color, "sourceHex": hex})
|
||||
}
|
||||
|
||||
/// The stop as the engine takes it, dropping the dialog's bookkeeping. A colour the user did not
|
||||
/// change keeps its original theme reference; a changed one is sent as the picked RGB.
|
||||
fn cf_stop_params(stop: &Json) -> Json {
|
||||
let mut obj = stop.as_object().cloned().unwrap_or_default();
|
||||
let source = obj.remove("source").and_then(|v| serde_json::from_value::<CellColor>(v).ok());
|
||||
let source_hex = obj.remove("sourceHex").and_then(|v| v.as_str().map(str::to_string));
|
||||
if let (Some(source), Some(source_hex)) = (source, source_hex)
|
||||
&& obj.get("color").and_then(Json::as_str).is_some_and(|c| c.eq_ignore_ascii_case(&source_hex))
|
||||
{
|
||||
obj.insert(
|
||||
"color".into(),
|
||||
match source {
|
||||
CellColor::Auto => json!("auto"),
|
||||
CellColor::Rgb(v) => json!(format!("#{v:06X}")),
|
||||
CellColor::Theme(i, tint) => json!({"theme": i, "tint": tint as f64 / 1000.0}),
|
||||
},
|
||||
);
|
||||
}
|
||||
Json::Object(obj)
|
||||
}
|
||||
|
||||
fn default_scale_stops(style: &str) -> Vec<Json> {
|
||||
if style == "2color" {
|
||||
vec![json!({"type": "min", "value": null, "color": "#F8696B"}), json!({"type": "max", "value": null, "color": "#63BE7B"})]
|
||||
} else {
|
||||
vec![
|
||||
json!({"type": "min", "value": null, "color": "#F8696B"}),
|
||||
json!({"type": "percentile", "value": 50, "color": "#FFEB84"}),
|
||||
json!({"type": "max", "value": null, "color": "#63BE7B"}),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
fn new_rule_defaults(params: &Json, theme: &gridcraft_engine::model::Theme) -> Json {
|
||||
// Excel's New Formatting Rule opens on the first type. Manage Rules edits a colour scale,
|
||||
// so an edit always stays on that branch.
|
||||
let mut rule_type = params.get("ruleType").and_then(Json::as_str).unwrap_or("allCells").to_string();
|
||||
if params.get("edit").is_some() || !matches!(rule_type.as_str(), "allCells" | "formula") {
|
||||
rule_type = "allCells".into();
|
||||
}
|
||||
let mut style = params.get("style").and_then(Json::as_str).unwrap_or("3color").to_string();
|
||||
if !matches!(style.as_str(), "2color" | "3color") {
|
||||
style = "3color".into();
|
||||
}
|
||||
let existing = params.get("rule").and_then(|rule| serde_json::from_value::<CfRule>(rule.clone()).ok()).and_then(|rule| match rule {
|
||||
CfRule::ColorScale { stops } if (2..=3).contains(&stops.len()) => {
|
||||
Some(stops.into_iter().map(|(kind, color)| cf_stop_json(kind, &color, theme)).collect::<Vec<_>>())
|
||||
}
|
||||
_ => None,
|
||||
});
|
||||
let stops = match existing {
|
||||
Some(stops) => {
|
||||
style = if stops.len() == 2 { "2color".into() } else { "3color".into() };
|
||||
stops
|
||||
}
|
||||
None => default_scale_stops(&style),
|
||||
};
|
||||
json!({
|
||||
"ruleType": rule_type,
|
||||
"style": style,
|
||||
"stops": stops,
|
||||
"formula": "",
|
||||
"preset": "lightRedFillDarkRedText",
|
||||
"edit": params.get("edit").cloned(),
|
||||
})
|
||||
}
|
||||
|
||||
fn parse_hex_color(s: &str) -> Color32 {
|
||||
let h = s.trim_start_matches('#');
|
||||
u32::from_str_radix(h.get(..6).unwrap_or("000000"), 16)
|
||||
.map(|v| Color32::from_rgb((v >> 16) as u8, (v >> 8) as u8, v as u8))
|
||||
.unwrap_or(Color32::WHITE)
|
||||
}
|
||||
|
||||
fn hex_color(c: Color32) -> String {
|
||||
format!("#{:02X}{:02X}{:02X}", c.r(), c.g(), c.b())
|
||||
}
|
||||
|
||||
fn scale_preview(ui: &mut egui::Ui, stops: &[Json]) {
|
||||
let (rect, _) = ui.allocate_exact_size(vec2(280.0, 26.0), Sense::hover());
|
||||
let colors: Vec<Color32> = stops.iter().map(|s| parse_hex_color(s.get("color").and_then(Json::as_str).unwrap_or("#FFFFFF"))).collect();
|
||||
if colors.is_empty() {
|
||||
return;
|
||||
}
|
||||
let n = 64;
|
||||
for i in 0..n {
|
||||
let t = i as f32 / (n - 1) as f32;
|
||||
let pos = t * (colors.len() - 1) as f32;
|
||||
let lo = pos.floor() as usize;
|
||||
let hi = (lo + 1).min(colors.len() - 1);
|
||||
let f = pos - lo as f32;
|
||||
let a = colors[lo];
|
||||
let b = colors[hi];
|
||||
let c = Color32::from_rgb(
|
||||
(a.r() as f32 + (b.r() as f32 - a.r() as f32) * f) as u8,
|
||||
(a.g() as f32 + (b.g() as f32 - a.g() as f32) * f) as u8,
|
||||
(a.b() as f32 + (b.b() as f32 - a.b() as f32) * f) as u8,
|
||||
);
|
||||
let x = rect.left() + rect.width() * i as f32 / n as f32;
|
||||
ui.painter().rect_filled(egui::Rect::from_min_size(egui::pos2(x, rect.top()), vec2(rect.width() / n as f32 + 0.5, rect.height())), 0.0, c);
|
||||
}
|
||||
ui.painter().rect_stroke(rect, 0.0, Stroke::new(1.0, Color32::from_gray(190)), StrokeKind::Inside);
|
||||
}
|
||||
|
||||
fn stop_combo(ui: &mut egui::Ui, id: (&'static str, usize), current: &mut String, options: &[(&str, &str)], lang: crate::i18n::Language) {
|
||||
let shown = options.iter().find(|(v, _)| *v == current).map(|(_, l)| lang.tr(l)).unwrap_or(current.as_str());
|
||||
egui::ComboBox::from_id_salt(id).selected_text(shown).width(120.0).show_ui(ui, |ui| {
|
||||
for (v, l) in options {
|
||||
if ui.selectable_label(current == v, lang.tr(l)).clicked() {
|
||||
*current = (*v).to_string();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn colour_scale_editor(ui: &mut egui::Ui, d: &mut Dialog, lang: crate::i18n::Language) {
|
||||
ui.label(lang.tr("Format all cells based on their values"));
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(lang.tr("Format Style:"));
|
||||
let mut style = d.values.get("style").and_then(Json::as_str).unwrap_or("3color").to_string();
|
||||
egui::ComboBox::from_id_salt("newFormattingRule.style")
|
||||
.selected_text(lang.tr(if style == "2color" { "2-Color Scale" } else { "3-Color Scale" }))
|
||||
.width(150.0)
|
||||
.show_ui(ui, |ui| {
|
||||
for (v, l) in [("2color", "2-Color Scale"), ("3color", "3-Color Scale")] {
|
||||
if ui.selectable_label(style == v, lang.tr(l)).clicked() {
|
||||
style = v.to_string();
|
||||
}
|
||||
}
|
||||
});
|
||||
d.values.insert("style".into(), json!(style));
|
||||
let mut stops = d.values.get("stops").and_then(Json::as_array).cloned().unwrap_or_default();
|
||||
if style == "2color" && stops.len() == 3 {
|
||||
stops.remove(1);
|
||||
} else if style == "3color" && stops.len() == 2 {
|
||||
stops.insert(1, json!({"type": "percentile", "value": 50, "color": "#FFEB84"}));
|
||||
}
|
||||
d.values.insert("stops".into(), Json::Array(stops));
|
||||
});
|
||||
let mut stops = d.values.get("stops").and_then(Json::as_array).cloned().unwrap_or_default();
|
||||
let count = stops.len();
|
||||
for i in 0..count {
|
||||
let mut obj = stops.get(i).and_then(Json::as_object).cloned().unwrap_or_default();
|
||||
let mut ty = obj.get("type").and_then(Json::as_str).unwrap_or("num").to_string();
|
||||
let options: &[(&str, &str)] = if i == 0 {
|
||||
&[("min", "Lowest value"), ("num", "Number"), ("percent", "Percent"), ("percentile", "Percentile"), ("formula", "Formula")]
|
||||
} else if i + 1 == count {
|
||||
&[("max", "Highest value"), ("num", "Number"), ("percent", "Percent"), ("percentile", "Percentile"), ("formula", "Formula")]
|
||||
} else {
|
||||
&[("num", "Number"), ("percent", "Percent"), ("percentile", "Percentile"), ("formula", "Formula")]
|
||||
};
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(lang.tr(if i == 0 {
|
||||
"Minimum"
|
||||
} else if i + 1 == count {
|
||||
"Maximum"
|
||||
} else {
|
||||
"Midpoint"
|
||||
}));
|
||||
stop_combo(ui, ("newFormattingRule.stopType", i), &mut ty, options, lang);
|
||||
match ty.as_str() {
|
||||
"min" | "max" => {
|
||||
ui.label(lang.tr(if ty == "min" { "Lowest value" } else { "Highest value" }));
|
||||
}
|
||||
"formula" => {
|
||||
let mut f = obj.get("value").and_then(Json::as_str).unwrap_or("").to_string();
|
||||
if ui.add(egui::TextEdit::singleline(&mut f).desired_width(120.0).hint_text(lang.tr("Formula"))).changed() {
|
||||
obj.insert("value".into(), json!(f));
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
let mut n = obj.get("value").and_then(Json::as_f64).unwrap_or(0.0);
|
||||
let speed = if ty == "num" { 1.0 } else { 0.1 };
|
||||
if ui.add(egui::DragValue::new(&mut n).speed(speed).range(if ty == "num" { f64::MIN..=f64::MAX } else { 0.0..=100.0 })).changed()
|
||||
{
|
||||
obj.insert("value".into(), json!(n));
|
||||
}
|
||||
}
|
||||
}
|
||||
let c = parse_hex_color(obj.get("color").and_then(Json::as_str).unwrap_or("#FFFFFF"));
|
||||
let mut rgb = [c.r(), c.g(), c.b()];
|
||||
if ui.color_edit_button_srgb(&mut rgb).changed() {
|
||||
obj.insert("color".into(), json!(hex_color(Color32::from_rgb(rgb[0], rgb[1], rgb[2]))));
|
||||
}
|
||||
});
|
||||
obj.insert("type".into(), json!(ty));
|
||||
stops[i] = Json::Object(obj);
|
||||
}
|
||||
d.values.insert("stops".into(), Json::Array(stops.clone()));
|
||||
scale_preview(ui, &stops);
|
||||
}
|
||||
|
||||
fn preset_combo(ui: &mut egui::Ui, d: &mut Dialog, lang: crate::i18n::Language) {
|
||||
const PRESETS: &[(&str, &str)] = &[
|
||||
("lightRedFillDarkRedText", "Light Red Fill with Dark Red Text"),
|
||||
("yellowFillDarkYellowText", "Yellow Fill with Dark Yellow Text"),
|
||||
("greenFillDarkGreenText", "Green Fill with Dark Green Text"),
|
||||
("lightRedFill", "Light Red Fill"),
|
||||
("redText", "Red Text"),
|
||||
("redBorder", "Red Border"),
|
||||
];
|
||||
let mut preset = d.values.get("preset").and_then(Json::as_str).unwrap_or("lightRedFillDarkRedText").to_string();
|
||||
let shown = PRESETS.iter().find(|(v, _)| *v == preset).map(|(_, l)| lang.tr(l)).unwrap_or(preset.as_str());
|
||||
egui::ComboBox::from_id_salt("newFormattingRule.preset").selected_text(shown).width(260.0).show_ui(ui, |ui| {
|
||||
for (v, l) in PRESETS {
|
||||
if ui.selectable_label(preset == *v, lang.tr(l)).clicked() {
|
||||
preset = (*v).to_string();
|
||||
}
|
||||
}
|
||||
});
|
||||
d.values.insert("preset".into(), json!(preset));
|
||||
}
|
||||
|
||||
/// Excel's six rule types, in its order.
|
||||
const RULE_TYPES: &[(&str, &str)] = &[
|
||||
("allCells", "Format all cells based on their values"),
|
||||
("cellsThatContain", "Format only cells that contain"),
|
||||
("topBottom", "Format only top or bottom ranked values"),
|
||||
("aboveBelow", "Format only values that are above or below average"),
|
||||
("uniqueDuplicate", "Format only unique or duplicate values"),
|
||||
("formula", "Use a formula to determine which cells to format"),
|
||||
];
|
||||
|
||||
fn new_formatting_rule(ui: &mut egui::Ui, d: &mut Dialog, confirm: &mut bool, open: &mut bool) {
|
||||
let lang = crate::i18n::current(ui.ctx());
|
||||
ui.label(lang.tr("Select a Rule Type"));
|
||||
let mut rule_type = d.values.get("ruleType").and_then(Json::as_str).unwrap_or("allCells").to_string();
|
||||
for (v, label) in RULE_TYPES {
|
||||
ui.selectable_value(&mut rule_type, (*v).to_string(), lang.tr(label));
|
||||
}
|
||||
d.values.insert("ruleType".into(), json!(rule_type));
|
||||
ui.separator();
|
||||
ui.label(lang.tr("Edit the Rule Description"));
|
||||
let supported = match rule_type.as_str() {
|
||||
"allCells" => {
|
||||
colour_scale_editor(ui, d, lang);
|
||||
true
|
||||
}
|
||||
"formula" => {
|
||||
ui.label(lang.tr("Format values where this formula is true:"));
|
||||
let mut formula = d.values.get("formula").and_then(Json::as_str).unwrap_or("").to_string();
|
||||
if ui.add(egui::TextEdit::singleline(&mut formula).desired_width(360.0)).changed() {
|
||||
d.values.insert("formula".into(), json!(formula.clone()));
|
||||
}
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(lang.tr("with"));
|
||||
preset_combo(ui, d, lang);
|
||||
});
|
||||
// A formula rule with no formula never applies; OK waits for one.
|
||||
!formula.trim().is_empty()
|
||||
}
|
||||
_ => {
|
||||
ui.label(lang.tr("This rule type isn't available yet."));
|
||||
false
|
||||
}
|
||||
};
|
||||
ok_cancel_enabled(ui, confirm, open, supported);
|
||||
}
|
||||
|
||||
/// Draws the six-tab Format Cells editor (number, alignment, font, border, fill, protection); the Number tab shows a sample preview, and the style draft updates.
|
||||
fn format_cells(app: &mut SheetApp, ui: &mut egui::Ui, d: &mut Dialog, confirm: &mut bool) {
|
||||
// `d.tab` stays the English name (it is what `open_dialog` and tests pass); only the drawn
|
||||
@@ -2844,6 +3152,9 @@ fn manage_rules(app: &mut SheetApp, ui: &mut egui::Ui) {
|
||||
i + 1,
|
||||
r["ranges"].as_array().map(|a| a.iter().filter_map(|x| x.as_str()).collect::<Vec<_>>().join(",")).unwrap_or_default()
|
||||
));
|
||||
if kind.contains("ColorScale") && ui.small_button("Edit").clicked() {
|
||||
app.open_dialog("newFormattingRule", json!({"edit": i, "rule": r["rule"].clone()}));
|
||||
}
|
||||
if ui.small_button("▲").clicked() {
|
||||
app.run_or_alert("home.manageRules", json!({"moveUp": i}));
|
||||
}
|
||||
|
||||
@@ -545,6 +545,31 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
"Previous sheet" => "Předchozí list",
|
||||
"Zoom In" => "Přiblížit",
|
||||
"Zoom Out" => "Oddálit",
|
||||
// Conditional formatting: colour scales.
|
||||
"New Formatting Rule" => "Nové pravidlo formátování",
|
||||
"Format all cells based on their values" => "Formátovat všechny buňky podle jejich hodnot",
|
||||
"Format Style:" => "Styl formátu:",
|
||||
"2-Color Scale" => "Dvoubarevná škála",
|
||||
"3-Color Scale" => "Tříbarevná škála",
|
||||
"Lowest value" => "Nejnižší hodnota",
|
||||
"Highest value" => "Nejvyšší hodnota",
|
||||
"Percent" => "Procento",
|
||||
"Percentile" => "Percentil",
|
||||
"Formula" => "Vzorec",
|
||||
"Minimum" => "Minimum",
|
||||
"Maximum" => "Maximum",
|
||||
"Midpoint" => "Střední bod",
|
||||
"More Rules…" => "Další pravidla…",
|
||||
"Select a Rule Type" => "Vybrat typ pravidla",
|
||||
"Edit the Rule Description" => "Upravit popis pravidla",
|
||||
"Format only cells that contain" => "Formátovat pouze buňky, které obsahují",
|
||||
"Format only top or bottom ranked values" => "Formátovat pouze hodnoty s nejvyšším nebo nejnižším pořadím",
|
||||
"Format only values that are above or below average" => "Formátovat pouze hodnoty nad nebo pod průměrem",
|
||||
"Format only unique or duplicate values" => "Formátovat pouze jedinečné nebo duplicitní hodnoty",
|
||||
"Use a formula to determine which cells to format" => "Pomocí vzorce určit, které buňky se mají formátovat",
|
||||
"Format values where this formula is true:" => "Formátovat hodnoty, pro které platí tento vzorec:",
|
||||
"with" => "s",
|
||||
"This rule type isn't available yet." => "Tento typ pravidla zatím není dostupný.",
|
||||
// widgets.rs (alphabetical keys).
|
||||
"Dismiss" => "Zavřít",
|
||||
"Rename" => "Přejmenovat",
|
||||
|
||||
@@ -462,6 +462,30 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
"All sheets" => "Alle Blätter",
|
||||
"New sheet (⇧F11)" => "Neues Blatt (⇧F11)",
|
||||
"Text Box" => "Textfeld",
|
||||
"New Formatting Rule" => "Neue Formatierungsregel",
|
||||
"Format all cells based on their values" => "Alle Zellen basierend auf ihren Werten formatieren",
|
||||
"Format Style:" => "Formatvorlage:",
|
||||
"2-Color Scale" => "2-Farben-Skala",
|
||||
"3-Color Scale" => "3-Farben-Skala",
|
||||
"Lowest value" => "Niedrigster Wert",
|
||||
"Highest value" => "Höchster Wert",
|
||||
"Percent" => "Prozent",
|
||||
"Percentile" => "Perzentil",
|
||||
"Formula" => "Formel",
|
||||
"Minimum" => "Minimum",
|
||||
"Maximum" => "Maximum",
|
||||
"Midpoint" => "Mittelpunkt",
|
||||
"More Rules…" => "Weitere Regeln…",
|
||||
"Select a Rule Type" => "Regeltyp auswählen",
|
||||
"Edit the Rule Description" => "Regelbeschreibung bearbeiten",
|
||||
"Format only cells that contain" => "Nur Zellen formatieren, die enthalten",
|
||||
"Format only top or bottom ranked values" => "Nur Werte formatieren, die oben oder unten eingestuft sind",
|
||||
"Format only values that are above or below average" => "Nur Werte formatieren, die über oder unter dem Durchschnitt liegen",
|
||||
"Format only unique or duplicate values" => "Nur eindeutige oder doppelte Werte formatieren",
|
||||
"Use a formula to determine which cells to format" => "Formel zur Ermittlung der zu formatierenden Zellen verwenden",
|
||||
"Format values where this formula is true:" => "Werte formatieren, für die diese Formel wahr ist:",
|
||||
"with" => "mit",
|
||||
"This rule type isn't available yet." => "Dieser Regeltyp ist noch nicht verfügbar.",
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
@@ -478,6 +478,30 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
"All sheets" => "Todas las hojas",
|
||||
"New sheet (⇧F11)" => "Nueva hoja (⇧F11)",
|
||||
"Text Box" => "Cuadro de texto",
|
||||
"New Formatting Rule" => "Nueva regla de formato",
|
||||
"Format all cells based on their values" => "Dar formato a todas las celdas según sus valores",
|
||||
"Format Style:" => "Estilo de formato:",
|
||||
"2-Color Scale" => "Escala de 2 colores",
|
||||
"3-Color Scale" => "Escala de 3 colores",
|
||||
"Lowest value" => "Valor mínimo",
|
||||
"Highest value" => "Valor máximo",
|
||||
"Percent" => "Porcentaje",
|
||||
"Percentile" => "Percentil",
|
||||
"Formula" => "Fórmula",
|
||||
"Minimum" => "Mínimo",
|
||||
"Maximum" => "Máximo",
|
||||
"Midpoint" => "Punto medio",
|
||||
"More Rules…" => "Más reglas…",
|
||||
"Select a Rule Type" => "Seleccionar un tipo de regla",
|
||||
"Edit the Rule Description" => "Editar la descripción de la regla",
|
||||
"Format only cells that contain" => "Dar formato solo a las celdas que contengan",
|
||||
"Format only top or bottom ranked values" => "Dar formato solo a los valores con clasificación superior o inferior",
|
||||
"Format only values that are above or below average" => "Dar formato solo a los valores que estén por encima o por debajo del promedio",
|
||||
"Format only unique or duplicate values" => "Dar formato solo a los valores únicos o duplicados",
|
||||
"Use a formula to determine which cells to format" => "Usar una fórmula para determinar qué celdas se van a aplicar formato",
|
||||
"Format values where this formula is true:" => "Dar formato a los valores donde esta fórmula sea verdadera:",
|
||||
"with" => "con",
|
||||
"This rule type isn't available yet." => "Este tipo de regla aún no está disponible.",
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
@@ -450,6 +450,30 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
"All sheets" => "Toutes les feuilles",
|
||||
"New sheet (⇧F11)" => "Nouvelle feuille (⇧F11)",
|
||||
"Text Box" => "Zone de texte",
|
||||
"New Formatting Rule" => "Nouvelle règle de mise en forme",
|
||||
"Format all cells based on their values" => "Mettre en forme toutes les cellules en fonction de leurs valeurs",
|
||||
"Format Style:" => "Style de mise en forme :",
|
||||
"2-Color Scale" => "Échelle à 2 couleurs",
|
||||
"3-Color Scale" => "Échelle à 3 couleurs",
|
||||
"Lowest value" => "Valeur la plus basse",
|
||||
"Highest value" => "Valeur la plus haute",
|
||||
"Percent" => "Pourcentage",
|
||||
"Percentile" => "Centile",
|
||||
"Formula" => "Formule",
|
||||
"Minimum" => "Minimum",
|
||||
"Maximum" => "Maximum",
|
||||
"Midpoint" => "Point milieu",
|
||||
"More Rules…" => "Autres règles…",
|
||||
"Select a Rule Type" => "Sélectionner un type de règle",
|
||||
"Edit the Rule Description" => "Modifier la description de la règle",
|
||||
"Format only cells that contain" => "Mettre en forme uniquement les cellules qui contiennent",
|
||||
"Format only top or bottom ranked values" => "Mettre en forme uniquement les valeurs classées en haut ou en bas",
|
||||
"Format only values that are above or below average" => "Mettre en forme uniquement les valeurs supérieures ou inférieures à la moyenne",
|
||||
"Format only unique or duplicate values" => "Mettre en forme uniquement les valeurs uniques ou en double",
|
||||
"Use a formula to determine which cells to format" => "Utiliser une formule pour déterminer pour quelles cellules le format sera appliqué",
|
||||
"Format values where this formula is true:" => "Mettre en forme les valeurs pour lesquelles cette formule est vraie :",
|
||||
"with" => "avec",
|
||||
"This rule type isn't available yet." => "Ce type de règle n'est pas encore disponible.",
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
@@ -990,6 +990,27 @@ pub(super) const DIALOGS: &[(&str, &str)] = &[
|
||||
("Tab Color", "シートの見出しの色"),
|
||||
("Unhide…", "再表示…"),
|
||||
("Unprotect Sheet…", "シート保護の解除…"),
|
||||
("New Formatting Rule", "新しい書式ルール"),
|
||||
("Format all cells based on their values", "値に基づいてすべてのセルを書式設定"),
|
||||
("Format Style:", "書式スタイル:"),
|
||||
("2-Color Scale", "2 色スケール"),
|
||||
("3-Color Scale", "3 色スケール"),
|
||||
("Lowest value", "最小値"),
|
||||
("Highest value", "最大値"),
|
||||
("Percentile", "パーセンタイル"),
|
||||
("Formula", "数式"),
|
||||
("Minimum", "最小"),
|
||||
("Maximum", "最大"),
|
||||
("Midpoint", "中間"),
|
||||
("More Rules…", "その他のルール…"),
|
||||
("Select a Rule Type", "ルールの種類を選択"),
|
||||
("Edit the Rule Description", "ルールの説明を編集"),
|
||||
("Format only cells that contain", "含むセルのみを書式設定"),
|
||||
("Format only top or bottom ranked values", "上位または下位に入る値のみを書式設定"),
|
||||
("Format only values that are above or below average", "平均より上または下の値のみを書式設定"),
|
||||
("Format only unique or duplicate values", "重複する値または一意の値のみを書式設定"),
|
||||
("Use a formula to determine which cells to format", "数式を使用して、書式設定するセルを決定"),
|
||||
("This rule type isn't available yet.", "このルールの種類はまだ使用できません。"),
|
||||
];
|
||||
|
||||
/// Labels of the ribbon menus, pop-ups and palettes that the reference catalog does not cover (the
|
||||
|
||||
@@ -446,6 +446,30 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
"All sheets" => "모든 시트",
|
||||
"New sheet (⇧F11)" => "새 시트 (⇧F11)",
|
||||
"Text Box" => "텍스트 상자",
|
||||
"New Formatting Rule" => "새 서식 규칙",
|
||||
"Format all cells based on their values" => "해당 값에 따라 모든 셀의 서식 지정",
|
||||
"Format Style:" => "서식 스타일:",
|
||||
"2-Color Scale" => "2색조 눈금",
|
||||
"3-Color Scale" => "3색조 눈금",
|
||||
"Lowest value" => "최저값",
|
||||
"Highest value" => "최고값",
|
||||
"Percent" => "백분율",
|
||||
"Percentile" => "백분위수",
|
||||
"Formula" => "수식",
|
||||
"Minimum" => "최소",
|
||||
"Maximum" => "최대",
|
||||
"Midpoint" => "중간점",
|
||||
"More Rules…" => "기타 규칙…",
|
||||
"Select a Rule Type" => "규칙 유형 선택",
|
||||
"Edit the Rule Description" => "규칙 설명 편집",
|
||||
"Format only cells that contain" => "다음을 포함하는 셀만 서식 지정",
|
||||
"Format only top or bottom ranked values" => "순위가 위 또는 아래인 값만 서식 지정",
|
||||
"Format only values that are above or below average" => "평균보다 높거나 낮은 값만 서식 지정",
|
||||
"Format only unique or duplicate values" => "고유하거나 중복되는 값만 서식 지정",
|
||||
"Use a formula to determine which cells to format" => "수식을 사용하여 서식을 지정할 셀 결정",
|
||||
"Format values where this formula is true:" => "다음 수식을 만족하는 값에 서식 지정:",
|
||||
"with" => "서식:",
|
||||
"This rule type isn't available yet." => "이 규칙 유형은 아직 사용할 수 없습니다.",
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
@@ -982,6 +982,28 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
"Salvamento automático: salvar após cada alteração (pastas de trabalho salvas em um arquivo)"
|
||||
}
|
||||
"All sheets" => "Todas as planilhas",
|
||||
"New Formatting Rule" => "Nova Regra de Formatação",
|
||||
"Format all cells based on their values" => "Formatar todas as células com base em seus valores",
|
||||
"Format Style:" => "Estilo de Formatação:",
|
||||
"2-Color Scale" => "Escala de 2 Cores",
|
||||
"3-Color Scale" => "Escala de 3 Cores",
|
||||
"Lowest value" => "Valor mais baixo",
|
||||
"Highest value" => "Valor mais alto",
|
||||
"Percent" => "Porcentagem",
|
||||
"Percentile" => "Percentil",
|
||||
"Formula" => "Fórmula",
|
||||
"Minimum" => "Mínimo",
|
||||
"Maximum" => "Máximo",
|
||||
"Midpoint" => "Ponto Médio",
|
||||
"More Rules…" => "Mais Regras…",
|
||||
"Select a Rule Type" => "Selecionar um Tipo de Regra",
|
||||
"Edit the Rule Description" => "Editar a Descrição da Regra",
|
||||
"Format only cells that contain" => "Formatar apenas células que contenham",
|
||||
"Format only top or bottom ranked values" => "Formatar apenas valores classificados acima ou abaixo",
|
||||
"Format only values that are above or below average" => "Formatar apenas valores acima ou abaixo da média",
|
||||
"Format only unique or duplicate values" => "Formatar apenas valores exclusivos ou duplicados",
|
||||
"Use a formula to determine which cells to format" => "Usar uma fórmula para determinar quais células devem ser formatadas",
|
||||
"This rule type isn't available yet." => "Este tipo de regra ainda não está disponível.",
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
@@ -448,6 +448,30 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
"All sheets" => "Все листы",
|
||||
"New sheet (⇧F11)" => "Новый лист (⇧F11)",
|
||||
"Text Box" => "Надпись",
|
||||
"New Formatting Rule" => "Новое правило форматирования",
|
||||
"Format all cells based on their values" => "Форматировать все ячейки на основе их значений",
|
||||
"Format Style:" => "Стиль формата:",
|
||||
"2-Color Scale" => "Двухцветная шкала",
|
||||
"3-Color Scale" => "Трехцветная шкала",
|
||||
"Lowest value" => "Наименьшее значение",
|
||||
"Highest value" => "Наибольшее значение",
|
||||
"Percent" => "Процент",
|
||||
"Percentile" => "Процентиль",
|
||||
"Formula" => "Формула",
|
||||
"Minimum" => "Минимум",
|
||||
"Maximum" => "Максимум",
|
||||
"Midpoint" => "Средняя точка",
|
||||
"More Rules…" => "Другие правила…",
|
||||
"Select a Rule Type" => "Выбор типа правила",
|
||||
"Edit the Rule Description" => "Изменение описания правила",
|
||||
"Format only cells that contain" => "Форматировать только ячейки, которые содержат",
|
||||
"Format only top or bottom ranked values" => "Форматировать только значения, имеющие верхний или нижний рейтинг",
|
||||
"Format only values that are above or below average" => "Форматировать только значения выше или ниже среднего",
|
||||
"Format only unique or duplicate values" => "Форматировать только уникальные или повторяющиеся значения",
|
||||
"Use a formula to determine which cells to format" => "Использовать формулу для определения форматируемых ячеек",
|
||||
"Format values where this formula is true:" => "Форматировать значения, для которых следующая формула является истинной:",
|
||||
"with" => "с форматом",
|
||||
"This rule type isn't available yet." => "Этот тип правила пока недоступен.",
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
@@ -446,6 +446,30 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
"All sheets" => "Сви листови",
|
||||
"New sheet (⇧F11)" => "Нови лист (⇧F11)",
|
||||
"Text Box" => "Текстуално поље",
|
||||
"New Formatting Rule" => "Novo pravilo oblikovanja",
|
||||
"Format all cells based on their values" => "Oblikuj sve ćelije na osnovu njihovih vrednosti",
|
||||
"Format Style:" => "Stil oblikovanja:",
|
||||
"2-Color Scale" => "Dvobojna skala",
|
||||
"3-Color Scale" => "Trobojna skala",
|
||||
"Lowest value" => "Najniža vrednost",
|
||||
"Highest value" => "Najviša vrednost",
|
||||
"Percent" => "Procenat",
|
||||
"Percentile" => "Percentil",
|
||||
"Formula" => "Formula",
|
||||
"Minimum" => "Minimum",
|
||||
"Maximum" => "Maksimum",
|
||||
"Midpoint" => "Srednja tačka",
|
||||
"More Rules…" => "Druga pravila…",
|
||||
"Select a Rule Type" => "Izaberi tip pravila",
|
||||
"Edit the Rule Description" => "Uredi opis pravila",
|
||||
"Format only cells that contain" => "Oblikuj samo ćelije koje sadrže",
|
||||
"Format only top or bottom ranked values" => "Oblikuj samo vrednosti rangirane na vrhu ili dnu",
|
||||
"Format only values that are above or below average" => "Oblikuj samo vrednosti iznad ili ispod proseka",
|
||||
"Format only unique or duplicate values" => "Oblikuj samo jedinstvene ili duplikatne vrednosti",
|
||||
"Use a formula to determine which cells to format" => "Koristi formulu za određivanje ćelija koje se oblikuju",
|
||||
"Format values where this formula is true:" => "Oblikuj vrednosti za koje je ova formula tačna:",
|
||||
"with" => "sa",
|
||||
"This rule type isn't available yet." => "Ovaj tip pravila još nije dostupan.",
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
@@ -438,6 +438,30 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
|
||||
"All sheets" => "所有工作表",
|
||||
"New sheet (⇧F11)" => "新建工作表 (⇧F11)",
|
||||
"Text Box" => "文本框",
|
||||
"New Formatting Rule" => "新建格式规则",
|
||||
"Format all cells based on their values" => "基于各自值设置所有单元格的格式",
|
||||
"Format Style:" => "格式样式:",
|
||||
"2-Color Scale" => "双色刻度",
|
||||
"3-Color Scale" => "三色刻度",
|
||||
"Lowest value" => "最小值",
|
||||
"Highest value" => "最大值",
|
||||
"Percent" => "百分比",
|
||||
"Percentile" => "百分位",
|
||||
"Formula" => "公式",
|
||||
"Minimum" => "最小",
|
||||
"Maximum" => "最大",
|
||||
"Midpoint" => "中点",
|
||||
"More Rules…" => "其他规则…",
|
||||
"Select a Rule Type" => "选择规则类型",
|
||||
"Edit the Rule Description" => "编辑规则说明",
|
||||
"Format only cells that contain" => "仅对包含以下内容的单元格设置格式",
|
||||
"Format only top or bottom ranked values" => "仅对排名靠前或靠后的数值设置格式",
|
||||
"Format only values that are above or below average" => "仅对高于或低于平均值的数值设置格式",
|
||||
"Format only unique or duplicate values" => "仅对唯一值或重复值设置格式",
|
||||
"Use a formula to determine which cells to format" => "使用公式确定要设置格式的单元格",
|
||||
"Format values where this formula is true:" => "为符合此公式的值设置格式:",
|
||||
"with" => "格式:",
|
||||
"This rule type isn't available yet." => "此规则类型尚不可用。",
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
@@ -1469,6 +1469,10 @@ fn cf_menu(app: &mut SheetApp, ui: &mut Ui) {
|
||||
act(app, "home.conditionalFormat", json!({"rule": {"type": "colorScale", "colors": cols}}));
|
||||
}
|
||||
}
|
||||
ui.separator();
|
||||
if ui.button("More Rules…").clicked() {
|
||||
app.open_dialog("newFormattingRule", json!({"style": "3color"}));
|
||||
}
|
||||
});
|
||||
ui.menu_button("Icon Sets", |ui| {
|
||||
for (label, set) in [
|
||||
@@ -1486,7 +1490,7 @@ fn cf_menu(app: &mut SheetApp, ui: &mut Ui) {
|
||||
});
|
||||
ui.separator();
|
||||
if ui.button("New Rule…").clicked() {
|
||||
app.open_dialog("cfQuick", json!({"type": "expression", "title": "New Formatting Rule"}));
|
||||
app.open_dialog("newFormattingRule", json!({}));
|
||||
}
|
||||
ui.menu_button("Clear Rules", |ui| {
|
||||
menu_items(
|
||||
@@ -2959,6 +2963,34 @@ mod title_bar_tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod ribbon_tests {
|
||||
use super::*;
|
||||
use egui_kittest::kittest::Queryable;
|
||||
|
||||
#[test]
|
||||
fn new_rule_opens_the_rule_type_list_with_the_formula_entry() {
|
||||
let mut session = gridcraft_engine::Session::new();
|
||||
session.new_workbook();
|
||||
let app = SheetApp::new(session, Default::default());
|
||||
let mut h = egui_kittest::Harness::builder().with_size(vec2(900.0, 800.0)).build_ui_state(
|
||||
|ui, app: &mut SheetApp| {
|
||||
cf_menu(app, ui);
|
||||
crate::dialogs::show(app, ui.ctx());
|
||||
},
|
||||
app,
|
||||
);
|
||||
h.run_steps(2);
|
||||
h.get_by_label("New Rule…").click();
|
||||
h.run_steps(2);
|
||||
let d = h.state().dialog.as_ref().expect("New Rule… opens a dialog");
|
||||
assert_eq!(d.name(), "newFormattingRule");
|
||||
assert_eq!(d.values.get("ruleType").and_then(serde_json::Value::as_str), Some("allCells"));
|
||||
// Formula rules stay reachable: New Rule… shows Excel's rule-type list, formula entry included.
|
||||
h.get_by_label("Use a formula to determine which cells to format");
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod checkbox_on_tests {
|
||||
use super::*;
|
||||
|
||||
@@ -0,0 +1,249 @@
|
||||
//! New Formatting Rule: the 2-/3-colour scale branch and in-place editing.
|
||||
|
||||
use egui::vec2;
|
||||
use egui_kittest::kittest::Queryable;
|
||||
use gridcraft_engine::Session;
|
||||
use gridcraft_engine::model::{CfRule, CfValueKind, Color};
|
||||
use gridcraft_ui_egui::SheetApp;
|
||||
use serde_json::json;
|
||||
|
||||
fn harness() -> egui_kittest::Harness<'static, SheetApp> {
|
||||
let mut session = Session::new();
|
||||
session.new_workbook();
|
||||
session.run("range.setValues", json!({"range": "A1:A3", "values": [[1], [2], [3]]})).unwrap();
|
||||
session.run("selection.set", json!({"range": "A1:A3"})).unwrap();
|
||||
let mut h = egui_kittest::Harness::builder().with_size(vec2(1200.0, 800.0)).build_ui_state(
|
||||
|ui, app: &mut SheetApp| {
|
||||
app.logic(&ui.ctx().clone());
|
||||
app.ui(ui);
|
||||
},
|
||||
SheetApp::new(session, Default::default()),
|
||||
);
|
||||
h.run_steps(6);
|
||||
h
|
||||
}
|
||||
|
||||
fn stops(h: &egui_kittest::Harness<'static, SheetApp>) -> Vec<(CfValueKind, Color)> {
|
||||
let doc = h.state().session.active().unwrap();
|
||||
let rule = &doc.wb.active().unwrap().cond_formats[0].rule;
|
||||
match rule {
|
||||
CfRule::ColorScale { stops } => stops.clone(),
|
||||
_ => Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn creates_a_three_colour_scale_with_per_stop_thresholds() {
|
||||
let mut h = harness();
|
||||
h.state_mut().run("home.conditionalFormat", json!({})).unwrap();
|
||||
h.run_steps(6);
|
||||
assert_eq!(h.state().dialog.as_ref().map(|d| d.name.as_str()), Some("newFormattingRule"));
|
||||
|
||||
h.state_mut().dialog.as_mut().unwrap().values.insert(
|
||||
"stops".into(),
|
||||
json!([
|
||||
{"type": "min", "color": "#112233"},
|
||||
{"type": "percentile", "value": 90, "color": "#445566"},
|
||||
{"type": "max", "color": "#778899"},
|
||||
]),
|
||||
);
|
||||
h.run_steps(2);
|
||||
h.get_by_label(" OK ").click();
|
||||
h.run_steps(6);
|
||||
assert!(h.state().dialog.is_none());
|
||||
assert_eq!(
|
||||
stops(&h),
|
||||
vec![
|
||||
(CfValueKind::Min, Color::Rgb(0x112233)),
|
||||
(CfValueKind::Percentile(90.0), Color::Rgb(0x445566)),
|
||||
(CfValueKind::Max, Color::Rgb(0x778899)),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn edits_an_existing_scale_in_place() {
|
||||
let mut h = harness();
|
||||
h.state_mut()
|
||||
.run(
|
||||
"home.conditionalFormat",
|
||||
json!({"rule": {"type": "colorScale", "stops": [
|
||||
{"type": "min", "color": "#112233"},
|
||||
{"type": "percentile", "value": 50, "color": "#445566"},
|
||||
{"type": "max", "color": "#778899"},
|
||||
]}}),
|
||||
)
|
||||
.unwrap();
|
||||
let rule = serde_json::to_value(&h.state().session.active().unwrap().wb.active().unwrap().cond_formats[0].rule).unwrap();
|
||||
h.state_mut().open_dialog("newFormattingRule", json!({"edit": 0, "rule": rule}));
|
||||
h.run_steps(6);
|
||||
h.state_mut().dialog.as_mut().unwrap().values.insert("style".into(), json!("2color"));
|
||||
h.state_mut().dialog.as_mut().unwrap().values.insert(
|
||||
"stops".into(),
|
||||
json!([
|
||||
{"type": "formula", "value": "$B$1", "color": "#ABCABC"},
|
||||
{"type": "max", "color": "#DEFDEF"},
|
||||
]),
|
||||
);
|
||||
h.run_steps(2);
|
||||
h.get_by_label(" OK ").click();
|
||||
h.run_steps(6);
|
||||
assert!(h.state().dialog.is_none());
|
||||
assert_eq!(stops(&h), vec![(CfValueKind::Formula("$B$1".into()), Color::Rgb(0xABCABC)), (CfValueKind::Max, Color::Rgb(0xDEFDEF))]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn new_rule_still_creates_a_formula_rule() {
|
||||
let mut h = harness();
|
||||
h.state_mut().open_dialog("newFormattingRule", json!({}));
|
||||
h.run_steps(6);
|
||||
assert_eq!(h.state().dialog.as_ref().unwrap().values["ruleType"], json!("allCells"));
|
||||
|
||||
h.get_by_label("Use a formula to determine which cells to format").click();
|
||||
h.run_steps(4);
|
||||
assert_eq!(h.state().dialog.as_ref().unwrap().values["ruleType"], json!("formula"));
|
||||
h.state_mut().dialog.as_mut().unwrap().values.insert("formula".into(), json!("=A1>2"));
|
||||
h.run_steps(2);
|
||||
h.get_by_label(" OK ").click();
|
||||
h.run_steps(6);
|
||||
assert!(h.state().dialog.is_none());
|
||||
let rule = &h.state().session.active().unwrap().wb.active().unwrap().cond_formats[0].rule;
|
||||
let CfRule::Expression { formula, .. } = rule else { panic!("expected a formula rule, got {rule:?}") };
|
||||
assert_eq!(formula, "A1>2");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_editor_widgets_drive_the_scale() {
|
||||
let mut h = harness();
|
||||
h.state_mut().open_dialog("newFormattingRule", json!({}));
|
||||
h.run_steps(6);
|
||||
|
||||
// Format Style: 3 -> 2 -> 3 through the combo itself.
|
||||
h.get_all_by_role(egui::accesskit::Role::ComboBox).next().expect("format style").click();
|
||||
h.run_steps(2);
|
||||
h.get_by_label("2-Color Scale").click();
|
||||
h.run_steps(2);
|
||||
assert_eq!(h.state().dialog.as_ref().unwrap().values["stops"].as_array().unwrap().len(), 2);
|
||||
h.get_all_by_role(egui::accesskit::Role::ComboBox).next().expect("format style").click();
|
||||
h.run_steps(2);
|
||||
h.get_by_label("3-Color Scale").click();
|
||||
h.run_steps(2);
|
||||
|
||||
// Midpoint: Percentile -> Number, then type a new threshold.
|
||||
h.get_all_by_role(egui::accesskit::Role::ComboBox).nth(2).expect("midpoint type").click();
|
||||
h.run_steps(2);
|
||||
h.get_by_label("Number").click();
|
||||
h.run_steps(2);
|
||||
h.get_all_by_role(egui::accesskit::Role::SpinButton).next().expect("midpoint threshold").click();
|
||||
h.run_steps(1);
|
||||
h.key_press_modifiers(egui::Modifiers::COMMAND, egui::Key::A);
|
||||
h.key_press(egui::Key::Backspace);
|
||||
h.get_all_by_role(egui::accesskit::Role::SpinButton).next().expect("midpoint threshold").type_text("75");
|
||||
h.key_press(egui::Key::Tab);
|
||||
h.run_steps(2);
|
||||
assert_eq!(h.state().dialog.as_ref().unwrap().values["stops"][1]["value"], json!(75.0));
|
||||
|
||||
h.get_by_label(" OK ").click();
|
||||
h.run_steps(6);
|
||||
assert_eq!(
|
||||
stops(&h),
|
||||
vec![(CfValueKind::Min, Color::Rgb(0xF8696B)), (CfValueKind::Number(75.0), Color::Rgb(0xFFEB84)), (CfValueKind::Max, Color::Rgb(0x63BE7B)),]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn switching_three_to_two_to_three_uses_the_default_midpoint() {
|
||||
let mut h = harness();
|
||||
h.state_mut()
|
||||
.run(
|
||||
"home.conditionalFormat",
|
||||
json!({"rule": {"type": "colorScale", "stops": [
|
||||
{"type": "min", "color": "#112233"},
|
||||
{"type": "percentile", "value": 50, "color": "#445566"},
|
||||
{"type": "max", "color": "#778899"},
|
||||
]}}),
|
||||
)
|
||||
.unwrap();
|
||||
let rule = serde_json::to_value(&h.state().session.active().unwrap().wb.active().unwrap().cond_formats[0].rule).unwrap();
|
||||
h.state_mut().open_dialog("newFormattingRule", json!({"edit": 0, "rule": rule}));
|
||||
h.run_steps(6);
|
||||
|
||||
// The style combo drives these transitions in `new_formatting_rule`.
|
||||
h.state_mut().dialog.as_mut().unwrap().values.insert("style".into(), json!("2color"));
|
||||
h.run_steps(2);
|
||||
let two = h.state().dialog.as_ref().unwrap().values["stops"].as_array().unwrap().clone();
|
||||
assert_eq!(two.len(), 2);
|
||||
assert_eq!(two[0]["color"], json!("#112233"), "dropping the midpoint keeps the minimum's colour");
|
||||
assert_eq!(two[1]["color"], json!("#778899"), "dropping the midpoint keeps the maximum's colour");
|
||||
|
||||
h.state_mut().dialog.as_mut().unwrap().values.insert("style".into(), json!("3color"));
|
||||
h.run_steps(2);
|
||||
h.get_by_label(" OK ").click();
|
||||
h.run_steps(6);
|
||||
assert!(h.state().dialog.is_none());
|
||||
assert_eq!(
|
||||
stops(&h),
|
||||
vec![
|
||||
(CfValueKind::Min, Color::Rgb(0x112233)),
|
||||
(CfValueKind::Percentile(50.0), Color::Rgb(0xFFEB84)),
|
||||
(CfValueKind::Max, Color::Rgb(0x778899)),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn edit_keeps_an_unchanged_theme_colour() {
|
||||
let mut h = harness();
|
||||
h.state_mut()
|
||||
.run(
|
||||
"home.conditionalFormat",
|
||||
json!({"rule": {"type": "colorScale", "stops": [
|
||||
{"type": "min", "color": {"theme": 4, "tint": 0}},
|
||||
{"type": "percentile", "value": 50, "color": {"theme": 2, "tint": 0}},
|
||||
{"type": "max", "color": {"theme": 6, "tint": 0}},
|
||||
]}}),
|
||||
)
|
||||
.unwrap();
|
||||
let rule = serde_json::to_value(&h.state().session.active().unwrap().wb.active().unwrap().cond_formats[0].rule).unwrap();
|
||||
h.state_mut().open_dialog("newFormattingRule", json!({"edit": 0, "rule": rule}));
|
||||
h.run_steps(6);
|
||||
h.get_by_label(" OK ").click();
|
||||
h.run_steps(6);
|
||||
assert!(h.state().dialog.is_none());
|
||||
assert_eq!(
|
||||
stops(&h),
|
||||
vec![(CfValueKind::Min, Color::Theme(4, 0)), (CfValueKind::Percentile(50.0), Color::Theme(2, 0)), (CfValueKind::Max, Color::Theme(6, 0)),]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_empty_formula_keeps_ok_disabled() {
|
||||
let mut h = harness();
|
||||
h.state_mut().open_dialog("newFormattingRule", json!({}));
|
||||
h.run_steps(6);
|
||||
h.get_by_label("Use a formula to determine which cells to format").click();
|
||||
h.run_steps(4);
|
||||
assert_eq!(h.state().dialog.as_ref().unwrap().values["ruleType"], json!("formula"));
|
||||
// No formula typed: OK (and Enter) must do nothing, or the rule never applies.
|
||||
h.get_by_label(" OK ").click();
|
||||
h.run_steps(6);
|
||||
assert!(h.state().dialog.is_some(), "the dialog stays open for a formula");
|
||||
assert!(h.state().session.active().unwrap().wb.active().unwrap().cond_formats.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_unparseable_formula_is_refused_with_a_message() {
|
||||
let mut h = harness();
|
||||
h.state_mut().open_dialog("newFormattingRule", json!({}));
|
||||
h.run_steps(6);
|
||||
h.get_by_label("Use a formula to determine which cells to format").click();
|
||||
h.run_steps(4);
|
||||
h.state_mut().dialog.as_mut().unwrap().values.insert("formula".into(), json!("=C1>"));
|
||||
h.run_steps(2);
|
||||
h.get_by_label(" OK ").click();
|
||||
h.run_steps(6);
|
||||
assert!(h.state().dialog.is_some(), "an invalid formula keeps the dialog open");
|
||||
let message = h.state().message.as_ref().map(|(_, m)| m.clone()).unwrap_or_default();
|
||||
assert!(message.contains("invalid") && message.contains("does not parse"), "{message}");
|
||||
assert!(h.state().session.active().unwrap().wb.active().unwrap().cond_formats.is_empty(), "no unopenable rule is stored");
|
||||
}
|
||||
@@ -185,6 +185,7 @@ No alpha blockers: every core workflow passes the [alpha gate](roadmap.md#alpha-
|
||||
| 2026-10-23 | minor | §8: PivotTable Show Details: double-clicking a value cell lists its source records on a new sheet (#2364) |
|
||||
| 2026-10-20 | minor | §11: the Japanese catalog covers the dialogs, messages and menus — 943 keys (~43%), matching the pt-BR coverage; a test keeps the two catalogs in step |
|
||||
| 2026-10-17 | minor | §6: the five reports it tracked are closed and their PRs merged (#57, #133, #139, #140, #134; PRs #148, #155, #156, #157); the entry stays open for §15's oracle suite |
|
||||
| 2026-10-17 | minor | Conditional formatting: the 2-/3-colour scale branch of the New Formatting Rule dialog edits per-stop type/value/colour and updates rules in place (part of #1165) |
|
||||
| 2026-10-15 | minor | §6: Maximum Iterations and Maximum Change in File › Options › Formulas; dropped the stale "no Options dialog yet" |
|
||||
| 2026-10-15 | minor | §13: Solver prepares reports before committing the solution, model and report sheets together; report refusal preserves the workbook and Undo/Redo (#1050) |
|
||||
| 2026-10-13 | trivial | §4: multi-level category axes landed |
|
||||
|
||||
@@ -296,7 +296,8 @@ The inventory carried over from the 2026-10-07 ROADMAP.md, updated for what land
|
||||
the fill handle explains how to fill versus select cells.
|
||||
- Formatting: fonts, fills, all border styles, alignment (wrap, indent, rotation, merge), number
|
||||
formats, 47 cell styles, 60 table styles, conditional formatting (cell rules, text, dates,
|
||||
duplicates, top/bottom, averages, data bars, colour scales, icon sets, formulas), automatic
|
||||
duplicates, top/bottom, averages, data bars, colour scales with per-stop type/value/colour
|
||||
editors, icon sets, formulas), automatic
|
||||
row heights, autofit, hide/unhide, freeze panes.
|
||||
Border presets include visual diagrams; Format Cells previews draft borders before applying.
|
||||
- Data: sort (multi-level, by colour, custom lists), AutoFilter (values, custom, top 10,
|
||||
|
||||
@@ -209,6 +209,7 @@ scrollbar bugs 2–4 · pixel/feel pass against observed Excel 7–12.
|
||||
| 2026-10-19 | trivial | While a mouse button is held (a click or a drag selecting cells) the selection outline is drawn on its cells at once instead of gliding after the pointer, which read as lag; keyboard moves still glide |
|
||||
| 2026-10-18 | minor | Keytip letters typed with left Alt held continue the sequence (Alt+H, O, A / Alt+H, O, I ran nothing before: Alt+letter cancelled keytips); other Alt combinations, AltGr and macOS Option are unchanged (#1846) |
|
||||
| 2026-10-17 | minor | A Ctrl+Alt+letter key that types a character (a user-defined Windows hotkey such as Ctrl+Alt+A for `ä`) types it instead of running the Ctrl+letter shortcut, e.g. Select All (#1530) |
|
||||
| 2026-10-17 | minor | Conditional formatting: 2-/3-colour scale editor with per-stop type/value/colour, reached from New Rule… → Format all cells based on their values and Color Scales › More Rules…; Manage Rules edits a scale in place (part of #1165) |
|
||||
| 2026-10-16 | minor | Right-drag on the fill handle opens the fill menu on release: Copy Cells, Fill Series, Fill Formatting Only, Fill Without Formatting, Series…; Esc cancels the drag or closes the menu without filling |
|
||||
| 2026-10-16 | minor | With the active cell in a Table whose header row is scrolled out of view, the column headings show the header names and their filter buttons in place of the letters (#1423) |
|
||||
| 2026-10-16 | minor | Ctrl+6 hides every object (charts, pictures, shapes, slicers) and shows them again; hidden objects are not drawn, take no clicks and drop their selection, and the setting is saved with the workbook (`workbookPr showObjects`) |
|
||||
@@ -228,6 +229,7 @@ scrollbar bugs 2–4 · pixel/feel pass against observed Excel 7–12.
|
||||
| 2026-10-13 | minor | Grid drags keep their own cursor over selection borders, fill handles and outside the grid; hover resumes on release (#936) |
|
||||
| 2026-10-13 | minor | AutoFill month patterns retain the workbook's date system, preventing shifted dates in 1904 workbooks when filling forward or backward |
|
||||
| 2026-10-13 | minor | Sheet tab bar: the tab strip shrinks to its tabs, up to 60% of the bar, so New sheet (+) sits right after the last tab and the horizontal scrollbar takes the rest (part of #943) |
|
||||
| 2026-10-12 | minor | The File view's recent list tells when each workbook was last changed, read off the UI thread |
|
||||
| 2026-10-13 | minor | Horizontal scrollbar in the sheet tab bar: drag, track click pages, frozen columns excluded from the page (#840) |
|
||||
| 2026-10-13 | minor | Formula-entry Command/Ctrl-click adds arguments and Shift-click extends references; ordinary replacement and dragging retain their behavior. Readiness estimates unchanged. |
|
||||
| 2026-10-12 | minor | Next/previous sheet navigation no longer activates hidden worksheets at either workbook boundary; command tests cover Hidden, VeryHidden and selection retention |
|
||||
|
||||
Reference in new issue
Block a user