f8-engine 0.3.3__tar.gz → 0.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {f8_engine-0.3.3 → f8_engine-0.4.1}/Cargo.lock +2 -2
- {f8_engine-0.3.3 → f8_engine-0.4.1}/Cargo.toml +1 -1
- {f8_engine-0.3.3 → f8_engine-0.4.1}/PKG-INFO +3 -2
- {f8_engine-0.3.3 → f8_engine-0.4.1}/README.md +2 -1
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/emission/format.rs +0 -3
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/graph/resolve.rs +8 -6
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/lowering/mod.rs +16 -9
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/expr/ast.rs +50 -3
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/expr/error.rs +2 -2
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/expr/mod.rs +1 -1
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/expr/parser.rs +47 -4
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/financial/irr.rs +2 -2
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/model/format.rs +0 -2
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/model/theme.rs +7 -9
- {f8_engine-0.3.3 → f8_engine-0.4.1}/python/f8/audit.py +11 -5
- {f8_engine-0.3.3 → f8_engine-0.4.1}/python/f8/skills/f8-modeling/SKILL.md +1 -1
- {f8_engine-0.3.3 → f8_engine-0.4.1}/python/f8/skills/f8-modeling/references/auditing-and-repair.md +1 -1
- {f8_engine-0.3.3 → f8_engine-0.4.1}/python/f8/skills/f8-modeling/references/syntax-and-grid.md +5 -5
- {f8_engine-0.3.3 → f8_engine-0.4.1}/python/f8/types.py +1 -1
- {f8_engine-0.3.3 → f8_engine-0.4.1}/LICENSE +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/Cargo.toml +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/compiled/error.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/compiled/mod.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/compiled/model.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/emission/error.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/emission/mod.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/emission/workbook.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/error.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/eval/context.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/eval/error.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/eval/expr.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/eval/mod.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/eval/model.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/graph/cycle.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/graph/dependency.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/graph/error.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/graph/mod.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/ir/cell.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/ir/error.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/ir/expand.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/ir/id.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/ir/mod.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/ir/symbol.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/layout/a1.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/layout/error.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/layout/mod.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/lowering/address.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/lowering/error.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/compiler/mod.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/common.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/date/constructors.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/date/mod.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/date/parts.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/date/serial.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/date/yearfrac.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/error.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/financial/annuity.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/financial/discounting.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/financial/mod.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/logical/boolean.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/logical/branching.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/logical/error_handling.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/logical/mod.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/lookup/index.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/lookup/mod.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/lookup/search.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/lookup/xlookup.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/lookup/xmatch.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/math/aggregation.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/math/basic.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/math/conditional.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/math/criteria.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/math/mod.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/math/product.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/math/rounding.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/mod.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/registry.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/functions/traits.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/lib.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/model/error.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/model/id.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/model/manifest.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/model/mod.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/model/table.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/value/error.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/value/format.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-core/src/value/mod.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-python/Cargo.toml +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-python/src/error.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-python/src/lib.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/crates/f8-python/src/model.rs +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/pyproject.toml +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/python/f8/__init__.py +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/python/f8/__main__.py +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/python/f8/_core.pyi +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/python/f8/builder.py +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/python/f8/cli.py +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/python/f8/py.typed +0 -0
- {f8_engine-0.3.3 → f8_engine-0.4.1}/python/f8/skills/f8-modeling/references/functions.md +0 -0
|
@@ -37,7 +37,7 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
|
|
37
37
|
|
|
38
38
|
[[package]]
|
|
39
39
|
name = "f8-core"
|
|
40
|
-
version = "0.
|
|
40
|
+
version = "0.4.1"
|
|
41
41
|
dependencies = [
|
|
42
42
|
"indexmap",
|
|
43
43
|
"petgraph",
|
|
@@ -50,7 +50,7 @@ dependencies = [
|
|
|
50
50
|
|
|
51
51
|
[[package]]
|
|
52
52
|
name = "f8-python"
|
|
53
|
-
version = "0.
|
|
53
|
+
version = "0.4.1"
|
|
54
54
|
dependencies = [
|
|
55
55
|
"f8-core",
|
|
56
56
|
"pyo3",
|
|
@@ -3,7 +3,7 @@ resolver = "3"
|
|
|
3
3
|
members = ["crates/f8-core", "crates/f8-python"]
|
|
4
4
|
|
|
5
5
|
[workspace.package]
|
|
6
|
-
version = "0.
|
|
6
|
+
version = "0.4.1"
|
|
7
7
|
edition = "2024"
|
|
8
8
|
description = "Financial modeling engine with compiler verification and live Excel formulas"
|
|
9
9
|
authors = ["Michael (Chencheng) Hu, CFA"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: f8-engine
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Classifier: Development Status :: 4 - Beta
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
@@ -46,7 +46,8 @@ AI agents struggle to manipulate raw spreadsheets (`openpyxl`, Office.js, or GUI
|
|
|
46
46
|
|
|
47
47
|
- Semantic 2D modeling: Author models with readable table, row, and column identifiers; `f8` handles spatial layout and lowers logic into native Excel formulas.
|
|
48
48
|
- Compiler-enforced rigor: A 6-pass Rust compiler verifies grid completeness (zero unassigned cells or formula overlaps) and enforces a strict DAG via Tarjan cycle detection.
|
|
49
|
-
- Closed-loop verification: Evaluates formulas in memory
|
|
49
|
+
- Closed-loop verification: Evaluates formulas in memory so AI agents and `pytest` suites can audit tables, trace dependencies, and verify accounting checks in milliseconds, without opening Excel.
|
|
50
|
+
- Verified Excel parity: Matches Excel on all 44 supported functions, including error propagation, type coercion, and the 1900 leap day bug. The [parity workbook](https://github.com/mhcfa/f8/releases/latest/download/excel_parity_verification.xlsx) ships without cached values, so Excel itself recalculates and grades 101 cases on open: exact match for integers, text, dates, and lookups; 1e-9 relative tolerance for floating-point and iterative functions (`IRR`, `XIRR`); exact error type for 23 error cases.
|
|
50
51
|
|
|
51
52
|
## Getting started
|
|
52
53
|
|
|
@@ -20,7 +20,8 @@ AI agents struggle to manipulate raw spreadsheets (`openpyxl`, Office.js, or GUI
|
|
|
20
20
|
|
|
21
21
|
- Semantic 2D modeling: Author models with readable table, row, and column identifiers; `f8` handles spatial layout and lowers logic into native Excel formulas.
|
|
22
22
|
- Compiler-enforced rigor: A 6-pass Rust compiler verifies grid completeness (zero unassigned cells or formula overlaps) and enforces a strict DAG via Tarjan cycle detection.
|
|
23
|
-
- Closed-loop verification: Evaluates formulas in memory
|
|
23
|
+
- Closed-loop verification: Evaluates formulas in memory so AI agents and `pytest` suites can audit tables, trace dependencies, and verify accounting checks in milliseconds, without opening Excel.
|
|
24
|
+
- Verified Excel parity: Matches Excel on all 44 supported functions, including error propagation, type coercion, and the 1900 leap day bug. The [parity workbook](https://github.com/mhcfa/f8/releases/latest/download/excel_parity_verification.xlsx) ships without cached values, so Excel itself recalculates and grades 101 cases on open: exact match for integers, text, dates, and lookups; 1e-9 relative tolerance for floating-point and iterative functions (`IRR`, `XIRR`); exact error type for 23 error cases.
|
|
24
25
|
|
|
25
26
|
## Getting started
|
|
26
27
|
|
|
@@ -95,7 +95,6 @@ struct ParsedPalette {
|
|
|
95
95
|
input_text: Color,
|
|
96
96
|
formula_text: Color,
|
|
97
97
|
shade_muted_fill: Option<Color>,
|
|
98
|
-
shade_accent_fill: Option<Color>,
|
|
99
98
|
shade_alt_fill: Option<Color>,
|
|
100
99
|
highlight_fill: Option<Color>,
|
|
101
100
|
highlight_text: Color,
|
|
@@ -125,7 +124,6 @@ impl ParsedPalette {
|
|
|
125
124
|
input_text: parse_hex_color("input_text", &p.input_text)?,
|
|
126
125
|
formula_text: parse_hex_color("formula_text", &p.formula_text)?,
|
|
127
126
|
shade_muted_fill: parse_fill_color("shade_muted_fill", &p.shade_muted_fill)?,
|
|
128
|
-
shade_accent_fill: parse_fill_color("shade_accent_fill", &p.shade_accent_fill)?,
|
|
129
127
|
shade_alt_fill: parse_fill_color("shade_alt_fill", &p.shade_alt_fill)?,
|
|
130
128
|
highlight_fill: parse_fill_color("highlight_fill", &p.highlight_fill)?,
|
|
131
129
|
highlight_text: parse_hex_color("highlight_text", &p.highlight_text)?,
|
|
@@ -358,7 +356,6 @@ impl FormatCache {
|
|
|
358
356
|
// is_highlight > total (or shade) > subtotal (or shade) > shade > data
|
|
359
357
|
let shade_fill = match key.role.shade {
|
|
360
358
|
Some(Shade::Muted) => self.palette.shade_muted_fill,
|
|
361
|
-
Some(Shade::Accent) => self.palette.shade_accent_fill,
|
|
362
359
|
Some(Shade::Alt) => self.palette.shade_alt_fill,
|
|
363
360
|
Some(Shade::None) | None => None,
|
|
364
361
|
};
|
|
@@ -369,9 +369,10 @@ pub fn resolve_table_ref(
|
|
|
369
369
|
.get_table(&origin.table)
|
|
370
370
|
.ok_or_else(|| ResolveError::unregistered_table(origin, origin.table.clone()))?;
|
|
371
371
|
|
|
372
|
+
let resolved_table_id = table_ref.table.resolve(&origin.table);
|
|
372
373
|
let target_table = symbol_table
|
|
373
|
-
.get_table(
|
|
374
|
-
.ok_or_else(|| ResolveError::unknown_table(origin,
|
|
374
|
+
.get_table(resolved_table_id)
|
|
375
|
+
.ok_or_else(|| ResolveError::unknown_table(origin, resolved_table_id.clone()))?;
|
|
375
376
|
|
|
376
377
|
let rows = resolve_row_selector(origin, target_table, origin_table, &table_ref.row)?;
|
|
377
378
|
let cols = resolve_col_selector(origin, target_table, origin_table, &table_ref.col)?;
|
|
@@ -382,7 +383,7 @@ pub fn resolve_table_ref(
|
|
|
382
383
|
for row in rows {
|
|
383
384
|
for col in &cols {
|
|
384
385
|
resolved.push(CellId::new(
|
|
385
|
-
|
|
386
|
+
resolved_table_id.clone(),
|
|
386
387
|
row.clone(),
|
|
387
388
|
col.clone(),
|
|
388
389
|
));
|
|
@@ -419,6 +420,7 @@ pub fn resolve_cell_dependencies(
|
|
|
419
420
|
#[allow(clippy::unwrap_used, clippy::expect_used, reason = "test code")]
|
|
420
421
|
mod tests {
|
|
421
422
|
use super::*;
|
|
423
|
+
use crate::expr::ast::TableSelector;
|
|
422
424
|
use crate::model::id::{SheetId, TableId};
|
|
423
425
|
use crate::model::table::{ColumnSpec, RowSpec, TableSpec};
|
|
424
426
|
|
|
@@ -428,9 +430,9 @@ mod tests {
|
|
|
428
430
|
let expr = Expr::parse(formula).expect("valid formula");
|
|
429
431
|
let refs = collect_references(&expr);
|
|
430
432
|
assert_eq!(refs.len(), 3);
|
|
431
|
-
assert_eq!(refs[0].table,
|
|
432
|
-
assert_eq!(refs[1].table,
|
|
433
|
-
assert_eq!(refs[2].table,
|
|
433
|
+
assert_eq!(refs[0].table, TableSelector::from("TableA"));
|
|
434
|
+
assert_eq!(refs[1].table, TableSelector::from("TableB"));
|
|
435
|
+
assert_eq!(refs[2].table, TableSelector::from("TableC"));
|
|
434
436
|
}
|
|
435
437
|
|
|
436
438
|
#[test]
|
|
@@ -120,8 +120,12 @@ pub fn lower_table_ref(
|
|
|
120
120
|
crate::compiler::graph::error::ResolveError::unknown_table(origin, origin.table.clone())
|
|
121
121
|
})?;
|
|
122
122
|
|
|
123
|
-
let
|
|
124
|
-
|
|
123
|
+
let resolved_table_id = target_ref.table.resolve(&origin.table);
|
|
124
|
+
let target_table = symbol_table.get_table(resolved_table_id).ok_or_else(|| {
|
|
125
|
+
crate::compiler::graph::error::ResolveError::unknown_table(
|
|
126
|
+
origin,
|
|
127
|
+
resolved_table_id.clone(),
|
|
128
|
+
)
|
|
125
129
|
})?;
|
|
126
130
|
|
|
127
131
|
let origin_coord =
|
|
@@ -138,19 +142,19 @@ pub fn lower_table_ref(
|
|
|
138
142
|
|
|
139
143
|
let first_row = rows.first().ok_or_else(|| LoweringError::EmptyRange {
|
|
140
144
|
origin: origin.clone(),
|
|
141
|
-
target_table:
|
|
145
|
+
target_table: resolved_table_id.clone(),
|
|
142
146
|
})?;
|
|
143
147
|
let last_row = rows.last().ok_or_else(|| LoweringError::EmptyRange {
|
|
144
148
|
origin: origin.clone(),
|
|
145
|
-
target_table:
|
|
149
|
+
target_table: resolved_table_id.clone(),
|
|
146
150
|
})?;
|
|
147
151
|
let first_col = cols.first().ok_or_else(|| LoweringError::EmptyRange {
|
|
148
152
|
origin: origin.clone(),
|
|
149
|
-
target_table:
|
|
153
|
+
target_table: resolved_table_id.clone(),
|
|
150
154
|
})?;
|
|
151
155
|
let last_col = cols.last().ok_or_else(|| LoweringError::EmptyRange {
|
|
152
156
|
origin: origin.clone(),
|
|
153
|
-
target_table:
|
|
157
|
+
target_table: resolved_table_id.clone(),
|
|
154
158
|
})?;
|
|
155
159
|
|
|
156
160
|
let is_row_range = target_ref.row.is_range();
|
|
@@ -161,7 +165,7 @@ pub fn lower_table_ref(
|
|
|
161
165
|
let (start_row_dyn, end_row_dyn) = target_ref.row.dynamic_bounds();
|
|
162
166
|
|
|
163
167
|
let top_left_id = CellId::new(
|
|
164
|
-
|
|
168
|
+
resolved_table_id.clone(),
|
|
165
169
|
first_row.clone(),
|
|
166
170
|
first_col.clone(),
|
|
167
171
|
);
|
|
@@ -177,8 +181,11 @@ pub fn lower_table_ref(
|
|
|
177
181
|
let end_pinned =
|
|
178
182
|
range_endpoint_pinning(end_col_dyn, end_row_dyn, pin_static_col_on_dynamic_row);
|
|
179
183
|
|
|
180
|
-
let bottom_right_id =
|
|
181
|
-
|
|
184
|
+
let bottom_right_id = CellId::new(
|
|
185
|
+
resolved_table_id.clone(),
|
|
186
|
+
last_row.clone(),
|
|
187
|
+
last_col.clone(),
|
|
188
|
+
);
|
|
182
189
|
let bottom_right_coord =
|
|
183
190
|
layout_map
|
|
184
191
|
.cells
|
|
@@ -166,11 +166,58 @@ impl fmt::Display for UnaryOp {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
/// Target table selector within a table reference.
|
|
170
|
+
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
171
|
+
pub enum TableSelector {
|
|
172
|
+
/// Active evaluation table: `@table`.
|
|
173
|
+
Active,
|
|
174
|
+
/// Explicit table identifier: `IncomeStatement`.
|
|
175
|
+
Key(TableId),
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
impl TableSelector {
|
|
179
|
+
/// Resolves the selector against the origin table ID.
|
|
180
|
+
#[must_use]
|
|
181
|
+
pub const fn resolve<'a>(&'a self, origin_table: &'a TableId) -> &'a TableId {
|
|
182
|
+
match self {
|
|
183
|
+
Self::Active => origin_table,
|
|
184
|
+
Self::Key(id) => id,
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
impl From<TableId> for TableSelector {
|
|
190
|
+
fn from(id: TableId) -> Self {
|
|
191
|
+
Self::Key(id)
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
impl From<&str> for TableSelector {
|
|
196
|
+
fn from(s: &str) -> Self {
|
|
197
|
+
Self::Key(TableId::from(s))
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
impl From<String> for TableSelector {
|
|
202
|
+
fn from(s: String) -> Self {
|
|
203
|
+
Self::Key(TableId::from(s))
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
impl fmt::Display for TableSelector {
|
|
208
|
+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
209
|
+
match self {
|
|
210
|
+
Self::Active => write!(f, "@table"),
|
|
211
|
+
Self::Key(k) => write!(f, "{k}"),
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
169
216
|
/// Reference addressing target to a table.
|
|
170
217
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
171
218
|
pub struct TableRef {
|
|
172
|
-
/// Target table
|
|
173
|
-
pub table:
|
|
219
|
+
/// Target table selector.
|
|
220
|
+
pub table: TableSelector,
|
|
174
221
|
/// Row coordinate selector.
|
|
175
222
|
pub row: RowSelector,
|
|
176
223
|
/// Column coordinate selector.
|
|
@@ -179,7 +226,7 @@ pub struct TableRef {
|
|
|
179
226
|
|
|
180
227
|
impl TableRef {
|
|
181
228
|
/// Constructs a table reference: `Table[row, col]`.
|
|
182
|
-
pub fn new(table: impl Into<
|
|
229
|
+
pub fn new(table: impl Into<TableSelector>, row: RowSelector, col: ColSelector) -> Self {
|
|
183
230
|
Self {
|
|
184
231
|
table: table.into(),
|
|
185
232
|
row,
|
|
@@ -59,9 +59,9 @@ pub enum ParseError {
|
|
|
59
59
|
offset: usize,
|
|
60
60
|
},
|
|
61
61
|
|
|
62
|
-
/// Bare '@' was encountered instead of '@col' or '@
|
|
62
|
+
/// Bare '@' was encountered instead of '@col', '@row', or '@table'.
|
|
63
63
|
#[error(
|
|
64
|
-
"Bare '@' at offset {offset} is retired; specify active
|
|
64
|
+
"Bare '@' at offset {offset} is retired; specify active coordinate explicitly using '@col', '@row', or '@table'"
|
|
65
65
|
)]
|
|
66
66
|
RetiredBareAt {
|
|
67
67
|
/// Byte offset in the formula string.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
use crate::expr::ast::{
|
|
2
2
|
BinaryOp, ColEndpoint, ColSelector, Expr, Literal, RelativeOffset, RowEndpoint, RowSelector,
|
|
3
|
-
TableRef, UnaryOp,
|
|
3
|
+
TableRef, TableSelector, UnaryOp,
|
|
4
4
|
};
|
|
5
5
|
use crate::expr::error::ParseError;
|
|
6
6
|
use crate::model::id::{ColId, RowId};
|
|
@@ -39,6 +39,8 @@ pub(crate) enum Token<'a> {
|
|
|
39
39
|
AtCol,
|
|
40
40
|
/// Active evaluation row symbol `@row`.
|
|
41
41
|
AtRow,
|
|
42
|
+
/// Active evaluation table symbol `@table`.
|
|
43
|
+
AtTable,
|
|
42
44
|
|
|
43
45
|
// Operators
|
|
44
46
|
/// Plus operator `+`.
|
|
@@ -93,7 +95,8 @@ impl<'a> Token<'a> {
|
|
|
93
95
|
| Self::Dot
|
|
94
96
|
| Self::DotDot
|
|
95
97
|
| Self::AtCol
|
|
96
|
-
| Self::AtRow
|
|
98
|
+
| Self::AtRow
|
|
99
|
+
| Self::AtTable => None,
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
}
|
|
@@ -116,6 +119,7 @@ impl<'a> fmt::Display for Token<'a> {
|
|
|
116
119
|
Self::DotDot => write!(f, ".."),
|
|
117
120
|
Self::AtCol => write!(f, "@col"),
|
|
118
121
|
Self::AtRow => write!(f, "@row"),
|
|
122
|
+
Self::AtTable => write!(f, "@table"),
|
|
119
123
|
Self::Plus => write!(f, "+"),
|
|
120
124
|
Self::Minus => write!(f, "-"),
|
|
121
125
|
Self::Star => write!(f, "*"),
|
|
@@ -337,6 +341,20 @@ pub(crate) fn tokenize(input: &str) -> Result<Vec<SpannedToken<'_>>, ParseError>
|
|
|
337
341
|
continue;
|
|
338
342
|
}
|
|
339
343
|
'@' => {
|
|
344
|
+
if cursor.starts_with("@table")
|
|
345
|
+
&& cursor
|
|
346
|
+
.as_bytes()
|
|
347
|
+
.get(6)
|
|
348
|
+
.is_none_or(|b| !b.is_ascii_alphanumeric() && *b != b'_')
|
|
349
|
+
{
|
|
350
|
+
tokens.push(SpannedToken {
|
|
351
|
+
token: Token::AtTable,
|
|
352
|
+
offset,
|
|
353
|
+
len: 6,
|
|
354
|
+
});
|
|
355
|
+
cursor = &cursor[6..];
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
340
358
|
if cursor.starts_with("@col")
|
|
341
359
|
&& cursor
|
|
342
360
|
.as_bytes()
|
|
@@ -681,7 +699,9 @@ fn parse_prefix(stream: &mut TokenStream<'_>) -> Result<Expr, ParseError> {
|
|
|
681
699
|
|
|
682
700
|
match stream.peek() {
|
|
683
701
|
Some(st) if st.token == Token::LParen => parse_function_call(name, offset, stream),
|
|
684
|
-
Some(st) if st.token == Token::LBracket =>
|
|
702
|
+
Some(st) if st.token == Token::LBracket => {
|
|
703
|
+
parse_bracket_access(TableSelector::from(name), stream)
|
|
704
|
+
}
|
|
685
705
|
Some(st) => Err(ParseError::UnexpectedToken {
|
|
686
706
|
expected: "function call '(' or table reference '['",
|
|
687
707
|
found: st.token.to_string(),
|
|
@@ -694,6 +714,24 @@ fn parse_prefix(stream: &mut TokenStream<'_>) -> Result<Expr, ParseError> {
|
|
|
694
714
|
}),
|
|
695
715
|
}
|
|
696
716
|
}
|
|
717
|
+
Token::AtTable => {
|
|
718
|
+
stream.advance();
|
|
719
|
+
match stream.peek() {
|
|
720
|
+
Some(st) if st.token == Token::LBracket => {
|
|
721
|
+
parse_bracket_access(TableSelector::Active, stream)
|
|
722
|
+
}
|
|
723
|
+
Some(st) => Err(ParseError::UnexpectedToken {
|
|
724
|
+
expected: "table reference '['",
|
|
725
|
+
found: st.token.to_string(),
|
|
726
|
+
offset: st.offset,
|
|
727
|
+
}),
|
|
728
|
+
None => Err(ParseError::UnexpectedToken {
|
|
729
|
+
expected: "table reference '['",
|
|
730
|
+
found: "@table".to_string(),
|
|
731
|
+
offset,
|
|
732
|
+
}),
|
|
733
|
+
}
|
|
734
|
+
}
|
|
697
735
|
other @ (Token::Underscore
|
|
698
736
|
| Token::RParen
|
|
699
737
|
| Token::LBracket
|
|
@@ -811,7 +849,10 @@ fn parse_function_call(
|
|
|
811
849
|
})
|
|
812
850
|
}
|
|
813
851
|
|
|
814
|
-
fn parse_bracket_access(
|
|
852
|
+
fn parse_bracket_access(
|
|
853
|
+
table: TableSelector,
|
|
854
|
+
stream: &mut TokenStream<'_>,
|
|
855
|
+
) -> Result<Expr, ParseError> {
|
|
815
856
|
// Consume '['
|
|
816
857
|
let _ = stream.expect(&Token::LBracket, "'['")?;
|
|
817
858
|
|
|
@@ -939,6 +980,7 @@ fn parse_row_endpoint(stream: &mut TokenStream<'_>) -> Result<RowEndpoint, Parse
|
|
|
939
980
|
| Token::Dot
|
|
940
981
|
| Token::DotDot
|
|
941
982
|
| Token::AtCol
|
|
983
|
+
| Token::AtTable
|
|
942
984
|
| Token::Plus
|
|
943
985
|
| Token::Minus
|
|
944
986
|
| Token::Star
|
|
@@ -1013,6 +1055,7 @@ fn parse_col_endpoint(stream: &mut TokenStream<'_>) -> Result<ColEndpoint, Parse
|
|
|
1013
1055
|
| Token::Dot
|
|
1014
1056
|
| Token::DotDot
|
|
1015
1057
|
| Token::AtRow
|
|
1058
|
+
| Token::AtTable
|
|
1016
1059
|
| Token::Plus
|
|
1017
1060
|
| Token::Minus
|
|
1018
1061
|
| Token::Star
|
|
@@ -124,7 +124,7 @@ impl ExcelFunction for IrrFunction {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
if f_val
|
|
127
|
+
if f_val == 0.0 {
|
|
128
128
|
return Ok(CellValue::Number(normalize_zero(rate)));
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -282,7 +282,7 @@ impl ExcelFunction for XirrFunction {
|
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
if f_val
|
|
285
|
+
if f_val == 0.0 {
|
|
286
286
|
return Ok(CellValue::Number(normalize_zero(rate)));
|
|
287
287
|
}
|
|
288
288
|
|
|
@@ -96,7 +96,6 @@ pub enum Shade {
|
|
|
96
96
|
#[default]
|
|
97
97
|
None,
|
|
98
98
|
Muted,
|
|
99
|
-
Accent,
|
|
100
99
|
Alt,
|
|
101
100
|
}
|
|
102
101
|
|
|
@@ -105,7 +104,6 @@ impl Shade {
|
|
|
105
104
|
match self {
|
|
106
105
|
Self::None => "none",
|
|
107
106
|
Self::Muted => "muted",
|
|
108
|
-
Self::Accent => "accent",
|
|
109
107
|
Self::Alt => "alt",
|
|
110
108
|
}
|
|
111
109
|
}
|
|
@@ -105,7 +105,7 @@ impl Default for TypographyConfig {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
fn default_max_col_width() -> f64 {
|
|
108
|
-
|
|
108
|
+
75.0
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
/// Physical row heights, column character widths, gutters, and margins.
|
|
@@ -145,6 +145,7 @@ impl Default for MetricsConfig {
|
|
|
145
145
|
|
|
146
146
|
/// Color assignments across all workbook components.
|
|
147
147
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
148
|
+
#[serde(deny_unknown_fields)]
|
|
148
149
|
pub struct PaletteConfig {
|
|
149
150
|
pub table_title_fill: String,
|
|
150
151
|
pub table_title_text: String,
|
|
@@ -164,7 +165,6 @@ pub struct PaletteConfig {
|
|
|
164
165
|
pub input_text: String,
|
|
165
166
|
pub formula_text: String,
|
|
166
167
|
pub shade_muted_fill: String,
|
|
167
|
-
pub shade_accent_fill: String,
|
|
168
168
|
pub shade_alt_fill: String,
|
|
169
169
|
pub highlight_fill: String,
|
|
170
170
|
pub highlight_text: String,
|
|
@@ -358,7 +358,6 @@ impl PaletteConfig {
|
|
|
358
358
|
("subtotal_fill", &self.subtotal_fill),
|
|
359
359
|
("total_fill", &self.total_fill),
|
|
360
360
|
("shade_muted_fill", &self.shade_muted_fill),
|
|
361
|
-
("shade_accent_fill", &self.shade_accent_fill),
|
|
362
361
|
("shade_alt_fill", &self.shade_alt_fill),
|
|
363
362
|
("highlight_fill", &self.highlight_fill),
|
|
364
363
|
];
|
|
@@ -533,10 +532,10 @@ impl Theme {
|
|
|
533
532
|
typography: TypographyConfig::default(),
|
|
534
533
|
metrics: MetricsConfig::default(),
|
|
535
534
|
palette: PaletteConfig {
|
|
536
|
-
table_title_fill: "#
|
|
535
|
+
table_title_fill: "#00356B".to_string(),
|
|
537
536
|
table_title_text: "#FFFFFF".to_string(),
|
|
538
|
-
table_subtitle_text: "#
|
|
539
|
-
super_header_fill: "#
|
|
537
|
+
table_subtitle_text: "#45556C".to_string(),
|
|
538
|
+
super_header_fill: "#E2E8F0".to_string(),
|
|
540
539
|
super_header_text: "#000000".to_string(),
|
|
541
540
|
col_header_fill: "none".to_string(),
|
|
542
541
|
col_header_text: "#000000".to_string(),
|
|
@@ -551,13 +550,12 @@ impl Theme {
|
|
|
551
550
|
input_text: "#0000FF".to_string(),
|
|
552
551
|
formula_text: "#000000".to_string(),
|
|
553
552
|
shade_muted_fill: "#F8FAFC".to_string(),
|
|
554
|
-
shade_accent_fill: "#EFF6FF".to_string(),
|
|
555
553
|
shade_alt_fill: "#F1F5F9".to_string(),
|
|
556
554
|
highlight_fill: "#FEF3C7".to_string(),
|
|
557
555
|
highlight_text: "#000000".to_string(),
|
|
558
|
-
gridline_color: "#
|
|
556
|
+
gridline_color: "#E2E8F0".to_string(),
|
|
559
557
|
border_color: "#000000".to_string(),
|
|
560
|
-
total_border_color: "#
|
|
558
|
+
total_border_color: "#00356B".to_string(),
|
|
561
559
|
},
|
|
562
560
|
borders: BordersConfig::default(),
|
|
563
561
|
number_formats: NumberFormatsConfig::default(),
|
|
@@ -413,6 +413,7 @@ class TableAuditor:
|
|
|
413
413
|
if not r.get("is_section_header", False) and (rid := r.get("id")) is not None
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
+
selected_rows: list[RowInspection]
|
|
416
417
|
if rows is None:
|
|
417
418
|
show_sections = True if include_section_headers is None else include_section_headers
|
|
418
419
|
selected_rows = [
|
|
@@ -427,11 +428,16 @@ class TableAuditor:
|
|
|
427
428
|
selected_rows = [row_spec_by_id[rid] for rid in rows]
|
|
428
429
|
else:
|
|
429
430
|
requested_row_set = set(rows)
|
|
430
|
-
selected_rows = [
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
if r.get("is_section_header", False)
|
|
434
|
-
|
|
431
|
+
selected_rows = []
|
|
432
|
+
pending_header: RowInspection | None = None
|
|
433
|
+
for r in raw_rows:
|
|
434
|
+
if r.get("is_section_header", False):
|
|
435
|
+
pending_header = r
|
|
436
|
+
elif r.get("id") in requested_row_set:
|
|
437
|
+
if pending_header is not None:
|
|
438
|
+
selected_rows.append(pending_header)
|
|
439
|
+
pending_header = None
|
|
440
|
+
selected_rows.append(r)
|
|
435
441
|
|
|
436
442
|
render_cols: list[_RenderColumn] = []
|
|
437
443
|
for c in selected_cols:
|
|
@@ -33,7 +33,7 @@ CLI commands (`f8` or `python -m f8`):
|
|
|
33
33
|
|
|
34
34
|
## Core Invariants
|
|
35
35
|
|
|
36
|
-
- Explicit 2D coordinates: All references require bare table identifier and double-quoted keys (`Table["row", @col]`, `Table["row", col.prev]`, `Table["r1".."r2", @col]`). Unquoted keys, quoted table names, bare `@`, or dot access (`Table.row`) raise `FormulaParseError`.
|
|
36
|
+
- Explicit 2D coordinates: All references require bare table identifier or `@table` and double-quoted keys (`Table["row", @col]`, `@table["row", @col]`, `Table["row", col.prev]`, `Table["r1".."r2", @col]`). Unquoted keys, quoted table names, bare `@`, or dot access (`Table.row`) raise `FormulaParseError`.
|
|
37
37
|
- Uppercase identifiers: Built-in functions (`SUM`, `IF`, `XLOOKUP`) and booleans (`TRUE`, `FALSE`) must be uppercase.
|
|
38
38
|
- Argument omission: Use `_` for omitted optional function parameters (`PMT(rate, nper, pv, _, type)`).
|
|
39
39
|
- Cell-level indentation: `indent` is restricted to `role="descriptor"` cells (`Cell("Label", indent=1)`) and section headers; setting `indent > 0` on a `measure` cell raises `SpecificationError`.
|
{f8_engine-0.3.3 → f8_engine-0.4.1}/python/f8/skills/f8-modeling/references/auditing-and-repair.md
RENAMED
|
@@ -105,7 +105,7 @@ md: MarkdownTable = auditor.to_markdown(
|
|
|
105
105
|
- `"addresses"`: Physical A1 addresses (`"D7"`).
|
|
106
106
|
- Subsetting and formatting:
|
|
107
107
|
- `cols`: Any `descriptor` columns not explicitly listed in `cols` are automatically prepended in declaration order ahead of the requested `cols` (which preserve the caller's list order; unknown ID raises `KeyError`). `descriptor` columns are left-aligned (`:---`); `measure` columns are right-aligned (`---:`).
|
|
108
|
-
- `rows`: Renders only requested `rows` (unknown ID raises `KeyError`). `include_section_headers` defaults to `True` when `rows=None` and `False` when `rows` is specified.
|
|
108
|
+
- `rows`: Renders only requested `rows` (unknown ID raises `KeyError`). `include_section_headers` defaults to `True` when `rows=None` and `False` when `rows` is specified; when `rows` is specified with `include_section_headers=True`, only section headers with at least one matching child row in `rows` are emitted.
|
|
109
109
|
- `show_ids=True`: Appends `[{col_id}]` to column headers and `[{row_id}]` to descriptor labels when display text differs (case-insensitively) from the ID.
|
|
110
110
|
- Rows with `style="subtotal"` or `style="total"` wrap non-empty cell text in `**...**`. Both `TableAuditor` and `MarkdownTable` (`str` subclass) implement `_repr_markdown_()`.
|
|
111
111
|
|
{f8_engine-0.3.3 → f8_engine-0.4.1}/python/f8/skills/f8-modeling/references/syntax-and-grid.md
RENAMED
|
@@ -8,12 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
All formula cell references require explicit 2D bracket syntax:
|
|
10
10
|
|
|
11
|
-
`Table[RowSelector, ColSelector]`
|
|
11
|
+
`Table[RowSelector, ColSelector]` or `@table[RowSelector, ColSelector]`
|
|
12
12
|
|
|
13
13
|
### Coordinate Selectors
|
|
14
14
|
|
|
15
15
|
| Selector type | Syntax | Resolution semantics | Example |
|
|
16
16
|
| :------------------------- | :------------------------------ | :---------------------------------------------------------------------- | :-------------------------------------------- |
|
|
17
|
+
| **Active table** | `@table["row", @col]` | Current evaluation table (avoids repeating table name intra-table) | `@table["revenue", @col] - @table["cogs", @col]` |
|
|
17
18
|
| **Active column** | `Table["row", @col]` | Current evaluation column | `IS["revenue", @col] * 0.40` |
|
|
18
19
|
| **Active row** | `Table[@row, "col"]` | Current evaluation row | `Assumptions[@row, "rate"] * 100` |
|
|
19
20
|
| **Absolute point** | `Table["row", "col"]` | Fixed coordinate (lowers to `$Col$Row`) | `Assumptions["tax_rate", "val"]` |
|
|
@@ -30,9 +31,9 @@ All formula cell references require explicit 2D bracket syntax:
|
|
|
30
31
|
|
|
31
32
|
### Lexical and Grammatical Rules
|
|
32
33
|
|
|
33
|
-
- Table identifiers: Bare ASCII identifiers (`[A-Za-z0-9_]+` containing at least one ASCII letter or `_`) before `[`. Quoted table names (`"Table"[...]`), pure numbers (`123[...]`), or dot access (`Table.row`) raise `FormulaParseError`.
|
|
34
|
+
- Table identifiers: Bare ASCII identifiers (`[A-Za-z0-9_]+` containing at least one ASCII letter or `_`) or `@table` active-table token before `[`. Quoted table names (`"Table"[...]`), pure numbers (`123[...]`), or dot access (`Table.row`) raise `FormulaParseError`.
|
|
34
35
|
- Coordinate keys: Explicit row and column IDs inside `[...]` must be double-quoted strings (`"revenue"`, `"2024E"`). Unquoted keys (`Table[revenue, @col]`) raise `FormulaParseError`.
|
|
35
|
-
- Active axis tokens: Must be `@col
|
|
36
|
+
- Active axis tokens: Must be `@col`, `@row`, or `@table` (strictly before `[`). Bare `@` raises `FormulaParseError`.
|
|
36
37
|
- Uppercase identifiers: Function names (`[A-Z][A-Z0-9_]*`, starting with an ASCII uppercase letter) and boolean literals (`TRUE`, `FALSE`) must be uppercase (table identifiers before `[` may be mixed-case). Lowercase functions/booleans, `null`, or standalone identifiers raise `FormulaParseError`.
|
|
37
38
|
- Omitted arguments (`_`): Valid only as a direct argument in a function call (`PMT(rate, nper, pv, _, type)`). Using `_` in arithmetic or coordinate selectors raises `FormulaParseError`.
|
|
38
39
|
- Operators and precedence (highest to lowest):
|
|
@@ -283,7 +284,7 @@ table.add_column_gutter() -> Table
|
|
|
283
284
|
- Table banners and collapsing:
|
|
284
285
|
- Non-empty `title` emits a full-width title banner row (`start_col..=end_col`). `subtitle` emits a subtitle row beneath `title` (passing an empty or whitespace-only `subtitle=""` raises `SpecificationError`; use `subtitle=None` to omit). If either `title` or `subtitle` is present, a 1-row buffer gutter is inserted before column headers; passing `title=""` (with `subtitle=None`) omits both banner and buffer gutter so column headers start at `start_row`.
|
|
285
286
|
- `collapsible=True`: Groups physical rows `start_row + 1..=end_row` in Excel outline with summary symbols above (`group_symbols_above(True)`).
|
|
286
|
-
- Column width arbitration & text wrapping: Each physical worksheet column takes the maximum width across all tables spanning that column, computed as `round(clamp(max_chars * char_width_multiplier + col_padding, min_col_width, max_col_width), 2)` (default `col_padding=0.0`, `min_col_width=12.0`, `max_col_width=
|
|
287
|
+
- Column width arbitration & text wrapping: Each physical worksheet column takes the maximum width across all tables spanning that column, computed as `round(clamp(max_chars * char_width_multiplier + col_padding, min_col_width, max_col_width), 2)` (default `col_padding=0.0`, `min_col_width=12.0`, `max_col_width=75.0`, where `max_chars` spans per-column header lines—excluding spanning `group`—and `\n`-delimited data cell segments with `indent * 2` plus `+1` alignment-space character on formatted values with trailing alignment spaces; gutter-only columns use `gutter_col_width=3.0`). Cells whose effective width exceeds `max_col_width` or that contain `\n` newlines enable OpenXML `wrapText="1"` (`FormatAlign::VerticalCenter` on all data cells) and scale `SheetLayout.row_heights` to `lines * data_row_height` while leaving `.xlsx` row heights automatic for Excel font auto-fitting.
|
|
287
288
|
|
|
288
289
|
---
|
|
289
290
|
|
|
@@ -315,7 +316,6 @@ Applies theme palette background fill to body cells without changing font color
|
|
|
315
316
|
|
|
316
317
|
- `"none"`: No background shade; clears inherited row/column shade when set on a 0D cell override.
|
|
317
318
|
- `"muted"`: Maps to `theme.palette.shade_muted_fill` (`#F8FAFC` in `corporate_navy`).
|
|
318
|
-
- `"accent"`: Maps to `theme.palette.shade_accent_fill` (`#EFF6FF` in `corporate_navy`).
|
|
319
319
|
- `"alt"`: Maps to `theme.palette.shade_alt_fill` (`#F1F5F9` in `corporate_navy`).
|
|
320
320
|
|
|
321
321
|
### Currency Codes (`CurrencyCode`)
|
|
@@ -228,7 +228,7 @@ type FormatPreset = Literal[
|
|
|
228
228
|
|
|
229
229
|
type SemanticStyle = Literal["data", "subtotal", "total"]
|
|
230
230
|
|
|
231
|
-
type Shade = Literal["none", "muted", "
|
|
231
|
+
type Shade = Literal["none", "muted", "alt"]
|
|
232
232
|
|
|
233
233
|
type CurrencyCode = Literal[
|
|
234
234
|
"USD",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|