apexgrid-skill 2.1.1 → 2.3.0
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/SKILL.md
CHANGED
|
@@ -8,12 +8,13 @@ description: >
|
|
|
8
8
|
the grid styles itself via `--ag-*` CSS variables), the generic
|
|
9
9
|
`ColumnConfiguration<T>` shape with its 13 column types, Lit `cellTemplate`
|
|
10
10
|
requirements, sorting / filtering / quick-filter, pagination, inline editing,
|
|
11
|
-
row selection, master-detail and tree rows, CSV export,
|
|
12
|
-
|
|
11
|
+
row selection, master-detail and tree rows, CSV export, batch writes via
|
|
12
|
+
`applyEdits`, right-to-left layout, the UI-only event model, and the
|
|
13
|
+
`dataPipelineConfiguration` hooks for server-side data.
|
|
13
14
|
metadata:
|
|
14
15
|
author: ApexCharts
|
|
15
|
-
version: "2.
|
|
16
|
-
library_version: "3.
|
|
16
|
+
version: "2.3.0"
|
|
17
|
+
library_version: "3.5.0"
|
|
17
18
|
category: data-visualization
|
|
18
19
|
tags: [grid, data-grid, table, web-component, lit, apex-grid]
|
|
19
20
|
docs: https://github.com/apexcharts/apexgrid
|
|
@@ -114,6 +115,8 @@ render(
|
|
|
114
115
|
|
|
115
116
|
If rows don't render at all, it's almost always the host height (§1.2). If the grid looks bare, you don't need a theme import — check your `--ag-*` overrides aren't fighting the defaults.
|
|
116
117
|
|
|
118
|
+
> One non-obvious case, fixed in **3.5.0**: a grid first laid out while it is off-screen (inside an iframe the host page has not sized yet, or below the fold on a page still settling) could render zero rows while reporting a correct row count and scroll height, and stay that way until something forced a re-render. On 3.5.0 and later the body detects this and re-measures itself. On earlier versions, reassign `grid.data = grid.data.slice()` once the layout settles.
|
|
119
|
+
|
|
117
120
|
> **Dev-server reminder.** ES module imports need an HTTP server — opening via `file://` fails with CORS errors. Use Vite (`npm create vite@latest`), any static server, or your framework's dev server.
|
|
118
121
|
|
|
119
122
|
---
|
|
@@ -337,6 +340,7 @@ Declarative validators (`column.validators`), column groups (`columnGroups`), un
|
|
|
337
340
|
| row pinning | `pinRow(row, 'top' \| 'bottom')`, `unpinRow(row)` (needs `rowPinning.enabled`) |
|
|
338
341
|
| row reorder | `moveRow(from, to, position?)` (needs `rowReordering.enabled`) |
|
|
339
342
|
| editing | `commitEdit()`, `cancelEdit()` (used with `mode: 'row'`) |
|
|
343
|
+
| `applyEdits(edits)` | Write many cells as **one** operation: one undo step, one pipeline run. Returns a tally, not a count. (3.5) |
|
|
340
344
|
| undo/redo | `undo()`, `redo()`, `clearHistory()` (needs `editing.history.enabled`) |
|
|
341
345
|
| state | `getState(options?)` → `GridState`, `setState(partial, options?)` → `SetStateResult`, `getSchema()` → `GridSchema` |
|
|
342
346
|
| `ApexGrid.register()` / `ApexGrid.tagName` | Static element registration / `'apex-grid'`. |
|
|
@@ -373,6 +377,38 @@ Single-shot events (no `-ing` pair):
|
|
|
373
377
|
|
|
374
378
|
Operand reference, multi-column sort, and server-side hooks: `references/sort-and-filter.md` and `references/data-pipeline.md`. Row pinning/reorder, undo/redo, validators, column groups, state/schema, and localization: `references/state-and-features.md`.
|
|
375
379
|
|
|
380
|
+
### Keyboard & accessibility (3.4, 3.5)
|
|
381
|
+
|
|
382
|
+
The grid ships full keyboard operation and screen-reader support out of the box; there's nothing to enable. The body uses a **roving-tabindex** focus model: the active cell is the body's single tab stop, so `Tab` moves into and out of the grid in one step, and real focus follows arrow-key navigation (screen readers track cell-to-cell movement).
|
|
383
|
+
|
|
384
|
+
| Key | Moves / does |
|
|
385
|
+
|---|---|
|
|
386
|
+
| Arrow keys | Move the active cell one cell up / down / left / right |
|
|
387
|
+
| Home / End | Move to the **first / last cell of the current row** |
|
|
388
|
+
| Ctrl/Cmd+Home / Ctrl/Cmd+End | Jump to the grid's first / last cell |
|
|
389
|
+
| PageUp / PageDown | Page-scroll by a viewport |
|
|
390
|
+
| Enter or F2 | Open the active cell's editor (editing is no longer pointer-only) |
|
|
391
|
+
|
|
392
|
+
Keyboard-driven commit (Enter) or cancel (Escape) returns focus to the cell, so navigation continues from where you left off.
|
|
393
|
+
|
|
394
|
+
**Editing behavior:** clearing a `number` or `currency` editor now commits `null` (previously it wrote `NaN`). An empty or unparseable numeric input leaves the cell empty rather than poisoning the row.
|
|
395
|
+
|
|
396
|
+
**Announcements:** sorting, filtering, selection, paging, row pinning, row reorder, expansion, and undo / redo each announce through a localized live region, and the host applies a localized `aria-label` ("Data grid") plus `aria-multiselectable` when multi-row selection is on. The strings are locale keys (`announce.*`, `header.*`, `grid.label`, `editor.rating`); override them via `localeText` (see `references/state-and-features.md`).
|
|
397
|
+
|
|
398
|
+
**New in 3.5, all automatic:** the grid honours `prefers-reduced-motion` (every transition routes through the `--ag-dur-*` tokens, which zero under the media query), it stays usable under forced colors / Windows High Contrast (the active-cell ring, invalid-cell ring, selected-row bar and focus rings are painted as outlines, which forced colors recolours rather than drops), and interactive targets meet the WCAG 2.2 AA 24x24 minimum. The only visible change is that the paginator bar is 2px taller.
|
|
399
|
+
|
|
400
|
+
### Right-to-left (3.5)
|
|
401
|
+
|
|
402
|
+
Set `dir="rtl"` on the grid or any ancestor and it mirrors completely. There is no property to set and nothing to import: direction is read from the computed style, so an inherited `dir` works.
|
|
403
|
+
|
|
404
|
+
```html
|
|
405
|
+
<html dir="rtl">
|
|
406
|
+
<apex-grid></apex-grid> <!-- inherits; no grid-level config -->
|
|
407
|
+
</html>
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
Arrow-key navigation, column resize and column reorder all follow inline order rather than screen direction, so ArrowLeft moves to the *next* column in RTL. Column pinning `'start'` / `'end'` were already logical and are unchanged.
|
|
411
|
+
|
|
376
412
|
---
|
|
377
413
|
|
|
378
414
|
## 6. Pitfalls — ❌ Wrong vs ✅ Correct
|
|
@@ -426,6 +462,6 @@ Operand reference, multi-column sort, and server-side hooks: `references/sort-an
|
|
|
426
462
|
| Column types, templates, auto-generation, per-column styling, header/editor templates | `references/columns-and-templates.md` |
|
|
427
463
|
| Sort & filter — operands, expressions, multi-column, quick-filter, events | `references/sort-and-filter.md` |
|
|
428
464
|
| Server-side data hooks (sort/filter/pagination/quickFilter), virtualization, `dataView` | `references/data-pipeline.md` |
|
|
429
|
-
| Row pinning / reordering, undo-redo, validators, column groups, state & schema (`getState`/`setState`/`getSchema`), localization, export source | `references/state-and-features.md` |
|
|
465
|
+
| Row pinning / reordering, undo-redo, batch edits (`applyEdits`), validators, column groups, state & schema (`getState`/`setState`/`getSchema`), localization, export source | `references/state-and-features.md` |
|
|
430
466
|
| End-to-end vanilla JS (no Lit `render`) | `references/vanilla-js.md` |
|
|
431
467
|
| Lit, React, Vue, Angular integration | `references/framework-integration.md` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apexgrid-skill",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "AI coding skill for the apex-grid web component — structured reference docs that help AI assistants (Claude, Cursor, Copilot, etc.) generate correct apex-grid code.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"apex-grid",
|
|
@@ -173,6 +173,8 @@ import { required, min, max, pattern, custom } from 'apex-grid';
|
|
|
173
173
|
|
|
174
174
|
Built-in factories: `required(message?)`, `min(limit, message?)`, `max(limit, message?)`, `pattern(regex, message?)`, `custom(fn)`. `min`/`max`/`pattern` pass on empty / non-numeric values — compose with `required`. See `references/state-and-features.md` for the `Validator` / `ValidatorContext` shapes and the `cellValidationFailed` payload.
|
|
175
175
|
|
|
176
|
+
**Numeric editing (3.4):** clearing a `number` or `currency` editor now commits `null`, not `NaN`. An empty or unparseable numeric input leaves the cell empty instead of writing `NaN` into the row. Editing also opens from the keyboard now (Enter or F2 on the active cell), not only by pointer; see SKILL.md §5 for the full keyboard model. Separately, a spreadsheet-style error value (an object carrying a `#...` code, such as an enterprise formula engine's `#VALUE!`) renders as its code in typed `number` / `currency` columns rather than coercing to `NaN` and showing an empty cell.
|
|
177
|
+
|
|
176
178
|
## Auto-generation — the fastest demo
|
|
177
179
|
|
|
178
180
|
The shortest possible "just show me a table" example:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# State, Localization & Interaction Features (3.1+)
|
|
2
2
|
|
|
3
|
-
> Everything here landed in **apex-grid 3.1 – 3.
|
|
3
|
+
> Everything here landed in **apex-grid 3.1 – 3.4** on top of the 3.0 API. The setup rules from `SKILL.md` (register + bounded host height, no theme import) still apply. Row pinning / reordering, undo-redo, and validators are all **opt-in** via a config object — off by default.
|
|
4
4
|
|
|
5
5
|
## Row pinning — sticky top / bottom bands
|
|
6
6
|
|
|
@@ -52,6 +52,32 @@ grid.canUndo; grid.canRedo; // getters (false unless history
|
|
|
52
52
|
|
|
53
53
|
`stackSize` defaults to `100` (older commands evicted past the cap). Event: `historyChanged` — `CustomEvent<{ canUndo: boolean; canRedo: boolean }>`, fires after any record / undo / redo / clear (drive toolbar button enablement from it).
|
|
54
54
|
|
|
55
|
+
## Batch edits: `applyEdits()` (3.5)
|
|
56
|
+
|
|
57
|
+
Writes many cells as a single operation. Each write still goes through the same choke point interactive editing uses, so it emits the cancellable `cellValueChanging` and then `cellValueChanged`, and runs the column's validators. What differs from looping `editCell` + `commitEdit` is that the whole set lands as **one undo step and one pipeline run**: a thousand round-trips would otherwise mean a thousand undo entries and a thousand re-renders.
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
const tally = grid.applyEdits([
|
|
61
|
+
{ rowIndex: 0, column: 'discount', value: 0 },
|
|
62
|
+
{ rowIndex: 3, column: 'discount', value: 0 },
|
|
63
|
+
]);
|
|
64
|
+
// { applied: 2, unchanged: 0, invalid: 0, cancelled: 0, skipped: 0 }
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`rowIndex` is **view-relative** and matches `grid.pageItems`, the same as `editCell`. Order is preserved, so a later edit to the same cell wins.
|
|
68
|
+
|
|
69
|
+
It returns a per-outcome tally rather than a count, because "nothing changed" and "everything was rejected" are different answers:
|
|
70
|
+
|
|
71
|
+
| Key | Means |
|
|
72
|
+
|---|---|
|
|
73
|
+
| `applied` | The value actually changed. |
|
|
74
|
+
| `unchanged` | The cell already held that value. |
|
|
75
|
+
| `invalid` | A `column.validators` rule rejected it. |
|
|
76
|
+
| `cancelled` | A `cellValueChanging` listener called `preventDefault()`. |
|
|
77
|
+
| `skipped` | Unknown column, `rowIndex` out of range, or a column the user could not edit either (editing off, not `editable`, or hidden). |
|
|
78
|
+
|
|
79
|
+
Skipping rather than throwing means a partially stale batch still applies what it can. Needs `editing.enabled` and per-column `editable`, the same gate as interactive editing; without `editing.history.enabled` the batch simply is not recorded.
|
|
80
|
+
|
|
55
81
|
## Declarative column validators
|
|
56
82
|
|
|
57
83
|
`column.validators: Validator[]` run **before** a candidate value is written. Each returns an error `string` (reject) or `null` (pass). All run and every message is collected, so one commit can surface multiple errors. A failing commit keeps the editor open, marks the cell `aria-invalid`, and emits `cellValidationFailed`. Covers bulk edits (paste / fill) too.
|
|
@@ -172,6 +198,8 @@ grid.localize('pagination.summary', { start: 1, end: 25, total: 100 }); // res
|
|
|
172
198
|
|
|
173
199
|
Exports: `EN_LOCALE` (the default dictionary / source of truth for keys), `esLocale` (ready-made Spanish), `interpolate` (`{token}` substitution), `localize`, and the types `GridLocaleKey` / `GridLocaleText` / `LocaleParams`. `grid.localize(key, params?, fallback?)` applies any `localeText` override over the English default and interpolates `{placeholder}` tokens; `fallback` covers keys outside the built-in set (e.g. a custom operand label).
|
|
174
200
|
|
|
201
|
+
**3.4 key changes** (both English and Spanish): the accessibility work added live-region announcement keys (`announce.*`, e.g. `announce.sortedAscending`, `announce.page`, `announce.rowSelected`, `announce.undoOne`), header control / sort-state labels (`header.*`, e.g. `header.sortedAscending`, `header.filterColumn`, `header.columnMenu`), the host label `grid.label` ("Data grid"), and `editor.rating`. The `ai.noAdapter` key was **removed** (drop it from any `localeText` override you kept). `EN_LOCALE` remains the source of truth for the full, current key list.
|
|
202
|
+
|
|
175
203
|
## Column menu & column separator
|
|
176
204
|
|
|
177
205
|
| Property | Type | Default | Notes |
|