@nexgrid/react 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -31
- package/dist/index.cjs +463 -290
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -7
- package/dist/index.d.ts +19 -7
- package/dist/index.js +483 -300
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/styles.css +135 -0
package/README.md
CHANGED
|
@@ -10,16 +10,19 @@ There is no local sort that quietly reorders 10 rows out of 40,000, and no
|
|
|
10
10
|
client-side filter that hides records the total still counts.
|
|
11
11
|
|
|
12
12
|
Around that core it provides the things every real admin table ends up needing:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
- 🗂️ **Column Header Grouping (Multi-Level / Stacked Headers)** — Group sub-columns beneath parent categories with automatic `colSpan` and `rowSpan` calculation.
|
|
14
|
+
- 🚀 **Client-Side Pagination & In-Memory Engine** — Zero-config in-memory paging, sorting, search, filtering, and export over local arrays.
|
|
15
|
+
- 💾 **Grid State Persistence (`storageKey`)** — Automatically saves column widths, column order, hidden columns, and row density to `localStorage`.
|
|
16
|
+
- ↔️ **Column Resizing & Auto-Fit** — Interactive drag resize handles and double-click auto-fit measuring.
|
|
17
|
+
- 🏷️ **Active Filter Pills Bar** — Interactive chip badges beneath the toolbar for active search & column filters with one-click `✕` removal and "Clear all".
|
|
18
|
+
- 🔍 **Debounced global search** (350 ms), 3-state sorting cycle (`asc → desc → cleared`), multi-column sorting.
|
|
19
|
+
- 📌 **Pinned columns** (left / right freeze), master-detail accordion row expansion, summary/aggregation footer row.
|
|
20
|
+
- 📊 **Formatted Excel (`.xls`) and CSV export**, including whole-dataset export across pages.
|
|
21
|
+
- 📱 **Responsive layout** — Full desktop table at ≥ 768 px, smart card list below.
|
|
22
|
+
- 💛 **Dual Language Support** — 100% compatible with both **TypeScript (TSX)** and **plain JavaScript (JSX)** with JSDoc typing.
|
|
18
23
|
|
|
19
24
|
- Zero runtime dependencies beyond `@nexgrid/core`. React is a peer dependency.
|
|
20
|
-
-
|
|
21
|
-
- Ships ESM and CJS, with a `"use client"` banner so it drops straight into the
|
|
22
|
-
Next.js App Router.
|
|
25
|
+
- Ships ESM and CJS, with a `"use client"` banner so it drops straight into the Next.js App Router.
|
|
23
26
|
|
|
24
27
|
<p align="center">
|
|
25
28
|
<img src="https://raw.githubusercontent.com/ChhaganSinha/NexGrid/master/docs/assets/tablex-preview.png" alt="TableX React Data Grid Preview" width="100%" />
|
|
@@ -186,33 +189,41 @@ Two notes:
|
|
|
186
189
|
|
|
187
190
|
| Prop | Type | Default | Description |
|
|
188
191
|
|------|------|---------|-------------|
|
|
189
|
-
| `columns` | `TableXReactColumn<TData>[]` | required | Column definitions, in display order. |
|
|
190
|
-
| `data` | `TData[]` | required | The
|
|
191
|
-
| `total` | `number` |
|
|
192
|
-
| `query` | `QueryState` |
|
|
193
|
-
| `onQueryChange` | `(next: QueryState) => void` |
|
|
194
|
-
| `
|
|
195
|
-
| `
|
|
196
|
-
| `
|
|
197
|
-
| `
|
|
198
|
-
| `
|
|
199
|
-
| `
|
|
200
|
-
| `
|
|
192
|
+
| `columns` | `TableXReactColumn<TData>[]` | required | Column definitions, in display order (supports multi-level `columns`). |
|
|
193
|
+
| `data` | `TData[]` | required | The current page of rows, or the entire array if `clientSidePagination` is true. |
|
|
194
|
+
| `total` | `number` | optional in client mode | Total filtered row count from the server. Drives the pager. |
|
|
195
|
+
| `query` | `QueryState` | optional in client mode | The query the `data` above answers. |
|
|
196
|
+
| `onQueryChange` | `(next: QueryState) => void` | optional in client mode | Called with the next query on page / size / sort / search changes. |
|
|
197
|
+
| `clientSidePagination` | `boolean` | `false` | Enables zero-config in-memory paging, sorting, search, and filtering over local data. |
|
|
198
|
+
| `storageKey` | `string` | — | Persists custom column widths, column order, hidden columns, and density to `localStorage`. |
|
|
199
|
+
| `caption` | `string` | required | Accessible name for the table; also default export filename and sheet title. |
|
|
200
|
+
| `density` | `"compact" \| "default" \| "comfortable"` | `"default"` | Initial density preset. |
|
|
201
|
+
| `enableColumnResize` | `boolean` | `true` | Enables interactive drag-to-resize and double-click auto-fit on column borders. |
|
|
202
|
+
| `enableColumnFilters` | `boolean` | `true` | Enables 3-dot column filter popovers (⋮) for text, select, and range filters. |
|
|
203
|
+
| `enableSorting` | `boolean` | `true` | Global switch for column sorting. |
|
|
204
|
+
| `enableSummaryRow` | `boolean` | `false` | Renders a summary / aggregation row in `<tfoot>`. |
|
|
205
|
+
| `enableRowExpansion` | `boolean` | `false` | Master-detail accordion expandable sub-rows. |
|
|
206
|
+
| `renderExpandedRow` | `(row: TData) => ReactNode` | — | Render function for expanded row content. |
|
|
207
|
+
| `enableBulkActions` | `boolean` | `false` | Floating bottom pill bar for batch operations on selected rows. |
|
|
208
|
+
| `isLoading` | `boolean` | `false` | Replaces rows with a spinner while keeping toolbar and footer interactive. |
|
|
209
|
+
| `error` | `boolean` | `false` | Replaces the whole grid with an accessible error card. |
|
|
210
|
+
| `onRetry` | `() => void` | — | When set, the error card displays a retry button. |
|
|
211
|
+
| `enableSelection` | `boolean` | `false` | Renders row selection checkboxes. |
|
|
212
|
+
| `selectionMode` | `"multi" \| "single"` | `"multi"` | Whether multiple rows or only one row can be selected. |
|
|
213
|
+
| `onSelectionChange` | `(ids: string[]) => void` | — | Fires after each selection change. |
|
|
201
214
|
| `enableSearch` | `boolean` | `true` | Shows the debounced global search box. |
|
|
202
215
|
| `searchPlaceholder` | `string` | `locale.searchPlaceholder` | Placeholder text for the search box. |
|
|
203
|
-
| `toolbarActions` | `ReactNode` | — |
|
|
204
|
-
| `onRowClick` | `(row: TData) => void` | — | Row / card click handler. Adds
|
|
216
|
+
| `toolbarActions` | `ReactNode` | — | Custom actions rendered at the end of the toolbar. |
|
|
217
|
+
| `onRowClick` | `(row: TData) => void` | — | Row / card click handler. Adds pointer cursor and keyboard activation. |
|
|
205
218
|
| `getRowId` | `(row: TData) => string` | `String(row.id ?? row)` | Stable row identity, used for selection and React keys. |
|
|
206
|
-
| `
|
|
207
|
-
| `
|
|
208
|
-
| `
|
|
209
|
-
| `
|
|
210
|
-
| `
|
|
211
|
-
| `fetchEndpoint` | `string` | — | List endpoint used to page in the rest of the dataset when exporting. |
|
|
212
|
-
| `badgeRules` | `readonly ExcelBadgeRule[]` | core's `DEFAULT_BADGE_RULES` | Value-based cell styling for the Excel export. |
|
|
219
|
+
| `showSerialNumber` | `boolean` | `true` | Shows automatic `S.No.` column, numbered across pages. |
|
|
220
|
+
| `enableExport` | `boolean` | `true` | Shows the export menu (Excel, CSV, Clipboard). |
|
|
221
|
+
| `exportFileName` | `string` | caption, slug-safe | File name prefix without extension. |
|
|
222
|
+
| `fetchEndpoint` | `string` | — | Endpoint used to page in the full dataset during export. |
|
|
223
|
+
| `badgeRules` | `readonly ExcelBadgeRule[]` | core's `DEFAULT_BADGE_RULES` | Value-based cell styling for Excel export. |
|
|
213
224
|
| `locale` | `Partial<TableXLocale>` | English defaults | Overrides for any user-facing string. |
|
|
214
|
-
| `onNotify` | `(notice: TableXNotice) => void` | no-op | Receives `{ type, message }` for
|
|
215
|
-
| `theme` | `"light" \| "dark" \| "auto"` | `"light"` |
|
|
225
|
+
| `onNotify` | `(notice: TableXNotice) => void` | no-op | Receives `{ type, message }` for notifications. |
|
|
226
|
+
| `theme` | `"light" \| "dark" \| "auto"` | `"light"` | Sets `.tbx-dark` / `.tbx-auto` theme mode. |
|
|
216
227
|
|
|
217
228
|
## Column definitions
|
|
218
229
|
|
|
@@ -224,6 +235,7 @@ A column is a plain object, structurally compatible with TanStack Table's
|
|
|
224
235
|
| `id` | `string` | Column id. Falls back to `accessorKey`. |
|
|
225
236
|
| `accessorKey` | `string` | The row property this column reads. |
|
|
226
237
|
| `header` | `string \| (ctx) => ReactNode` | Header content. A string is also used for menus and export headers. |
|
|
238
|
+
| `columns` | `TableXReactColumn<TData>[]` | Nested sub-columns for multi-level stacked column header groups. |
|
|
227
239
|
| `cell` | `(ctx: { row: { original: TData }, getValue(): unknown }) => ReactNode` | Custom cell renderer. Without it the raw value is rendered as text. |
|
|
228
240
|
| `enableSorting` | `boolean` | Sorting is on by default; set `false` to opt out. |
|
|
229
241
|
| `meta` | `TableXColumnMeta` | Layout and behavior hints — see below. |
|