JSPM

@smart-grid/core

1.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 14
  • Score
    100M100P100Q76464F
  • License MIT

Framework-neutral grid state, row processing, filtering, sorting, pagination, and export utilities.

Package Exports

  • @smart-grid/core

Readme

@smart-grid/core

npm Monorepo / npm release 1.2.0 (stable 1.x).

What's new in 1.2.0

  • column-sizingautoSizeColumns(), resolveFlexColumnWidths(); GridOptions.autoSizeColumns, ColumnDef.flex.
  • column-pinning — sticky pinned columns via buildPinnedCellInlineStyle().
  • accessibility-announcedescribeSortChange(), describeFilterChange().
  • GridOptions: floatingFilters, enableColumnResize; server-side quickFilterText on 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/core directly 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/core

Usage — 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.

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

License

MIT