Skip to content

[DataGridPremium] Formula support#22807

Draft
MBilalShafi wants to merge 6 commits into
mui:masterfrom
MBilalShafi:feat/formula-support
Draft

[DataGridPremium] Formula support#22807
MBilalShafi wants to merge 6 commits into
mui:masterfrom
MBilalShafi:feat/formula-support

Conversation

@MBilalShafi

@MBilalShafi MBilalShafi commented Jun 15, 2026

Copy link
Copy Markdown
Member

Preview

https://deploy-preview-22807--material-ui-x.netlify.app/x/react-data-grid/formulas/

In Progress

  • Core formula engine
  • Grid-engine adapter
  • Support range and positional operators
  • Introduce A1 style cell references UI layer
  • Autocomplete support in formula editor
  • Fill handle ref adjustment
  • Formula bar recipe
  • Formula Editor UI improvement
  • Excel and CSV export
  • Testing with other features/minor adjustments
  • Improve documentation

MBilalShafi and others added 3 commits June 10, 2026 22:11
First iteration of the Excel-like formula feature: a standalone engine with
zero React/grid imports under hooks/features/formula/engine/.

- Tokenizer, recursive-descent parser (Excel operator precedence, special
  forms REF/COLUMN/ROW/COLUMN_POSITION/ROW_POSITION/FIELD/RANGE/COLUMN_VALUES
  with literal-only arguments), and canonical serializer with a round-trip
  guarantee
- Dependency extraction (static) and position-context binding with
  interval-record range dependencies (never exploded per-cell edges)
- Evaluator with spreadsheet error taxonomy (#REF!, #DIV/0!, #CYCLE!, #NAME?,
  #VALUE!, #ERROR!), strict left-to-right error propagation, lazy IF/AND/OR,
  IFERROR/ISBLANK error observers, and a never-throws contract backed by
  parser depth/height bounds
- Function registry with replacement semantics and 23 built-ins (+
  CONCATENATE alias); reserved and unreachable names rejected
- Kahn-based recompute ordering with built-in cycle detection (iterative,
  stack-safe)
- Ranges and positional references parse but evaluate to #REF! until the
  position-context iteration; AST and resolver types are now frozen
- Design doc with the locked decisions in docsTech/data-grid-formula-feature.md

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Ships the usable computed-column feature on top of the I1 engine: cells
whose row-data value starts with `=` in `allowFormulas` columns evaluate
through a membership-masking value overlay (rendering, sorting,
filtering, aggregation, clipboard, export), with reference-diff
invalidation, data-loss-protected editing (source seeding, valueSetter
equality guard, type-`=`-to-start-a-formula), `GridFormulaApi`, guards
for dataSource/pivoting/disableFormulas, 61 integration tests, and a
minimal docs page.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…pport I3)

Position context (sorted+filtered data rows × visible data columns, utility
columns and autogenerated rows excluded) with one-shot rebind passes on
sortedRowsSet/filteredRowsSet/columnVisibilityModelChange/columnsChange;
RANGE/COLUMN_VALUES evaluation with the interval dependents tier (range graph
edges expand to formula cells inside bounds in both directions); row grouping
keys and row spanning comparisons now use evaluated values, re-triggered after
formula passes (one community addition: private resetRowSpanningState API);
#REF! hardening regression pins; SUM(COLUMN_VALUES) 100k benchmark (~71ms full
pass, ~45ms single-edit diff).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@MBilalShafi MBilalShafi self-assigned this Jun 15, 2026
@MBilalShafi MBilalShafi added scope: data grid Changes related to the data grid. type: new feature Expand the scope of the product to solve a new problem. plan: Premium Impact at least one Premium user. labels Jun 15, 2026
@code-infra-dashboard

code-infra-dashboard Bot commented Jun 15, 2026

Copy link
Copy Markdown

Deploy preview

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 🔺+245B(+0.06%) 🔺+65B(+0.05%)
@mui/x-data-grid-pro 🔺+250B(+0.05%) 🔺+80B(+0.05%)
@mui/x-data-grid-premium 🔺+64KB(+8.96%) 🔺+18.9KB(+9.16%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Jun 15, 2026
@siriwatknp siriwatknp self-requested a review June 15, 2026 08:11

@siriwatknp siriwatknp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

I think this UX is crucial for the first version, it could use similar approach as the long-text column type via popper.

The input should grow with the formula value, otherwise, it's very hard to use.

Let me know what's the scope you want to be reviewed in this PR, UX could be a separate PR too.

@siriwatknp

Copy link
Copy Markdown
Member

I suggest spending time on improving the description to explain the scope of this feature so we are aligned on what to expect from the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plan: Premium Impact at least one Premium user. PR: out-of-date The pull request has merge conflicts and can't be merged. scope: data grid Changes related to the data grid. type: new feature Expand the scope of the product to solve a new problem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants