Registry / web-framework / table-js

table-js

JSON →
library9.4.0jsnpmunverified

table-js is a high-performance JavaScript library designed for efficiently viewing and editing tabular data. It leverages ES modules exclusively, meaning consumers must use a module-aware bundler like Webpack or Rollup for browser environments, as it does not ship pre-built artifacts. The current stable version is 9.4.0, with minor and patch releases occurring frequently, typically driven by dependency updates or internal chore tasks. Its key differentiator is its focus on speed and its integration within the bpmn.io ecosystem, often used alongside `diagram-js` and `inferno` for rich web applications requiring structured data display and interaction.

npm install table-js
INSTALL
IMPORT
SIG · TABLE-JS
T
table-js
web-frameworkjavascriptv9.4.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Table
import Table from 'table-js';
const Table = require('table-js');
The library is ES module-only. CommonJS `require` will not work. Some specific features might be named exports.
TableViewer
import { TableViewer } from 'table-js';
import TableViewer from 'table-js/lib/TableViewer';
Assuming a named export for a specific component. Direct import paths to `lib` are typically internal and unstable.
TableEditor
import { TableEditor } from 'table-js';
const TableEditor = require('table-js').TableEditor;
For ESM, always use `import` statements. Named exports are common for utilities or specific components.

Demonstrates basic setup of a table-js instance by creating a container and rendering a simple table using a minimal configuration. It implicitly accounts for Inferno as a peer dependency.

import Table from 'table-js'; import { render } from 'inferno'; // Minimal Inferno setup (peer dependency) const InfernoContainer = ({ children }) => <div>{children}</div>; // Assume a basic table configuration and data structure const tableConfig = { container: document.querySelector('#table-container'), data: [ { id: 'row1', cells: [{ id: 'cell1-1', content: 'Header A' }, { id: 'cell1-2', content: 'Value X' }] }, { id: 'row2', cells: [{ id: 'cell2-1', content: 'Header B' }, { id: 'cell2-2', content: 'Value Y' }] } ], columns: [ { id: 'col1', width: 150 }, { id: 'col2', width: 200 } ] }; function initializeTable() { const container = document.createElement('div'); container.id = 'table-container'; document.body.appendChild(container); const table = new Table(tableConfig); table.render(); console.log('Table initialized and rendered.'); // Example of interaction (assuming API) // table.on('cell.select', (event) => { // console.log('Cell selected:', event.element); // }); } // You would typically mount your Inferno application // and integrate table-js within an Inferno component. // For a quickstart, we just attach it to a raw DOM element. document.addEventListener('DOMContentLoaded', initializeTable);
Debug
Known issues
breakingMajor versions of `diagram-js` (a peer dependency) are frequently updated, requiring consumers to ensure compatibility with their `diagram-js` installation. For example, v9.2.0 updated `diagram-js` to v15.
fix
Check the `peerDependencies` range for `diagram-js` in `package.json` and ensure your installed `diagram-js` version falls within that range. Upgrade `diagram-js` if necessary.
affects: >=9.1.0
breakingThe library exclusively uses ES modules. Direct `require()` statements will result in runtime errors, particularly in Node.js environments without ES module resolution or older build setups.
fix
Always use ES module `import` syntax. If targeting browsers, use an ES module-aware bundler (e.g., Webpack, Rollup, Vite). For Node.js, ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json`).
affects: >=1.0.0
gotchaThis library does not provide pre-built artifacts. Consumers are responsible for bundling the library themselves, which can add complexity to build configurations, especially for projects not already using a bundler.
fix
Integrate `table-js` into your existing build pipeline using a bundler (Webpack, Rollup, Parcel). Configure the bundler to resolve ES modules and process any necessary assets.
affects: >=1.0.0
breakingMinimum supported Node.js versions may increase with minor releases. For instance, v9.4.0 updated its CI to use Node.js 24.
fix
Ensure your development and production environments run a Node.js version compatible with the latest `table-js` release. Check the `engines.node` field in `package.json`.
affects: >=9.4.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module ... from ... not supported.
Attempting to import `table-js` using CommonJS `require()` syntax in a Node.js environment or a build process not configured for ESM.
fix
Change `const Table = require('table-js');` to `import Table from 'table-js';` (or `import { NamedExport } from 'table-js';`). Ensure your Node.js project or bundler is set up for ES Modules.
Cannot find module 'inferno' or 'diagram-js'
The required peer dependencies `inferno` and/or `diagram-js` are not installed alongside `table-js`.
fix
Install the peer dependencies: `npm install inferno@^5 diagram-js@^15` (adjust versions to match the peer dependency range specified by `table-js`).
Uncaught SyntaxError: Cannot use import statement outside a module
Attempting to run `table-js` directly in a browser without a build step that processes ES Modules.
fix
Use an ES module-aware bundler (e.g., Webpack, Rollup, Parcel) to bundle `table-js` and its dependencies for the browser. Configure your `script` tag with `type="module"` if using native ES modules and not bundling, though bundling is recommended for production.
Upgrade
Version history
9.4.0latest on npm
Audit
Dependencies
infernorequiredRendering engine, specified as a peer dependency.
diagram-jsrequiredCore library for rendering and interaction, specified as a peer dependency.
Agent activity
4 hits · last 30 days
node
4
Resources
table-js — npm install table-js · libregistry