@smart-grid/core
v1.2.0
Published
Framework-neutral grid state, row processing, filtering, sorting, pagination, and export utilities.
Maintainers
Readme
@smart-grid/core
Monorepo / npm release 1.2.0 (stable 1.x).
What's new in 1.2.0
column-sizing—autoSizeColumns(),resolveFlexColumnWidths();GridOptions.autoSizeColumns,ColumnDef.flex.column-pinning— sticky pinned columns viabuildPinnedCellInlineStyle().accessibility-announce—describeSortChange(),describeFilterChange().GridOptions:floatingFilters,enableColumnResize; server-sidequickFilterTexton requests.createExcelWorkbookMulti()and XLSX number-format improvements.- See CHANGELOG.md and the monorepo changelog.
Framework-neutral row engine for Smart Grid: sorting, filtering, pagination, selection, grouping, pivoting, tree and master/detail flattening, CSV/Excel helpers, chart specs + SVG rendering hooks, column/context/tool menus, clipboard text, formulas, server-side request shaping, virtualization math, and shared TypeScript types. All UI packages (React, Angular, vanilla) depend on this layer.
Live demo & docs: https://smart-grid-mu.vercel.app/
Use
@smart-grid/coredirectly for unit tests, Node scripts, custom pipelines, or when you only need pure functions and types without mounting a grid.
Install
npm install @smart-grid/coreUsage — process rows in memory
import {
processGridRows,
type ColumnDef,
type SortModel,
type FilterModel
} from "@smart-grid/core";
type Row = { sku: string; qty: number };
const columns: ColumnDef<Row>[] = [
{ field: "sku", headerName: "SKU", sortable: true, filter: true },
{ field: "qty", headerName: "Qty", sortable: true }
];
const sortModel: SortModel<Row>[] = [{ field: "qty", direction: "desc" }];
const filterModel: FilterModel<Row>[] = [{ field: "sku", value: "A" }];
const processed = processGridRows({
rowData: [
{ sku: "A-1", qty: 3 },
{ sku: "B-2", qty: 10 },
{ sku: "A-3", qty: 1 }
],
columnDefs: columns,
sortModel,
filterModel,
pagination: true,
pageSize: 25,
page: 0
});
console.log(processed.rows); // filtered, sorted, paged view
console.log(processed.totalRows);Usage — export CSV text
import { exportRowsToCsv, type ColumnDef } from "@smart-grid/core";
const cols: ColumnDef<{ a: number }>[] = [{ field: "a", headerName: "A" }];
const csv = exportRowsToCsv([{ a: 1 }, { a: 2 }], cols);GridOptions UI config (toolbar, paginationUi)
On GridOptions, optional toolbar (GridToolbarOptions) and paginationUi (GridPaginationOptions) configure built-in toolbar actions and pagination footer in React, Angular, and vanilla adapters. Helpers include buildToolbarButtons, buildPaginationNavButtons, buildPageNumberWindow, and getPaginationRowRange.
Docs: Toolbar & pagination UI.
Public surface (overview)
Exports are grouped by concern (./sorting, ./filtering, ./grouping, ./pivot, ./treeData, ./masterDetail, ./charts, ./excel, ./clipboard, ./menus, ./serverSide, ./virtualization, ./toolbar, ./pagination-ui, ./types, …). Import from the package root; tree-shaking friendly.
Related packages
| Package | When to use |
| --- | --- |
| @smart-grid/react | SmartGrid in React apps |
| @smart-grid/angular | <smart-grid> in Angular apps |
| @smart-grid/js | createSmartGrid() in the browser |
| @smart-grid/themes | Shared CSS |
| @smart-grid/enterprise | Optional license + enterprise helper bundle |
Links
- Homepage / demo: smart-grid-mu.vercel.app
- Repository: github.com/rajkishorsahu89/smart-grid
- Issues: github.com/rajkishorsahu89/smart-grid/issues
