JSPM

@smart-grid/core

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 14
  • Score
    100M100P100Q76497F
  • 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.0.0 (stable 1.x).

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);

Public surface (overview)

Exports are grouped by concern (./sorting, ./filtering, ./grouping, ./pivot, ./treeData, ./masterDetail, ./charts, ./excel, ./clipboard, ./menus, ./serverSide, ./virtualization, ./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