This is a React application demonstrating a powerful, user-configurable calculated column feature for AG-Grid. It allows users to define custom columns on the fly using mathematical expressions, with support for advanced formatting and persistence.
- Dynamic Calculated Columns: Add, edit, and delete custom columns in the grid.
- Custom Expression Builder: A user-friendly modal for creating and editing expressions.
- Free-Form Input: Utilizes a textarea for flexible, complex mathematical and logical expressions, powered by
mathjs. - Result Formatting: Apply rounding modes (e.g.,
HALF_UP,FLOOR) and set a fixed number of decimal places for calculated values. - Live Preview: See the result of your expression instantly based on a sample row of data.
- State Persistence: Your custom column configurations are saved to
localStorageand reloaded on subsequent visits. - Robust Error Handling: Invalid expressions are handled gracefully, displaying
#ERROR!in cells without crashing or polluting the console.
- Framework: React 19 with Vite
- Language: TypeScript
- Grid: AG-Grid Community
- UI Components: Mantine UI
- Expression Parsing:
mathjs
- Node.js (v18 or later)
- pnpm (or your preferred package manager)
- Clone the repository:
git clone <repository-url>
- Navigate to the project directory:
cd my-ag-grid-app - Install the dependencies:
pnpm install
To start the development server, run:
pnpm devThe application will be available at http://localhost:5173.
To create a production build, run:
pnpm buildThe output files will be located in the dist/ directory.