apex-grid 3.4.0 → 3.5.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/CHANGELOG.md +101 -0
- package/README.md +45 -6
- package/components/grid.d.ts +127 -0
- package/components/grid.js +25 -0
- package/components/grid.js.map +1 -1
- package/components/header-row.js +8 -0
- package/components/header-row.js.map +1 -1
- package/components/header.js +5 -3
- package/components/header.js.map +1 -1
- package/components/row.js +32 -4
- package/components/row.js.map +1 -1
- package/components/virtualizer.d.ts +5 -1
- package/components/virtualizer.js +72 -2
- package/components/virtualizer.js.map +1 -1
- package/controllers/navigation.d.ts +1 -0
- package/controllers/navigation.js +10 -5
- package/controllers/navigation.js.map +1 -1
- package/controllers/reorder.js +4 -2
- package/controllers/reorder.js.map +1 -1
- package/controllers/state.d.ts +9 -3
- package/controllers/state.js +11 -1
- package/controllers/state.js.map +1 -1
- package/custom-elements.json +439 -181
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/ApexGrid.html +586 -0
- package/docs/classes/ApexGridPaginator.html +36 -0
- package/docs/classes/ApexGridToolbar.html +67 -0
- package/docs/functions/localize.html +2 -2
- package/docs/functions/setup.html +1 -2
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +33 -6
- package/docs/interfaces/ApexCellValidationFailedEvent.html +1 -1
- package/docs/interfaces/ApexCellValueChangedEvent.html +1 -1
- package/docs/interfaces/ApexCellValueChangingEvent.html +2 -2
- package/docs/interfaces/ApexColumnMovedEvent.html +2 -2
- package/docs/interfaces/ApexColumnMovingEvent.html +1 -1
- package/docs/interfaces/ApexDetailContext.html +2 -2
- package/docs/interfaces/ApexGridEventMap.html +5 -5
- package/docs/interfaces/ApexRowMovingEvent.html +1 -1
- package/docs/interfaces/ApexRowPinningEvent.html +1 -1
- package/docs/interfaces/BaseApexCellContext.html +1 -1
- package/docs/interfaces/BaseApexEditorContext.html +1 -1
- package/docs/interfaces/BaseColumnConfiguration.html +3 -3
- package/docs/interfaces/CSVExportOptions.html +2 -2
- package/docs/interfaces/DataPipelineConfiguration.html +2 -2
- package/docs/interfaces/EditingHistoryConfiguration.html +1 -1
- package/docs/interfaces/ExportFormat.html +2 -2
- package/docs/interfaces/ExportOptions.html +1 -1
- package/docs/interfaces/GridRowPinningConfiguration.html +1 -1
- package/docs/interfaces/GridRowReorderingConfiguration.html +2 -2
- package/docs/interfaces/PaginationConfiguration.html +1 -1
- package/docs/interfaces/PaginationState.html +1 -1
- package/docs/media/_tokens.scss +29 -8
- package/docs/media/package.json +3 -4
- package/docs/media/state-persistence.html +0 -10
- package/docs/modules.html +1 -1
- package/docs/types/DataPipelineParams.html +2 -2
- package/docs/types/EditMode.html +2 -2
- package/docs/types/GridLocaleText.html +1 -1
- package/docs/types/PaginationMode.html +1 -1
- package/docs/variables/EN_LOCALE.html +3 -3
- package/docs/variables/esLocale.html +1 -1
- package/i18n/en.d.ts +14 -0
- package/i18n/en.js +14 -0
- package/i18n/en.js.map +1 -1
- package/i18n/es.js +14 -0
- package/i18n/es.js.map +1 -1
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/internal/feature-module.d.ts +22 -0
- package/internal/feature-module.js +5 -0
- package/internal/feature-module.js.map +1 -1
- package/internal/index.d.ts +2 -2
- package/internal/index.js +1 -1
- package/internal/index.js.map +1 -1
- package/internal/utils.d.ts +14 -0
- package/internal/utils.js +5 -0
- package/internal/utils.js.map +1 -1
- package/package.json +1 -2
- package/setup.d.ts +12 -11
- package/setup.js +12 -4
- package/setup.js.map +1 -1
- package/styles/_common.css.js +1 -1
- package/styles/_common.css.js.map +1 -1
- package/styles/_tokens.css.js +1 -1
- package/styles/_tokens.css.js.map +1 -1
- package/styles/body-cell/body-cell.css.js +1 -1
- package/styles/body-cell/body-cell.css.js.map +1 -1
- package/styles/body-row/body-row.css.js +1 -1
- package/styles/body-row/body-row.css.js.map +1 -1
- package/styles/filter-row/filter-row.css.js +1 -1
- package/styles/filter-row/filter-row.css.js.map +1 -1
- package/styles/grid/_grid.base.css.js +1 -1
- package/styles/grid/_grid.base.css.js.map +1 -1
- package/styles/grid/grid.css.js +1 -1
- package/styles/grid/grid.css.js.map +1 -1
- package/styles/group-header-row/group-header-row.css.js +1 -1
- package/styles/group-header-row/group-header-row.css.js.map +1 -1
- package/styles/header-cell/header-cell.css.js +1 -1
- package/styles/header-cell/header-cell.css.js.map +1 -1
- package/styles/header-row/header-row.base.css.js +1 -1
- package/styles/header-row/header-row.base.css.js.map +1 -1
- package/styles/paginator/paginator.css.js +1 -1
- package/styles/paginator/paginator.css.js.map +1 -1
- package/styles/toolbar/toolbar.css.js +1 -1
- package/styles/toolbar/toolbar.css.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,107 @@ All notable changes to the `apex-grid` (community) package are documented here.
|
|
|
4
4
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
|
|
5
5
|
and the format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
6
6
|
|
|
7
|
+
## [3.5.0] - 2026-09-12
|
|
8
|
+
|
|
9
|
+
A feature and accessibility release. No exported symbol was removed or renamed.
|
|
10
|
+
Two consumer-visible changes are listed under Changed and Removed: the Ignite UI
|
|
11
|
+
dependencies are gone, and `setup({ theme })` is now inert.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- **Right-to-left support.** `dir="rtl"` on the grid or any ancestor mirrors it
|
|
15
|
+
completely. Direction is read from the computed style rather than the `dir`
|
|
16
|
+
attribute, so an inherited direction works. The stylesheets were already
|
|
17
|
+
written in logical properties; what changed is the code that reasoned in
|
|
18
|
+
physical pixels or physical key names: ArrowLeft / ArrowRight map onto
|
|
19
|
+
previous / next column by inline order, column resize takes width off the
|
|
20
|
+
inline-start edge, and column reorder flips its midpoint comparison. (The
|
|
21
|
+
enterprise range and chart-range handles had a matching fix; see that
|
|
22
|
+
package's 0.7.0 entry.)
|
|
23
|
+
- **`grid.applyEdits(edits)`**, a programmatic batch write. Previously the only
|
|
24
|
+
write path was `editCell` + `commitEdit`, which drives the editor, so a bulk
|
|
25
|
+
write meant a thousand undo entries and a thousand re-renders. Each write still
|
|
26
|
+
emits cancellable `cellValueChanging` then `cellValueChanged` and still runs
|
|
27
|
+
the column's validators, while the batch lands as one undo step and one
|
|
28
|
+
pipeline run. It returns a tally rather than a count, splitting `applied` from
|
|
29
|
+
`unchanged`, `invalid`, `cancelled` and `skipped`, since "nothing changed" and
|
|
30
|
+
"everything was rejected" are different answers. Out-of-range rows and
|
|
31
|
+
non-editable columns are skipped rather than thrown on, so a partially stale
|
|
32
|
+
batch still applies what it can.
|
|
33
|
+
- **Reduced-motion support.** Every transition now routes through one of the
|
|
34
|
+
`--ag-dur-*` tokens, and those zero under `prefers-reduced-motion: reduce`:
|
|
35
|
+
24 transitions across 9 stylesheets go instant with their end states
|
|
36
|
+
unchanged. The JS-driven row reorder and expansion animations already bailed
|
|
37
|
+
out.
|
|
38
|
+
- **Forced-colors support.** Forced colors paints no `box-shadow`, and the grid
|
|
39
|
+
leaned on inset shadows for exactly the indicators that matter most, so in
|
|
40
|
+
Windows High Contrast a keyboard user had no visible cursor and no visible
|
|
41
|
+
selection. The active-cell ring, invalid-cell ring, selected-row bar and every
|
|
42
|
+
toolbar and filter focus ring are restated as outlines, which forced colors
|
|
43
|
+
recolours rather than drops and which sit outside layout, so nothing shifts.
|
|
44
|
+
- **The Custom Elements Manifest is now authoritative for `<apex-grid>`.** The
|
|
45
|
+
element was missing from `custom-elements.json` entirely: no `tagName`, not
|
|
46
|
+
flagged `customElement`, and zero named events. It now resolves
|
|
47
|
+
`customElement`, `tagName`, all 29 `ApexGridEventMap` events, the `theme`
|
|
48
|
+
attribute and the public `@property` fields, and a build-time drift check
|
|
49
|
+
fails the build when any of them diverge. This is what the new
|
|
50
|
+
`react-apex-grid` wrapper package generates from, and what editor tooling
|
|
51
|
+
reads for completions.
|
|
52
|
+
|
|
53
|
+
### Changed
|
|
54
|
+
- **Target sizes meet WCAG 2.2 AA 2.5.8 (24x24).** The selection cell and the
|
|
55
|
+
select-all header cell forward clicks to their checkbox rather than growing a
|
|
56
|
+
deliberately small 14x14 mark. The header sort / filter / menu buttons reach
|
|
57
|
+
24x24 through the invisible chip that already expanded them, so the visible
|
|
58
|
+
16px box and the packed header layout are unchanged and nothing paints at
|
|
59
|
+
rest. **Paginator buttons grow from 22 to 24, which makes the paginator bar
|
|
60
|
+
2px taller.** The range fill handle stays a 10px grab band, now documented as
|
|
61
|
+
a criterion-permitted exception rather than a gap: it is reachable through
|
|
62
|
+
controls that do meet 24x24, and its position at the range corner is
|
|
63
|
+
essential to what it means.
|
|
64
|
+
- **`setup({ theme })` is inert and warns once.** It only ever forwarded to
|
|
65
|
+
Ignite UI's `configureTheme()`, which was already documented as not affecting
|
|
66
|
+
the grid's appearance. It still compiles, so no consumer code breaks; the
|
|
67
|
+
warning is there because silently dropping the forwarding would leave an
|
|
68
|
+
Ignite UI host app unthemed with no clue why.
|
|
69
|
+
|
|
70
|
+
### Removed
|
|
71
|
+
- **The `igniteui-webcomponents` and `igniteui-theming` dependencies.** Core
|
|
72
|
+
carried the first as a runtime dependency and enterprise as a peer, so every
|
|
73
|
+
consumer installed a whole component library (plus `@floating-ui`) for one
|
|
74
|
+
inert pass-through. The grid registers no Ignite UI element.
|
|
75
|
+
`igniteui-theming` was a Sass dependency for exactly one function, `rem()`,
|
|
76
|
+
now reimplemented locally with the same conversion, and it emitted 55 Sass
|
|
77
|
+
deprecation warnings per build. Five packages leave the lockfile, and the
|
|
78
|
+
compiled CSS is 3,718 bytes smaller with every `rem()` output byte-identical.
|
|
79
|
+
- **The `--igx-*` custom-property level.** Every colour rule resolved through
|
|
80
|
+
three levels and the first never fired: `--igx-*` is the igniteui-angular
|
|
81
|
+
naming convention, not the web-components one, so it was dead indirection in
|
|
82
|
+
front of the two levels that work. `--ag-*` overrides and the unprefixed
|
|
83
|
+
semantic variables behave exactly as before. The `--ig-primary-*` and
|
|
84
|
+
`--ig-font-family` hooks stay, since those are what an Ignite UI theme
|
|
85
|
+
actually sets and reading a variable with a default costs nothing when absent.
|
|
86
|
+
|
|
87
|
+
### Fixed
|
|
88
|
+
- **A grid could settle with zero rendered rows at first paint**, silently,
|
|
89
|
+
while reporting a correct `ariaRowCount` and a correctly sized scroll region
|
|
90
|
+
([#31](https://github.com/apexcharts/apex-grid/issues/31)). The virtualizer
|
|
91
|
+
derives its viewport from the intersection of the body, its clipping ancestors
|
|
92
|
+
and the window, and clears the rendered range when that intersection is
|
|
93
|
+
zero-height while still sizing the scroll extent from the full item count. It
|
|
94
|
+
could not recover, because the only invalidation signals it listens for are
|
|
95
|
+
size changes and scroll events: a body that moves into view, or a window that
|
|
96
|
+
resizes around a fixed-size host, fires neither. An iframe sized by its host
|
|
97
|
+
page after load hits this, as does content above the grid that is still
|
|
98
|
+
settling. The body now watches its own intersection with the window and
|
|
99
|
+
re-measures when it gains a visible slice with nothing rendered, bounded to
|
|
100
|
+
three attempts per geometry change and skipped entirely when there is no
|
|
101
|
+
visible slice.
|
|
102
|
+
- **A grid moved to another parent left its body permanently stale**, still
|
|
103
|
+
rendering the old rows after `data` was reassigned. The body awaited
|
|
104
|
+
virtualizer state before calling `super.connectedCallback()`, which deadlocks
|
|
105
|
+
on a reconnect: the promise waits on a layout that only runs once the update
|
|
106
|
+
cycle that call starts.
|
|
107
|
+
|
|
7
108
|
## [3.4.0] - 2026-07-17
|
|
8
109
|
|
|
9
110
|
An accessibility-focused release. The public module API is unchanged (no
|
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ A Lit-based, framework-agnostic web component data grid. Ships as a single custo
|
|
|
29
29
|
- **CSV export**: programmatic method plus an optional toolbar dropdown. (Excel/XLSX export is in `apex-grid-enterprise`.)
|
|
30
30
|
- **Toolbar**: opt-in `<apex-grid-toolbar>` with debounced quick filter and export menu.
|
|
31
31
|
- **Templating**: slot-based templates for cells, headers, editors, and detail panels.
|
|
32
|
-
- **Theming**: styled out-of-the-box; fully customizable through `--ag-*` CSS custom properties (no theme import or build step). Auto-
|
|
32
|
+
- **Theming**: styled out-of-the-box; fully customizable through `--ag-*` CSS custom properties (no theme import or build step). Auto-tints to an Ignite UI host app's palette when one is present, with no dependency on it.
|
|
33
33
|
- **Accessibility**: WCAG 2.2 AA semantics (`role="grid"` / `role="treegrid"`, `aria-rowcount`, `aria-colcount`, focus + keyboard navigation).
|
|
34
34
|
- **Provenance-signed npm releases** with OIDC trusted publishing.
|
|
35
35
|
|
|
@@ -94,8 +94,6 @@ If you'd rather not use `setup()`, this is what it does under the hood. Skipping
|
|
|
94
94
|
npm install apex-grid lit
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
`igniteui-webcomponents` ships as a transitive dependency; no separate install.
|
|
98
|
-
|
|
99
97
|
### 2. Register the custom element
|
|
100
98
|
|
|
101
99
|
```ts
|
|
@@ -133,7 +131,7 @@ apex-grid { --ag-grid-shadow: var(--ag-shadow-card); } /* elevated floating-card
|
|
|
133
131
|
apex-grid { --ag-grid-shadow: none; } /* remove the edge entirely */
|
|
134
132
|
```
|
|
135
133
|
|
|
136
|
-
If you embed the grid
|
|
134
|
+
If you embed the grid in an Ignite UI app, the brand tokens automatically re-tint from its palette: they read `--ig-primary-500` with the grid's own default as the fallback. That is a plain CSS variable lookup, so the grid neither depends on nor bundles Ignite UI.
|
|
137
135
|
|
|
138
136
|
### 4. Size the host
|
|
139
137
|
|
|
@@ -281,7 +279,7 @@ A persistent vertical divider on each column header's trailing edge, on by defau
|
|
|
281
279
|
grid.columnSeparator = false; // hide the dividers
|
|
282
280
|
```
|
|
283
281
|
|
|
284
|
-
Theme the line with `--ag-header-separator` (or the `--header-separator-color`
|
|
282
|
+
Theme the line with `--ag-header-separator` (or the `--header-separator-color` override hook) and set its vertical inset with `--apex-header-separator-inset`. Because the default is `true`, disable it through the property rather than markup (a default-on boolean attribute cannot be turned off by attribute alone). Attribute: `column-separator`.
|
|
285
283
|
|
|
286
284
|
### Column groups (spanning headers)
|
|
287
285
|
|
|
@@ -317,6 +315,25 @@ grid.cancelEdit();
|
|
|
317
315
|
|
|
318
316
|
`mode: 'row'` puts all editable cells in the row into edit together. Properties: `editingCell`, `editingRow`. Events: `cellValueChanging` (cancellable), `cellValueChanged`, plus `rowEditStarted` / `rowEditEnded` in row mode.
|
|
319
317
|
|
|
318
|
+
For programmatic writes, `applyEdits()` takes many cells at once:
|
|
319
|
+
|
|
320
|
+
```ts
|
|
321
|
+
const { applied, invalid, skipped } = grid.applyEdits([
|
|
322
|
+
{ rowIndex: 0, column: 'name', value: 'Ada' },
|
|
323
|
+
{ rowIndex: 1, column: 'age', value: 36 },
|
|
324
|
+
]);
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
Each write goes through the same choke point interactive editing uses, so it
|
|
328
|
+
emits `cellValueChanging` / `cellValueChanged` and runs the column's validators.
|
|
329
|
+
What differs from looping over `editCell` + `commitEdit` is that the whole batch
|
|
330
|
+
lands as **one** undo step and triggers **one** pipeline run — a thousand
|
|
331
|
+
round-trips would otherwise mean a thousand undo entries and a thousand
|
|
332
|
+
re-renders. The returned tally splits `applied` from `unchanged`, `invalid`,
|
|
333
|
+
`cancelled`, and `skipped`, so a rejected batch is distinguishable from a no-op
|
|
334
|
+
one. Edits naming a row out of range or a column the user could not edit either
|
|
335
|
+
are skipped rather than throwing.
|
|
336
|
+
|
|
320
337
|
### Keyboard navigation and accessibility
|
|
321
338
|
|
|
322
339
|
The grid body is a single tab stop: Tab enters the grid, and the active cell
|
|
@@ -497,7 +514,7 @@ Search input has a `debounce` attribute (default `200`ms).
|
|
|
497
514
|
|
|
498
515
|
### Theming
|
|
499
516
|
|
|
500
|
-
The grid styles itself through `--ag-*` CSS custom properties; override them on `apex-grid` (or any ancestor) to rebrand; see [`src/styles/_tokens.scss`](src/styles/_tokens.scss) for the full list.
|
|
517
|
+
The grid styles itself through `--ag-*` CSS custom properties; override them on `apex-grid` (or any ancestor) to rebrand; see [`src/styles/_tokens.scss`](src/styles/_tokens.scss) for the full list. Where an Ignite UI palette is present, the brand tokens auto-tint from `--ig-primary-500`.
|
|
501
518
|
|
|
502
519
|
Style with CSS parts on the grid, paginator, and toolbar:
|
|
503
520
|
|
|
@@ -506,6 +523,28 @@ apex-grid::part(paginator) { background: var(--surface-2); }
|
|
|
506
523
|
apex-grid-toolbar::part(search-input) { font-family: var(--font-mono); }
|
|
507
524
|
```
|
|
508
525
|
|
|
526
|
+
### Right-to-left
|
|
527
|
+
|
|
528
|
+
Set `dir="rtl"` on the grid or any ancestor and the whole grid mirrors — no
|
|
529
|
+
separate stylesheet, build flag, or option:
|
|
530
|
+
|
|
531
|
+
```html
|
|
532
|
+
<html dir="rtl">
|
|
533
|
+
<apex-grid id="grid"></apex-grid>
|
|
534
|
+
</html>
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
The stylesheets are written entirely in logical properties (`inline-size`,
|
|
538
|
+
`inset-inline-start`, `border-inline-end`, …), so layout, pinning, and the fill
|
|
539
|
+
handle follow the text direction on their own. The direction is read from the
|
|
540
|
+
*computed* style, so inheriting it from `<html>` or a wrapper works as well as
|
|
541
|
+
setting it on the grid.
|
|
542
|
+
|
|
543
|
+
Behaviour that reasons in physical directions mirrors too: ArrowLeft moves to the
|
|
544
|
+
next column rather than the previous one, column resize grows the column as the
|
|
545
|
+
pointer moves toward the (now left-hand) inline-end edge, and a column drag drops
|
|
546
|
+
on the side the cursor actually crossed.
|
|
547
|
+
|
|
509
548
|
### Spreadsheet coordinates
|
|
510
549
|
|
|
511
550
|
```ts
|
package/components/grid.d.ts
CHANGED
|
@@ -649,6 +649,88 @@ export interface ApexGridEventMap<T extends object> {
|
|
|
649
649
|
*/
|
|
650
650
|
rowSelected: CustomEvent<ApexRowSelectedEvent<T>>;
|
|
651
651
|
}
|
|
652
|
+
/**
|
|
653
|
+
* Apex grid is a web component for displaying data in a tabular format quick and easy.
|
|
654
|
+
*
|
|
655
|
+
* Out of the box it provides row virtualization, sort and filter operations (client and server side),
|
|
656
|
+
* the ability to template cells and headers and column hiding.
|
|
657
|
+
*
|
|
658
|
+
* @remarks
|
|
659
|
+
* A working, styled grid requires three things:
|
|
660
|
+
* 1. Register the element: `import 'apex-grid/define'` (or `ApexGrid.register()`).
|
|
661
|
+
* 2. Give the host element a bounded height, e.g. `apex-grid { height: 480px }` —
|
|
662
|
+
* the virtualizer collapses without one.
|
|
663
|
+
* 3. Do NOT set `display` on the host — the component declares `:host { display: grid }`
|
|
664
|
+
* internally and any override breaks the track layout.
|
|
665
|
+
*
|
|
666
|
+
* The grid is styled out of the box through `--ag-*` CSS custom properties —
|
|
667
|
+
* there is no theme to import and no `configureTheme()` call. Override `--ag-*`
|
|
668
|
+
* tokens on the host (or any ancestor) to rebrand; where an Ignite UI palette is
|
|
669
|
+
* present, the brand tokens auto-tint from it. For dark mode, set
|
|
670
|
+
* the `theme="dark"` attribute on the host for the built-in slate dark palette
|
|
671
|
+
* (further `--ag-*` overrides still compose on top). Add `tinted` (e.g.
|
|
672
|
+
* `theme="tinted"` or `theme="dark tinted"`) to mix the brand into the chrome
|
|
673
|
+
* so the grid wears its brand even at rest. See the README "Getting Started"
|
|
674
|
+
* and "Theming" sections for the full example and token list.
|
|
675
|
+
*
|
|
676
|
+
* @element apex-grid
|
|
677
|
+
*
|
|
678
|
+
* @attr {string} theme - Space-separated theme flags. `dark` opts into the built-in dark palette; `tinted` mixes `--ag-brand` into the chrome surfaces. Combine as `theme="dark tinted"`.
|
|
679
|
+
*
|
|
680
|
+
* @fires sorting - Emitted when sorting is initiated through the UI.
|
|
681
|
+
* @fires sorted - Emitted when a sort operation initiated through the UI has completed.
|
|
682
|
+
* @fires filtering - Emitted when filtering is initiated through the UI.
|
|
683
|
+
* @fires filtered - Emitted when a filter operation initiated through the UI has completed.
|
|
684
|
+
* @fires pageChanging - Cancellable. Emitted before page/page-size changes are applied.
|
|
685
|
+
* @fires pageChanged - Emitted after a page/page-size change has been applied.
|
|
686
|
+
* @fires quickFilterChanging - Cancellable. Emitted before a quick-filter value is applied.
|
|
687
|
+
* @fires quickFilterChanged - Emitted after a quick-filter change has been applied.
|
|
688
|
+
* @fires columnPinning - Cancellable. Emitted before a column's pin position changes.
|
|
689
|
+
* @fires columnPinned - Emitted after a column's pin position has changed.
|
|
690
|
+
* @fires columnMoving - Cancellable. Emitted before a column is moved.
|
|
691
|
+
* @fires columnMoved - Emitted after a column has been moved.
|
|
692
|
+
* @fires cellValueChanging - Cancellable. Emitted before a cell value is committed.
|
|
693
|
+
* @fires cellValueChanged - Emitted after a cell value has been committed.
|
|
694
|
+
* @fires rowEditStarted - Emitted when a row enters edit mode (row mode only).
|
|
695
|
+
* @fires rowEditEnded - Emitted when a row leaves edit mode (row mode only).
|
|
696
|
+
* @fires rowSelecting - Cancellable. Emitted before a selection-set change is applied.
|
|
697
|
+
* @fires rowSelected - Emitted after a selection-set change has been applied.
|
|
698
|
+
* @fires rowExpanding - Cancellable. Emitted before the row-expansion set changes (master-detail).
|
|
699
|
+
* @fires rowExpanded - Emitted after a row-expansion change has been applied.
|
|
700
|
+
* @fires treeRowExpanding - Cancellable. Emitted before a tree-row expansion change (tree mode).
|
|
701
|
+
* @fires treeRowExpanded - Emitted after a tree-row expansion change has been applied.
|
|
702
|
+
*
|
|
703
|
+
* @csspart live-region - Visually-hidden ARIA live region used for screen-reader announcements.
|
|
704
|
+
*
|
|
705
|
+
* @cssprop [--ag-brand] - Brand color for selection, focus rings, and accents. Auto-tints from `--ig-primary-500` where an Ignite UI palette is present.
|
|
706
|
+
* @cssprop [--ag-brand-strong] - Brand color for hover / pressed states.
|
|
707
|
+
* @cssprop [--ag-grid-shadow] - Grid edge/shadow override. Default is a flat 1px hairline edge; set to `var(--ag-shadow-card)` for the elevated card look, or `none` to remove it.
|
|
708
|
+
* @cssprop [--ag-grid-bg] - Host card background. Defaults to a subtle light gradient; override with a flat color (or use `theme="dark"`) for dark themes.
|
|
709
|
+
* @cssprop [--ag-surface] - Grid card background (must be opaque).
|
|
710
|
+
* @cssprop [--ag-surface-alt] - Alternating row tint.
|
|
711
|
+
* @cssprop [--ag-surface-elevated] - Header background.
|
|
712
|
+
* @cssprop [--ag-hairline] - Header / structural gridline color.
|
|
713
|
+
* @cssprop [--ag-border] - Row separator color.
|
|
714
|
+
* @cssprop [--ag-text] - Primary text color.
|
|
715
|
+
* @cssprop [--ag-text-body] - Row text color.
|
|
716
|
+
* @cssprop [--ag-text-muted] - Muted text (roles, labels).
|
|
717
|
+
* @cssprop [--ag-row-hover] - Row hover wash.
|
|
718
|
+
* @cssprop [--ag-row-h] - Row height.
|
|
719
|
+
* @cssprop [--ag-header-h] - Header height.
|
|
720
|
+
* @cssprop [--ag-radius] - Outer card corner radius.
|
|
721
|
+
* @cssprop [--ag-font] - Grid font family.
|
|
722
|
+
* @cssprop [--ag-fs-cell] - Cell font size.
|
|
723
|
+
*
|
|
724
|
+
* @see {@link https://github.com/apexcharts/apex-grid/blob/main/packages/core/src/styles/_tokens.scss | _tokens.scss} for the complete `--ag-*` token list.
|
|
725
|
+
*
|
|
726
|
+
* @fires cellValidationFailed - Emitted when a candidate cell value is rejected by a column validator; the value is not written.
|
|
727
|
+
* @fires historyChanged - Emitted after the undo / redo stacks change; carries the current `canUndo` / `canRedo`.
|
|
728
|
+
* @fires stateChanged - Emitted (debounced) whenever the grid's restorable state changes; carries the new `getState` snapshot.
|
|
729
|
+
* @fires rowPinning - Cancellable. Emitted before a row is pinned, moved between bands, or unpinned.
|
|
730
|
+
* @fires rowPinned - Emitted after a row's pin state has changed.
|
|
731
|
+
* @fires rowMoving - Cancellable. Emitted before a row is moved via drag, keyboard, or `moveRow`.
|
|
732
|
+
* @fires rowMoved - Emitted after a row has been moved.
|
|
733
|
+
*/
|
|
652
734
|
export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGridEventMap<T>> {
|
|
653
735
|
#private;
|
|
654
736
|
static get tagName(): string;
|
|
@@ -1365,6 +1447,51 @@ export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGri
|
|
|
1365
1447
|
* `rowEditEnded` in row mode.
|
|
1366
1448
|
*/
|
|
1367
1449
|
commitEdit(): Promise<boolean>;
|
|
1450
|
+
/**
|
|
1451
|
+
* Applies many cell edits as a **single** operation.
|
|
1452
|
+
*
|
|
1453
|
+
* Every write goes through the same choke point interactive editing uses, so
|
|
1454
|
+
* each one emits the cancellable `cellValueChanging` and then
|
|
1455
|
+
* `cellValueChanged`, and runs the column's validators. What differs from
|
|
1456
|
+
* calling {@link editCell} + {@link commitEdit} in a loop is that the whole
|
|
1457
|
+
* set lands as one undo step and triggers one pipeline run, which is the
|
|
1458
|
+
* point: a thousand `editCell` round-trips would be a thousand entries in the
|
|
1459
|
+
* undo stack and a thousand re-renders.
|
|
1460
|
+
*
|
|
1461
|
+
* `rowIndex` is view-relative and matches {@link ApexGrid.pageItems}, the same
|
|
1462
|
+
* as {@link editCell}. Edits naming an unknown column, a row index out of
|
|
1463
|
+
* range, or a column the user could not edit either (editing off, not
|
|
1464
|
+
* `editable`, or hidden — the same gate interactive editing uses) are skipped
|
|
1465
|
+
* rather than throwing, so a partially-stale batch still applies what it can.
|
|
1466
|
+
*
|
|
1467
|
+
* @param edits Cells to write. Order is preserved, so later edits to the same
|
|
1468
|
+
* cell win.
|
|
1469
|
+
* @returns A per-outcome tally. `applied` counts cells whose value actually
|
|
1470
|
+
* changed; `unchanged`, `invalid` and `cancelled` explain the rest, so a caller
|
|
1471
|
+
* can tell a rejected batch from a no-op one.
|
|
1472
|
+
*
|
|
1473
|
+
* @example Bulk-clear a column for the rows the user selected
|
|
1474
|
+
* ```ts
|
|
1475
|
+
* grid.applyEdits(
|
|
1476
|
+
* grid.selectedRows.map((row) => ({
|
|
1477
|
+
* rowIndex: grid.pageItems.indexOf(row),
|
|
1478
|
+
* column: 'discount',
|
|
1479
|
+
* value: 0,
|
|
1480
|
+
* }))
|
|
1481
|
+
* );
|
|
1482
|
+
* ```
|
|
1483
|
+
*/
|
|
1484
|
+
applyEdits(edits: ReadonlyArray<{
|
|
1485
|
+
rowIndex: number;
|
|
1486
|
+
column: Keys<T>;
|
|
1487
|
+
value: unknown;
|
|
1488
|
+
}>): {
|
|
1489
|
+
applied: number;
|
|
1490
|
+
unchanged: number;
|
|
1491
|
+
invalid: number;
|
|
1492
|
+
cancelled: number;
|
|
1493
|
+
skipped: number;
|
|
1494
|
+
};
|
|
1368
1495
|
/**
|
|
1369
1496
|
* Discards the current edit without writing back to {@link ApexGrid.data}.
|
|
1370
1497
|
*/
|
package/components/grid.js
CHANGED
|
@@ -637,6 +637,31 @@ export class ApexGrid extends EventEmitterBase {
|
|
|
637
637
|
const editing = this.stateController.editing;
|
|
638
638
|
return editing.mode === 'row' ? editing.commitRow() : editing.commitCell();
|
|
639
639
|
}
|
|
640
|
+
applyEdits(edits) {
|
|
641
|
+
const tally = { applied: 0, unchanged: 0, invalid: 0, cancelled: 0, skipped: 0 };
|
|
642
|
+
if (!edits.length)
|
|
643
|
+
return tally;
|
|
644
|
+
const editing = this.stateController.editing;
|
|
645
|
+
const items = this.pageItems;
|
|
646
|
+
this.stateController.history.beginBatch();
|
|
647
|
+
try {
|
|
648
|
+
for (const { rowIndex, column, value } of edits) {
|
|
649
|
+
const record = items.at(rowIndex);
|
|
650
|
+
const config = this.getColumn(column);
|
|
651
|
+
if (!record || rowIndex < 0 || !config || !editing.isEditable(config)) {
|
|
652
|
+
tally.skipped += 1;
|
|
653
|
+
continue;
|
|
654
|
+
}
|
|
655
|
+
tally[editing.applyCellEdit(rowIndex, column, record, value)] += 1;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
finally {
|
|
659
|
+
this.stateController.history.endBatch();
|
|
660
|
+
}
|
|
661
|
+
if (tally.applied > 0)
|
|
662
|
+
this.requestUpdate(PIPELINE);
|
|
663
|
+
return tally;
|
|
664
|
+
}
|
|
640
665
|
cancelEdit() {
|
|
641
666
|
const editing = this.stateController.editing;
|
|
642
667
|
if (editing.mode === 'row') {
|