apex-grid 3.0.0 → 3.1.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 +90 -0
- package/README.md +7 -0
- package/components/cell.d.ts +7 -0
- package/components/cell.js +33 -0
- package/components/cell.js.map +1 -1
- package/components/filter-row.d.ts +1 -1
- package/components/grid.d.ts +54 -21
- package/components/grid.js +22 -1
- package/components/grid.js.map +1 -1
- package/components/header-row.d.ts +3 -3
- package/components/header.d.ts +2 -2
- package/components/paginator.d.ts +1 -1
- package/components/row.d.ts +11 -4
- package/components/row.js +35 -1
- package/components/row.js.map +1 -1
- package/components/toolbar.d.ts +2 -2
- package/controllers/data-operation.js +1 -0
- package/controllers/data-operation.js.map +1 -1
- package/controllers/dom.js +1 -0
- package/controllers/dom.js.map +1 -1
- package/controllers/resize.d.ts +1 -1
- package/controllers/state.d.ts +34 -1
- package/controllers/state.js +50 -1
- package/controllers/state.js.map +1 -1
- package/custom-elements.json +513 -2
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/ApexGrid.html +29 -6
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +4 -0
- package/docs/interfaces/ApexGridEventMap.html +10 -5
- package/docs/interfaces/BaseApexCellContext.html +1 -1
- package/docs/interfaces/BaseApexEditorContext.html +1 -1
- package/docs/interfaces/CSVExportOptions.html +1 -1
- package/docs/interfaces/ExportFormat.html +1 -1
- package/docs/interfaces/ExportOptions.html +1 -1
- package/docs/interfaces/PaginationState.html +1 -1
- package/docs/media/package.json +1 -1
- package/internal/export.d.ts +1 -1
- package/internal/export.js.map +1 -1
- package/internal/feature-module.d.ts +135 -3
- package/internal/feature-module.js +20 -1
- package/internal/feature-module.js.map +1 -1
- package/internal/index.d.ts +4 -2
- package/internal/index.js +2 -0
- package/internal/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/body-cell/body-cell.css.js +1 -1
- package/styles/body-cell/body-cell.css.js.map +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Changelog — apex-grid
|
|
2
|
+
|
|
3
|
+
All notable changes to the `apex-grid` (community) package are documented here.
|
|
4
|
+
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
|
|
5
|
+
and the format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
6
|
+
|
|
7
|
+
## [3.1.0] — 2026-06-19
|
|
8
|
+
|
|
9
|
+
Additive, backward-compatible release. The public `apex-grid` `.` / `./define`
|
|
10
|
+
API and the runtime behavior of `<apex-grid>` are unchanged; everything added
|
|
11
|
+
here is **inert for the community grid** and surfaced only on the unstable
|
|
12
|
+
`apex-grid/internal` subpath for the first-party `apex-grid-enterprise` package.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- **Feature-module seam.** `GridFeatureModule` contract plus a `StateController`
|
|
16
|
+
module registry (`modules`, `module<C>(id)`) and a `createStateController()`
|
|
17
|
+
factory override point, so a subclass can layer in extra features without
|
|
18
|
+
forking core. The built-in controller set and `new StateController(host)`
|
|
19
|
+
remain behavior-identical (an empty module set is a no-op).
|
|
20
|
+
- **Row seams** (`apex-grid/internal`): `RowTransformer.processRows()` (inject /
|
|
21
|
+
reorder rows after filter → sort → tree, before pagination) and
|
|
22
|
+
`RowPresenter.presentRow()` (render a row full-width, like the detail panel,
|
|
23
|
+
with aria-level / expanded).
|
|
24
|
+
- **Cell seams** (`apex-grid/internal`): `CellDecorator.decorateCell()` (a module
|
|
25
|
+
reflects `data-*` attributes onto individual cells; cells re-evaluate on a
|
|
26
|
+
`decorationVersion` token bumped via `bumpDecoration()`) and
|
|
27
|
+
`CellInteractionHandler.handleCellInteraction()` (the grid body forwards
|
|
28
|
+
pointer down/over/up on cells to modules, gated on `modules.size` so the
|
|
29
|
+
community grid pays nothing).
|
|
30
|
+
- Inert, variable-driven cell range / fill-handle styling in `body-cell.scss`,
|
|
31
|
+
keyed off `data-range*` attributes and fully transparent until a theme sets
|
|
32
|
+
the `--apex-range-*` custom properties.
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
- Row render no longer dereferences `undefined` when a row index transiently
|
|
36
|
+
falls beyond the current `data` (e.g. while a server-side / infinite row model
|
|
37
|
+
resizes the array on a filter or sort change); the row renders nothing for
|
|
38
|
+
that frame and re-renders with the real item.
|
|
39
|
+
|
|
40
|
+
### Notes
|
|
41
|
+
- `apex-grid/internal` is an **unstable, first-party-only** support surface; its
|
|
42
|
+
shape may change in any release. The community `.` and `./define` exports stay
|
|
43
|
+
frozen.
|
|
44
|
+
|
|
45
|
+
## [3.0.1] — 2026-06-10
|
|
46
|
+
|
|
47
|
+
Documentation-only patch (no runtime or API changes).
|
|
48
|
+
|
|
49
|
+
### Documentation
|
|
50
|
+
- Documented the `--ag-grid-shadow` theming hook and the flat-by-default grid
|
|
51
|
+
edge (1px hairline ring; opt back into the elevated card with
|
|
52
|
+
`--ag-grid-shadow: var(--ag-shadow-card)`, or remove it with `none`).
|
|
53
|
+
- Added `@cssprop` JSDoc for the public `--ag-*` design tokens (incl.
|
|
54
|
+
`--ag-grid-shadow`) and a `@csspart` entry on the grid root, so the generated
|
|
55
|
+
Custom Elements Manifest / API reference list the theming surface.
|
|
56
|
+
- Completed the class `@fires` list — added the row- and tree-expansion events
|
|
57
|
+
(`rowExpanding`, `rowExpanded`, `treeRowExpanding`, `treeRowExpanded`) and
|
|
58
|
+
attached the missing `rowSelecting` event description.
|
|
59
|
+
- Corrected the stale "getting started" block in the `ApexGrid` JSDoc: theming
|
|
60
|
+
is via `--ag-*` CSS custom properties (no `configureTheme()` / theme-CSS
|
|
61
|
+
import required).
|
|
62
|
+
- Fixed an incorrect package name (`@apexcharts/grid-enterprise` →
|
|
63
|
+
`apex-grid-enterprise`) in export JSDoc.
|
|
64
|
+
|
|
65
|
+
## [3.0.0] — 2026-06-09
|
|
66
|
+
|
|
67
|
+
### Changed
|
|
68
|
+
- **BREAKING: Excel (XLSX) export removed from core.** It now lives in
|
|
69
|
+
[`apex-grid-enterprise`](https://www.npmjs.com/package/apex-grid-enterprise).
|
|
70
|
+
Core keeps **CSV export** (`exportToCSV`). The toolbar export menu is now
|
|
71
|
+
driven by a generic seam — `exportFormats` getter + `exportAs(formatId, opts)`
|
|
72
|
+
— so derived grids can add formats. Migrate `grid.exportToXLSX(...)` calls by
|
|
73
|
+
switching to `<apex-grid-enterprise>` (see its README).
|
|
74
|
+
- **Theming is now CSS-variable based.** The grid styles itself out of the box
|
|
75
|
+
through `--ag-*` custom properties — no theme import or `configureTheme()`
|
|
76
|
+
call is required. When `igniteui-webcomponents` is present, brand tokens
|
|
77
|
+
auto-tint from its palette.
|
|
78
|
+
- **Neutral restyle**: grayscale chrome with brand color reserved for state and
|
|
79
|
+
accents.
|
|
80
|
+
- **Flat grid edge by default.** The host no longer paints a heavy floating-card
|
|
81
|
+
shadow; it shows a flat 1px hairline edge. Restore the prior look with
|
|
82
|
+
`--ag-grid-shadow: var(--ag-shadow-card)`.
|
|
83
|
+
|
|
84
|
+
### Project
|
|
85
|
+
- Repository converted to an npm-workspaces monorepo; this package publishes
|
|
86
|
+
from `packages/core`.
|
|
87
|
+
|
|
88
|
+
[3.1.0]: https://github.com/apexcharts/apex-grid/releases
|
|
89
|
+
[3.0.1]: https://github.com/apexcharts/apex-grid/releases
|
|
90
|
+
[3.0.0]: https://github.com/apexcharts/apex-grid/releases
|
package/README.md
CHANGED
|
@@ -119,6 +119,13 @@ apex-grid {
|
|
|
119
119
|
|
|
120
120
|
See [`src/styles/_tokens.scss`](src/styles/_tokens.scss) for the full token list (brand, surfaces, text, semantic state colors, typography, spacing, motion).
|
|
121
121
|
|
|
122
|
+
**Grid edge / shadow.** By default the grid shows a flat 1px hairline edge (no drop shadow). Control it with the `--ag-grid-shadow` hook — this is an opt-in override, not one of the `_tokens.scss` defaults:
|
|
123
|
+
|
|
124
|
+
```css
|
|
125
|
+
apex-grid { --ag-grid-shadow: var(--ag-shadow-card); } /* elevated floating-card look */
|
|
126
|
+
apex-grid { --ag-grid-shadow: none; } /* remove the edge entirely */
|
|
127
|
+
```
|
|
128
|
+
|
|
122
129
|
If you embed the grid alongside `igniteui-webcomponents`, the brand tokens automatically re-tint from the igniteui palette (`--ig-primary-500`) — no configuration needed.
|
|
123
130
|
|
|
124
131
|
### 4. Size the host
|
package/components/cell.d.ts
CHANGED
|
@@ -46,6 +46,13 @@ export default class ApexGridCell<T extends object> extends LitElement {
|
|
|
46
46
|
* auto-rendered selection + expansion columns ahead of the data columns.
|
|
47
47
|
*/
|
|
48
48
|
colindex: number;
|
|
49
|
+
/**
|
|
50
|
+
* Reactive token forwarded from {@link StateController.decorationVersion}.
|
|
51
|
+
* Changing it re-runs {@link willUpdate} so module-driven cell decoration is
|
|
52
|
+
* re-evaluated when it changes (e.g. while dragging a selection range). Stays
|
|
53
|
+
* `0` for the community grid, so cells are never re-decorated there.
|
|
54
|
+
*/
|
|
55
|
+
decorationVersion: number;
|
|
49
56
|
connectedCallback(): void;
|
|
50
57
|
disconnectedCallback(): void;
|
|
51
58
|
protected willUpdate(): void;
|
package/components/cell.js
CHANGED
|
@@ -18,6 +18,8 @@ export default class ApexGridCell extends LitElement {
|
|
|
18
18
|
this.active = false;
|
|
19
19
|
this.editing = false;
|
|
20
20
|
this.colindex = 0;
|
|
21
|
+
this.decorationVersion = 0;
|
|
22
|
+
this.#decoratedKeys = [];
|
|
21
23
|
this.#handleClick = (event) => {
|
|
22
24
|
if (this.isEditing) {
|
|
23
25
|
event.stopPropagation();
|
|
@@ -145,6 +147,7 @@ export default class ApexGridCell extends LitElement {
|
|
|
145
147
|
return false;
|
|
146
148
|
return this.editingController.isEditable(this.column);
|
|
147
149
|
}
|
|
150
|
+
#decoratedKeys;
|
|
148
151
|
connectedCallback() {
|
|
149
152
|
super.connectedCallback();
|
|
150
153
|
this.setAttribute('role', 'gridcell');
|
|
@@ -181,6 +184,33 @@ export default class ApexGridCell extends LitElement {
|
|
|
181
184
|
else {
|
|
182
185
|
this.removeAttribute('data-tree-expanded');
|
|
183
186
|
}
|
|
187
|
+
this.#applyDecoration();
|
|
188
|
+
}
|
|
189
|
+
#applyDecoration() {
|
|
190
|
+
const decoration = this.state && this.row
|
|
191
|
+
? this.state.decorateCell({
|
|
192
|
+
row: this.row.data,
|
|
193
|
+
rowIndex: this.row.index,
|
|
194
|
+
column: this.column,
|
|
195
|
+
value: this.value,
|
|
196
|
+
})
|
|
197
|
+
: null;
|
|
198
|
+
const next = decoration?.attributes ?? {};
|
|
199
|
+
for (const key of this.#decoratedKeys) {
|
|
200
|
+
if (next[key] == null)
|
|
201
|
+
this.removeAttribute(key);
|
|
202
|
+
}
|
|
203
|
+
const applied = [];
|
|
204
|
+
for (const [key, value] of Object.entries(next)) {
|
|
205
|
+
if (value == null) {
|
|
206
|
+
this.removeAttribute(key);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
this.setAttribute(key, value);
|
|
210
|
+
applied.push(key);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
this.#decoratedKeys = applied;
|
|
184
214
|
}
|
|
185
215
|
updated() {
|
|
186
216
|
if (this.isEditing) {
|
|
@@ -373,4 +403,7 @@ __decorate([
|
|
|
373
403
|
__decorate([
|
|
374
404
|
property({ attribute: false, type: Number })
|
|
375
405
|
], ApexGridCell.prototype, "colindex", void 0);
|
|
406
|
+
__decorate([
|
|
407
|
+
property({ attribute: false, type: Number })
|
|
408
|
+
], ApexGridCell.prototype, "decorationVersion", void 0);
|
|
376
409
|
//# sourceMappingURL=cell.js.map
|
package/components/cell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell.js","sourceRoot":"","sources":["../../src/components/cell.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,E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MAAM,EAAE,CAAC;8CACzB","sourcesContent":["import { consume } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { gridStateContext, type StateController } from '../controllers/state.js';\nimport { getColumnTypeRenderer } from '../internal/column-types.js';\nimport { registerComponent } from '../internal/register.js';\nimport { GRID_CELL_TAG } from '../internal/tags.js';\nimport type {\n ApexCellContext,\n ApexEditorContext,\n ColumnConfiguration,\n PropertyType,\n} from '../internal/types.js';\nimport { styles } from '../styles/body-cell/body-cell.css.js';\nimport type ApexGridRow from './row.js';\n\n/**\n * Component representing a DOM cell of the Apex grid.\n *\n * @csspart cell - The cell host element.\n * @csspart editor - The editor wrapper rendered while the cell is in edit mode.\n */\nexport default class ApexGridCell<T extends object> extends LitElement {\n public static get tagName() {\n return GRID_CELL_TAG;\n }\n\n public static override styles = styles;\n\n public static register(): void {\n registerComponent(ApexGridCell);\n }\n\n /**\n * The value which will be rendered by the component.\n */\n @property({ attribute: false })\n public value!: PropertyType<T>;\n\n /**\n * A reference to the column configuration object.\n */\n @property({ attribute: false })\n public column!: ColumnConfiguration<T>;\n\n /**\n * Indicates whether this is the active cell in the grid.\n *\n */\n @property({ type: Boolean, reflect: true })\n public active = false;\n\n /**\n * Whether the cell is currently in edit mode. Set by the parent row from the\n * editing controller's state so cells re-render on edit state changes.\n */\n @property({ type: Boolean, reflect: true })\n public editing = false;\n\n @consume({ context: gridStateContext, subscribe: true })\n @property({ attribute: false })\n public state!: StateController<T>;\n\n /**\n * The parent row component holding this cell.\n */\n public row!: ApexGridRow<T>;\n\n @query('input, [data-apex-editor]')\n protected editorElement!: HTMLElement | null;\n\n protected get context(): ApexCellContext<T> {\n const ctx = {\n parent: this,\n row: this.row,\n column: this.column,\n value: this.value,\n } as unknown as {\n parent: ApexGridCell<T>;\n row: ApexGridRow<T>;\n column: ColumnConfiguration<T>;\n value: PropertyType<T>;\n commit?: (value: unknown) => Promise<boolean>;\n };\n // Only expose `commit` when the column is editable — non-editable\n // interactive widgets should render as read-only.\n if (this.isEditable) {\n ctx.commit = (next: unknown) =>\n this.editingController.commitImmediate(this.row.index, this.column.key, next);\n }\n return ctx as unknown as ApexCellContext<T>;\n }\n\n protected get editingController() {\n return this.state.editing;\n }\n\n protected get isEditing(): boolean {\n return this.editing;\n }\n\n protected get isEditable(): boolean {\n if (!this.editingController) return false;\n return this.editingController.isEditable(this.column);\n }\n\n /**\n * 1-based column index used to populate `aria-colindex`. Accounts for the\n * auto-rendered selection + expansion columns ahead of the data columns.\n */\n @property({ attribute: false, type: Number })\n public colindex = 0;\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.setAttribute('role', 'gridcell');\n this.addEventListener('click', this.#handleClick);\n this.addEventListener('dblclick', this.#handleDoubleClick);\n this.addEventListener('keydown', this.#handleCellKeydown);\n this.addEventListener('focusout', this.#handleCellFocusOut);\n }\n\n public override disconnectedCallback(): void {\n this.removeEventListener('click', this.#handleClick);\n this.removeEventListener('dblclick', this.#handleDoubleClick);\n this.removeEventListener('keydown', this.#handleCellKeydown);\n this.removeEventListener('focusout', this.#handleCellFocusOut);\n super.disconnectedCallback();\n }\n\n protected override willUpdate() {\n if (this.colindex > 0) {\n this.setAttribute('aria-colindex', String(this.colindex));\n } else {\n this.removeAttribute('aria-colindex');\n }\n if (this.active) {\n this.setAttribute('aria-current', 'true');\n } else {\n this.removeAttribute('aria-current');\n }\n // Reflect tree-expanded state on the group cell so the SCSS chevron\n // rotation triggers from this attribute (cheaper than per-render style\n // mutations and keeps the SVG transform purely declarative).\n const tree = this.state?.tree;\n const isGroup = tree?.enabled && this.row?.data && tree.isGroupColumn(this.column.key);\n if (isGroup && tree.isExpanded(this.row.data)) {\n this.setAttribute('data-tree-expanded', '');\n } else {\n this.removeAttribute('data-tree-expanded');\n }\n }\n\n protected override updated() {\n if (this.isEditing) {\n const editor = this.editorElement;\n editor?.focus();\n if (editor instanceof HTMLInputElement) {\n if (editor.type === 'text' || editor.type === 'number') {\n editor.select();\n }\n }\n }\n }\n\n #handleClick = (event: MouseEvent) => {\n if (this.isEditing) {\n // Don't let clicks inside the editor bubble into navigation / outside-click commits.\n event.stopPropagation();\n return;\n }\n if (!this.isEditable) return;\n // Boolean cells handle interaction in their display widget — clicking the\n // checkbox commits inline via `ctx.commit`. We never enter edit mode for\n // booleans, which avoids the visual reflow between display/editor markup\n // and lets a single click toggle the value.\n if (this.column.type === 'boolean') return;\n if (this.editingController.trigger !== 'click') return;\n this.#startEdit();\n };\n\n #handleDoubleClick = (event: MouseEvent) => {\n if (this.isEditing) {\n event.stopPropagation();\n return;\n }\n if (!this.isEditable) return;\n if (this.column.type === 'boolean') return;\n if (this.editingController.trigger !== 'doubleClick') return;\n this.#startEdit();\n };\n\n #startEdit() {\n if (!this.row) return;\n this.editingController.editCell(this.row.index, this.column.key);\n }\n\n #pendingValue: unknown;\n\n #commitWith = async (value?: unknown): Promise<boolean> => {\n return this.editingController.commitCell(value ?? this.#pendingValue);\n };\n\n #cancel = () => {\n this.editingController.cancelCell();\n };\n\n #handleKeydown = (event: KeyboardEvent) => {\n event.stopPropagation();\n switch (event.key) {\n case 'Enter':\n event.preventDefault();\n this.#commitWith();\n return;\n case 'Escape':\n event.preventDefault();\n this.#cancel();\n return;\n case 'Tab':\n // Commit first; navigation moves to the next/prev cell. Editing of the\n // landed cell stays manual (Enter to re-edit) for predictability.\n event.preventDefault();\n this.#commitWith();\n return;\n default:\n return;\n }\n };\n\n #handleBlur = () => {\n if (!this.isEditing) return;\n if (this.editingController.mode === 'cell') {\n this.#commitWith();\n } else {\n // Row mode — stash the value and exit the cell editor; the row stays open.\n this.editingController.commitCell(this.#pendingValue);\n }\n };\n\n /**\n * Cell-level keydown that catches keys bubbling out of registry-built\n * editors (the default editor stops propagation on its own input).\n *\n * - Escape always cancels the edit.\n * - Tab commits (or closes when there's no draft — `commitCell()` with\n * `undefined` value is treated as \"no change\" by the controller).\n *\n * Per-editor `keydown` handlers that need to consume Enter (e.g. the\n * built-in `<select>` editor) still get the first crack — they call\n * `event.stopPropagation()` and we never see those keys here.\n */\n #handleCellKeydown = (event: KeyboardEvent) => {\n if (!this.isEditing) return;\n if (event.key === 'Escape') {\n event.preventDefault();\n this.#cancel();\n return;\n }\n if (event.key === 'Tab') {\n event.preventDefault();\n this.#commitWith();\n }\n };\n\n /**\n * Cell-level focus-out: commits the active edit when focus truly leaves\n * the cell (clicking another cell, tabbing past the editor, blurring to\n * the document body). The default editor's input also has `@blur` which\n * commits first; by that time `isEditing` is false and this is a no-op.\n *\n * For built-in registry editors `commitCell()` with no explicit value\n * resolves to the current data value — same shape as \"no change\", so\n * losing focus without picking discards the open editor without writing\n * spurious data.\n */\n #handleCellFocusOut = (event: FocusEvent) => {\n if (!this.isEditing) return;\n const next = event.relatedTarget as Node | null;\n if (next && (this.contains(next) || this.shadowRoot?.contains(next))) return;\n if (this.editingController.mode === 'cell') {\n this.#commitWith();\n } else {\n this.editingController.commitCell(this.#pendingValue);\n }\n };\n\n #handleTextInput = (event: Event) => {\n const target = event.target as HTMLInputElement;\n this.#pendingValue = this.column.type === 'number' ? target.valueAsNumber : target.value;\n };\n\n #handleCheckboxChange = (event: Event) => {\n const target = event.target as HTMLInputElement;\n this.#pendingValue = target.checked;\n // Booleans commit immediately — toggling is the whole interaction.\n this.#commitWith(target.checked);\n };\n\n protected renderDefaultEditor() {\n const value = this.value as unknown;\n if (this.column.type === 'boolean') {\n this.#pendingValue = Boolean(value);\n return html`<input\n type=\"checkbox\"\n part=\"editor\"\n data-apex-editor\n ?checked=${Boolean(value)}\n @change=${this.#handleCheckboxChange}\n @keydown=${this.#handleKeydown}\n @blur=${this.#handleBlur}\n />`;\n }\n if (this.column.type === 'number') {\n this.#pendingValue = value;\n return html`<input\n type=\"number\"\n part=\"editor\"\n data-apex-editor\n .value=${value == null ? '' : String(value)}\n @input=${this.#handleTextInput}\n @keydown=${this.#handleKeydown}\n @blur=${this.#handleBlur}\n />`;\n }\n this.#pendingValue = value;\n return html`<input\n type=\"text\"\n part=\"editor\"\n data-apex-editor\n .value=${value == null ? '' : String(value)}\n @input=${this.#handleTextInput}\n @keydown=${this.#handleKeydown}\n @blur=${this.#handleBlur}\n />`;\n }\n\n protected renderEditor() {\n const template = this.column.editorTemplate;\n const ctx = {\n parent: this,\n row: this.row,\n column: this.column,\n value: this.value,\n commit: (next: unknown) => this.editingController.commitCell(next),\n cancel: () => this.editingController.cancelCell(),\n };\n if (template) {\n // For custom editors we don't know the draft shape; reset pending so\n // cell-level commit doesn't write a stale value from a previous edit.\n this.#pendingValue = this.value;\n return template(ctx as unknown as ApexEditorContext<T> as never);\n }\n const typeRenderer = getColumnTypeRenderer<T>(this.column.type);\n if (typeRenderer?.editor) {\n this.#pendingValue = this.value;\n return typeRenderer.editor(ctx as never);\n }\n return this.renderDefaultEditor();\n }\n\n /**\n * Renders the tree affordance — depth-based indent + a chevron toggle (or\n * leaf spacer) — that prefixes the group cell when {@link ApexGrid.tree}\n * is enabled. Returns `nothing` for every other cell.\n */\n protected renderTreeAffordance() {\n const tree = this.state?.tree;\n if (!tree?.enabled) return null;\n if (!this.row?.data) return null;\n if (!tree.isGroupColumn(this.column.key)) return null;\n\n const data = this.row.data;\n const meta = tree.getMeta(data);\n if (!meta) return null;\n\n const indent = meta.depth * tree.childIndent;\n const expanded = tree.isExpanded(data);\n const handleClick = (event: MouseEvent) => {\n event.stopPropagation();\n if (!meta.hasChildren) return;\n void tree.toggleRow(data);\n };\n\n const chevron = meta.hasChildren\n ? html`<button\n type=\"button\"\n part=\"tree-toggle\"\n aria-label=${expanded ? 'Collapse row' : 'Expand row'}\n aria-expanded=${expanded ? 'true' : 'false'}\n @click=${handleClick}\n >\n <svg\n part=\"tree-chevron\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n width=\"14\"\n height=\"14\"\n >\n <path\n d=\"M9 6l6 6-6 6\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>`\n : html`<span part=\"tree-spacer\" aria-hidden=\"true\"></span>`;\n\n return html`<span\n part=\"tree-indent\"\n aria-hidden=\"true\"\n style=${`inline-size: ${indent}px`}\n ></span>${chevron}`;\n }\n\n /**\n * Resolves the value to display for the cell. Synthesized tree parents\n * (those that appear only as a path segment with no backing data) render\n * their last path segment in the group column and nothing elsewhere.\n */\n protected resolveDisplayValue(): unknown {\n const tree = this.state?.tree;\n if (tree?.enabled && this.row?.data && tree.isSynthesized(this.row.data)) {\n return tree.isGroupColumn(this.column.key) ? tree.getLabel(this.row.data) : '';\n }\n return this.value;\n }\n\n protected renderCellBody() {\n if (this.column.cellTemplate) {\n return this.column.cellTemplate(this.context as ApexCellContext<T> as never);\n }\n const typeRenderer = getColumnTypeRenderer<T>(this.column.type);\n if (typeRenderer?.display) {\n // Synthesized parents have no real backing data — route them through\n // a plain text render instead of the typed renderer.\n const tree = this.state?.tree;\n if (tree?.enabled && this.row?.data && tree.isSynthesized(this.row.data)) {\n return html`${this.resolveDisplayValue()}`;\n }\n return typeRenderer.display(this.context as never);\n }\n return html`${this.resolveDisplayValue()}`;\n }\n\n protected override render() {\n if (this.isEditing) {\n return this.renderEditor();\n }\n const affordance = this.renderTreeAffordance();\n if (affordance) {\n return html`${affordance}<span part=\"tree-cell-content\">${this.renderCellBody()}</span>`;\n }\n return this.renderCellBody();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [ApexGridCell.tagName]: ApexGridCell<object>;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cell.js","sourceRoot":"","sources":["../../src/components/cell.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAwB,MAAM,yBAAy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property, query } from 'lit/decorators.js';\nimport { gridStateContext, type StateController } from '../controllers/state.js';\nimport { getColumnTypeRenderer } from '../internal/column-types.js';\nimport { registerComponent } from '../internal/register.js';\nimport { GRID_CELL_TAG } from '../internal/tags.js';\nimport type {\n ApexCellContext,\n ApexEditorContext,\n ColumnConfiguration,\n PropertyType,\n} from '../internal/types.js';\nimport { styles } from '../styles/body-cell/body-cell.css.js';\nimport type ApexGridRow from './row.js';\n\n/**\n * Component representing a DOM cell of the Apex grid.\n *\n * @csspart cell - The cell host element.\n * @csspart editor - The editor wrapper rendered while the cell is in edit mode.\n */\nexport default class ApexGridCell<T extends object> extends LitElement {\n public static get tagName() {\n return GRID_CELL_TAG;\n }\n\n public static override styles = styles;\n\n public static register(): void {\n registerComponent(ApexGridCell);\n }\n\n /**\n * The value which will be rendered by the component.\n */\n @property({ attribute: false })\n public value!: PropertyType<T>;\n\n /**\n * A reference to the column configuration object.\n */\n @property({ attribute: false })\n public column!: ColumnConfiguration<T>;\n\n /**\n * Indicates whether this is the active cell in the grid.\n *\n */\n @property({ type: Boolean, reflect: true })\n public active = false;\n\n /**\n * Whether the cell is currently in edit mode. Set by the parent row from the\n * editing controller's state so cells re-render on edit state changes.\n */\n @property({ type: Boolean, reflect: true })\n public editing = false;\n\n @consume({ context: gridStateContext, subscribe: true })\n @property({ attribute: false })\n public state!: StateController<T>;\n\n /**\n * The parent row component holding this cell.\n */\n public row!: ApexGridRow<T>;\n\n @query('input, [data-apex-editor]')\n protected editorElement!: HTMLElement | null;\n\n protected get context(): ApexCellContext<T> {\n const ctx = {\n parent: this,\n row: this.row,\n column: this.column,\n value: this.value,\n } as unknown as {\n parent: ApexGridCell<T>;\n row: ApexGridRow<T>;\n column: ColumnConfiguration<T>;\n value: PropertyType<T>;\n commit?: (value: unknown) => Promise<boolean>;\n };\n // Only expose `commit` when the column is editable — non-editable\n // interactive widgets should render as read-only.\n if (this.isEditable) {\n ctx.commit = (next: unknown) =>\n this.editingController.commitImmediate(this.row.index, this.column.key, next);\n }\n return ctx as unknown as ApexCellContext<T>;\n }\n\n protected get editingController() {\n return this.state.editing;\n }\n\n protected get isEditing(): boolean {\n return this.editing;\n }\n\n protected get isEditable(): boolean {\n if (!this.editingController) return false;\n return this.editingController.isEditable(this.column);\n }\n\n /**\n * 1-based column index used to populate `aria-colindex`. Accounts for the\n * auto-rendered selection + expansion columns ahead of the data columns.\n */\n @property({ attribute: false, type: Number })\n public colindex = 0;\n\n /**\n * Reactive token forwarded from {@link StateController.decorationVersion}.\n * Changing it re-runs {@link willUpdate} so module-driven cell decoration is\n * re-evaluated when it changes (e.g. while dragging a selection range). Stays\n * `0` for the community grid, so cells are never re-decorated there.\n */\n @property({ attribute: false, type: Number })\n public decorationVersion = 0;\n\n /** Decoration attribute keys applied on the previous update, for cleanup. */\n #decoratedKeys: string[] = [];\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.setAttribute('role', 'gridcell');\n this.addEventListener('click', this.#handleClick);\n this.addEventListener('dblclick', this.#handleDoubleClick);\n this.addEventListener('keydown', this.#handleCellKeydown);\n this.addEventListener('focusout', this.#handleCellFocusOut);\n }\n\n public override disconnectedCallback(): void {\n this.removeEventListener('click', this.#handleClick);\n this.removeEventListener('dblclick', this.#handleDoubleClick);\n this.removeEventListener('keydown', this.#handleCellKeydown);\n this.removeEventListener('focusout', this.#handleCellFocusOut);\n super.disconnectedCallback();\n }\n\n protected override willUpdate() {\n if (this.colindex > 0) {\n this.setAttribute('aria-colindex', String(this.colindex));\n } else {\n this.removeAttribute('aria-colindex');\n }\n if (this.active) {\n this.setAttribute('aria-current', 'true');\n } else {\n this.removeAttribute('aria-current');\n }\n // Reflect tree-expanded state on the group cell so the SCSS chevron\n // rotation triggers from this attribute (cheaper than per-render style\n // mutations and keeps the SVG transform purely declarative).\n const tree = this.state?.tree;\n const isGroup = tree?.enabled && this.row?.data && tree.isGroupColumn(this.column.key);\n if (isGroup && tree.isExpanded(this.row.data)) {\n this.setAttribute('data-tree-expanded', '');\n } else {\n this.removeAttribute('data-tree-expanded');\n }\n\n this.#applyDecoration();\n }\n\n /**\n * Reflects module-contributed decoration attributes (see {@link CellDecorator})\n * onto the cell host, reconciling against the previous update so attributes\n * that are no longer present are removed. Inert for the community grid:\n * `state.decorateCell` returns `null` with no modules, so nothing is set.\n */\n #applyDecoration(): void {\n const decoration =\n this.state && this.row\n ? this.state.decorateCell({\n row: this.row.data,\n rowIndex: this.row.index,\n column: this.column,\n value: this.value as unknown,\n })\n : null;\n const next = decoration?.attributes ?? {};\n\n // Remove anything we set last time that's gone (or explicitly cleared).\n for (const key of this.#decoratedKeys) {\n if (next[key] == null) this.removeAttribute(key);\n }\n\n const applied: string[] = [];\n for (const [key, value] of Object.entries(next)) {\n if (value == null) {\n this.removeAttribute(key);\n } else {\n this.setAttribute(key, value);\n applied.push(key);\n }\n }\n this.#decoratedKeys = applied;\n }\n\n protected override updated() {\n if (this.isEditing) {\n const editor = this.editorElement;\n editor?.focus();\n if (editor instanceof HTMLInputElement) {\n if (editor.type === 'text' || editor.type === 'number') {\n editor.select();\n }\n }\n }\n }\n\n #handleClick = (event: MouseEvent) => {\n if (this.isEditing) {\n // Don't let clicks inside the editor bubble into navigation / outside-click commits.\n event.stopPropagation();\n return;\n }\n if (!this.isEditable) return;\n // Boolean cells handle interaction in their display widget — clicking the\n // checkbox commits inline via `ctx.commit`. We never enter edit mode for\n // booleans, which avoids the visual reflow between display/editor markup\n // and lets a single click toggle the value.\n if (this.column.type === 'boolean') return;\n if (this.editingController.trigger !== 'click') return;\n this.#startEdit();\n };\n\n #handleDoubleClick = (event: MouseEvent) => {\n if (this.isEditing) {\n event.stopPropagation();\n return;\n }\n if (!this.isEditable) return;\n if (this.column.type === 'boolean') return;\n if (this.editingController.trigger !== 'doubleClick') return;\n this.#startEdit();\n };\n\n #startEdit() {\n if (!this.row) return;\n this.editingController.editCell(this.row.index, this.column.key);\n }\n\n #pendingValue: unknown;\n\n #commitWith = async (value?: unknown): Promise<boolean> => {\n return this.editingController.commitCell(value ?? this.#pendingValue);\n };\n\n #cancel = () => {\n this.editingController.cancelCell();\n };\n\n #handleKeydown = (event: KeyboardEvent) => {\n event.stopPropagation();\n switch (event.key) {\n case 'Enter':\n event.preventDefault();\n this.#commitWith();\n return;\n case 'Escape':\n event.preventDefault();\n this.#cancel();\n return;\n case 'Tab':\n // Commit first; navigation moves to the next/prev cell. Editing of the\n // landed cell stays manual (Enter to re-edit) for predictability.\n event.preventDefault();\n this.#commitWith();\n return;\n default:\n return;\n }\n };\n\n #handleBlur = () => {\n if (!this.isEditing) return;\n if (this.editingController.mode === 'cell') {\n this.#commitWith();\n } else {\n // Row mode — stash the value and exit the cell editor; the row stays open.\n this.editingController.commitCell(this.#pendingValue);\n }\n };\n\n /**\n * Cell-level keydown that catches keys bubbling out of registry-built\n * editors (the default editor stops propagation on its own input).\n *\n * - Escape always cancels the edit.\n * - Tab commits (or closes when there's no draft — `commitCell()` with\n * `undefined` value is treated as \"no change\" by the controller).\n *\n * Per-editor `keydown` handlers that need to consume Enter (e.g. the\n * built-in `<select>` editor) still get the first crack — they call\n * `event.stopPropagation()` and we never see those keys here.\n */\n #handleCellKeydown = (event: KeyboardEvent) => {\n if (!this.isEditing) return;\n if (event.key === 'Escape') {\n event.preventDefault();\n this.#cancel();\n return;\n }\n if (event.key === 'Tab') {\n event.preventDefault();\n this.#commitWith();\n }\n };\n\n /**\n * Cell-level focus-out: commits the active edit when focus truly leaves\n * the cell (clicking another cell, tabbing past the editor, blurring to\n * the document body). The default editor's input also has `@blur` which\n * commits first; by that time `isEditing` is false and this is a no-op.\n *\n * For built-in registry editors `commitCell()` with no explicit value\n * resolves to the current data value — same shape as \"no change\", so\n * losing focus without picking discards the open editor without writing\n * spurious data.\n */\n #handleCellFocusOut = (event: FocusEvent) => {\n if (!this.isEditing) return;\n const next = event.relatedTarget as Node | null;\n if (next && (this.contains(next) || this.shadowRoot?.contains(next))) return;\n if (this.editingController.mode === 'cell') {\n this.#commitWith();\n } else {\n this.editingController.commitCell(this.#pendingValue);\n }\n };\n\n #handleTextInput = (event: Event) => {\n const target = event.target as HTMLInputElement;\n this.#pendingValue = this.column.type === 'number' ? target.valueAsNumber : target.value;\n };\n\n #handleCheckboxChange = (event: Event) => {\n const target = event.target as HTMLInputElement;\n this.#pendingValue = target.checked;\n // Booleans commit immediately — toggling is the whole interaction.\n this.#commitWith(target.checked);\n };\n\n protected renderDefaultEditor() {\n const value = this.value as unknown;\n if (this.column.type === 'boolean') {\n this.#pendingValue = Boolean(value);\n return html`<input\n type=\"checkbox\"\n part=\"editor\"\n data-apex-editor\n ?checked=${Boolean(value)}\n @change=${this.#handleCheckboxChange}\n @keydown=${this.#handleKeydown}\n @blur=${this.#handleBlur}\n />`;\n }\n if (this.column.type === 'number') {\n this.#pendingValue = value;\n return html`<input\n type=\"number\"\n part=\"editor\"\n data-apex-editor\n .value=${value == null ? '' : String(value)}\n @input=${this.#handleTextInput}\n @keydown=${this.#handleKeydown}\n @blur=${this.#handleBlur}\n />`;\n }\n this.#pendingValue = value;\n return html`<input\n type=\"text\"\n part=\"editor\"\n data-apex-editor\n .value=${value == null ? '' : String(value)}\n @input=${this.#handleTextInput}\n @keydown=${this.#handleKeydown}\n @blur=${this.#handleBlur}\n />`;\n }\n\n protected renderEditor() {\n const template = this.column.editorTemplate;\n const ctx = {\n parent: this,\n row: this.row,\n column: this.column,\n value: this.value,\n commit: (next: unknown) => this.editingController.commitCell(next),\n cancel: () => this.editingController.cancelCell(),\n };\n if (template) {\n // For custom editors we don't know the draft shape; reset pending so\n // cell-level commit doesn't write a stale value from a previous edit.\n this.#pendingValue = this.value;\n return template(ctx as unknown as ApexEditorContext<T> as never);\n }\n const typeRenderer = getColumnTypeRenderer<T>(this.column.type);\n if (typeRenderer?.editor) {\n this.#pendingValue = this.value;\n return typeRenderer.editor(ctx as never);\n }\n return this.renderDefaultEditor();\n }\n\n /**\n * Renders the tree affordance — depth-based indent + a chevron toggle (or\n * leaf spacer) — that prefixes the group cell when {@link ApexGrid.tree}\n * is enabled. Returns `nothing` for every other cell.\n */\n protected renderTreeAffordance() {\n const tree = this.state?.tree;\n if (!tree?.enabled) return null;\n if (!this.row?.data) return null;\n if (!tree.isGroupColumn(this.column.key)) return null;\n\n const data = this.row.data;\n const meta = tree.getMeta(data);\n if (!meta) return null;\n\n const indent = meta.depth * tree.childIndent;\n const expanded = tree.isExpanded(data);\n const handleClick = (event: MouseEvent) => {\n event.stopPropagation();\n if (!meta.hasChildren) return;\n void tree.toggleRow(data);\n };\n\n const chevron = meta.hasChildren\n ? html`<button\n type=\"button\"\n part=\"tree-toggle\"\n aria-label=${expanded ? 'Collapse row' : 'Expand row'}\n aria-expanded=${expanded ? 'true' : 'false'}\n @click=${handleClick}\n >\n <svg\n part=\"tree-chevron\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n width=\"14\"\n height=\"14\"\n >\n <path\n d=\"M9 6l6 6-6 6\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>`\n : html`<span part=\"tree-spacer\" aria-hidden=\"true\"></span>`;\n\n return html`<span\n part=\"tree-indent\"\n aria-hidden=\"true\"\n style=${`inline-size: ${indent}px`}\n ></span>${chevron}`;\n }\n\n /**\n * Resolves the value to display for the cell. Synthesized tree parents\n * (those that appear only as a path segment with no backing data) render\n * their last path segment in the group column and nothing elsewhere.\n */\n protected resolveDisplayValue(): unknown {\n const tree = this.state?.tree;\n if (tree?.enabled && this.row?.data && tree.isSynthesized(this.row.data)) {\n return tree.isGroupColumn(this.column.key) ? tree.getLabel(this.row.data) : '';\n }\n return this.value;\n }\n\n protected renderCellBody() {\n if (this.column.cellTemplate) {\n return this.column.cellTemplate(this.context as ApexCellContext<T> as never);\n }\n const typeRenderer = getColumnTypeRenderer<T>(this.column.type);\n if (typeRenderer?.display) {\n // Synthesized parents have no real backing data — route them through\n // a plain text render instead of the typed renderer.\n const tree = this.state?.tree;\n if (tree?.enabled && this.row?.data && tree.isSynthesized(this.row.data)) {\n return html`${this.resolveDisplayValue()}`;\n }\n return typeRenderer.display(this.context as never);\n }\n return html`${this.resolveDisplayValue()}`;\n }\n\n protected override render() {\n if (this.isEditing) {\n return this.renderEditor();\n }\n const affordance = this.renderTreeAffordance();\n if (affordance) {\n return html`${affordance}<span part=\"tree-cell-content\">${this.renderCellBody()}</span>`;\n }\n return this.renderCellBody();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [ApexGridCell.tagName]: ApexGridCell<object>;\n }\n}\n"]}
|
|
@@ -28,7 +28,7 @@ export default class ApexFilterRow<T extends object> extends LitElement {
|
|
|
28
28
|
connectedCallback(): void;
|
|
29
29
|
disconnectedCallback(): void;
|
|
30
30
|
protected activeChanged(): void;
|
|
31
|
-
protected renderCriteriaButton(expr: FilterExpression<T>, index: number):
|
|
31
|
+
protected renderCriteriaButton(expr: FilterExpression<T>, index: number): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
32
32
|
protected renderExpressionChip(props: ExpressionChipProps<T>): import("lit-html").TemplateResult<1>;
|
|
33
33
|
protected renderActiveChips(): typeof nothing | import("lit-html").TemplateResult<1>[];
|
|
34
34
|
protected renderFilterActions(): import("lit-html").TemplateResult<1>;
|
package/components/grid.d.ts
CHANGED
|
@@ -463,16 +463,6 @@ export interface ApexGridEventMap<T extends object> {
|
|
|
463
463
|
* @event
|
|
464
464
|
*/
|
|
465
465
|
rowEditEnded: CustomEvent<ApexRowEditEndedEvent>;
|
|
466
|
-
/**
|
|
467
|
-
* Emitted before the row selection set changes.
|
|
468
|
-
*
|
|
469
|
-
* @remarks
|
|
470
|
-
* Cancellable — calling `preventDefault()` aborts the selection change.
|
|
471
|
-
* Fires for every selection-mutating call (toggle, range select, select-all,
|
|
472
|
-
* programmatic `selectedRows = ...`).
|
|
473
|
-
*
|
|
474
|
-
* @event
|
|
475
|
-
*/
|
|
476
466
|
/**
|
|
477
467
|
* Emitted before the tree-row expansion set changes.
|
|
478
468
|
*
|
|
@@ -507,6 +497,16 @@ export interface ApexGridEventMap<T extends object> {
|
|
|
507
497
|
* @event
|
|
508
498
|
*/
|
|
509
499
|
rowExpanded: CustomEvent<ApexRowExpandedEvent<T>>;
|
|
500
|
+
/**
|
|
501
|
+
* Emitted before the row selection set changes.
|
|
502
|
+
*
|
|
503
|
+
* @remarks
|
|
504
|
+
* Cancellable — calling `preventDefault()` aborts the selection change.
|
|
505
|
+
* Fires for every selection-mutating call (toggle, range select, select-all,
|
|
506
|
+
* programmatic `selectedRows = ...`).
|
|
507
|
+
*
|
|
508
|
+
* @event
|
|
509
|
+
*/
|
|
510
510
|
rowSelecting: CustomEvent<ApexRowSelectingEvent<T>>;
|
|
511
511
|
/**
|
|
512
512
|
* Emitted after a row-selection change has been applied.
|
|
@@ -522,18 +522,18 @@ export interface ApexGridEventMap<T extends object> {
|
|
|
522
522
|
* the ability to template cells and headers and column hiding.
|
|
523
523
|
*
|
|
524
524
|
* @remarks
|
|
525
|
-
* A working, styled grid requires
|
|
525
|
+
* A working, styled grid requires three things:
|
|
526
526
|
* 1. Register the element: `import 'apex-grid/define'` (or `ApexGrid.register()`).
|
|
527
|
-
* 2.
|
|
528
|
-
* `import { configureTheme } from 'igniteui-webcomponents';`
|
|
529
|
-
* `import 'igniteui-webcomponents/themes/light/bootstrap.css';`
|
|
530
|
-
* `configureTheme('bootstrap');`
|
|
531
|
-
* 3. Give the host element a bounded height, e.g. `apex-grid { height: 480px }` —
|
|
527
|
+
* 2. Give the host element a bounded height, e.g. `apex-grid { height: 480px }` —
|
|
532
528
|
* the virtualizer collapses without one.
|
|
533
|
-
*
|
|
529
|
+
* 3. Do NOT set `display` on the host — the component declares `:host { display: grid }`
|
|
534
530
|
* internally and any override breaks the track layout.
|
|
535
531
|
*
|
|
536
|
-
*
|
|
532
|
+
* The grid is styled out of the box through `--ag-*` CSS custom properties —
|
|
533
|
+
* there is no theme to import and no `configureTheme()` call. Override `--ag-*`
|
|
534
|
+
* tokens on the host (or any ancestor) to rebrand; when `igniteui-webcomponents`
|
|
535
|
+
* is present, the brand tokens auto-tint from its palette. See the README
|
|
536
|
+
* "Getting Started" and "Theming" sections for the full example and token list.
|
|
537
537
|
*
|
|
538
538
|
* @element apex-grid
|
|
539
539
|
*
|
|
@@ -555,7 +555,32 @@ export interface ApexGridEventMap<T extends object> {
|
|
|
555
555
|
* @fires rowEditEnded - Emitted when a row leaves edit mode (row mode only).
|
|
556
556
|
* @fires rowSelecting - Cancellable. Emitted before a selection-set change is applied.
|
|
557
557
|
* @fires rowSelected - Emitted after a selection-set change has been applied.
|
|
558
|
+
* @fires rowExpanding - Cancellable. Emitted before the row-expansion set changes (master-detail).
|
|
559
|
+
* @fires rowExpanded - Emitted after a row-expansion change has been applied.
|
|
560
|
+
* @fires treeRowExpanding - Cancellable. Emitted before a tree-row expansion change (tree mode).
|
|
561
|
+
* @fires treeRowExpanded - Emitted after a tree-row expansion change has been applied.
|
|
562
|
+
*
|
|
563
|
+
* @csspart live-region - Visually-hidden ARIA live region used for screen-reader announcements.
|
|
558
564
|
*
|
|
565
|
+
* @cssprop [--ag-brand] - Brand color for selection, focus rings, and accents. Auto-tints from `--ig-primary-500` when igniteui is present.
|
|
566
|
+
* @cssprop [--ag-brand-strong] - Brand color for hover / pressed states.
|
|
567
|
+
* @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.
|
|
568
|
+
* @cssprop [--ag-surface] - Grid card background (must be opaque).
|
|
569
|
+
* @cssprop [--ag-surface-alt] - Alternating row tint.
|
|
570
|
+
* @cssprop [--ag-surface-elevated] - Header background.
|
|
571
|
+
* @cssprop [--ag-hairline] - Header / structural gridline color.
|
|
572
|
+
* @cssprop [--ag-border] - Row separator color.
|
|
573
|
+
* @cssprop [--ag-text] - Primary text color.
|
|
574
|
+
* @cssprop [--ag-text-body] - Row text color.
|
|
575
|
+
* @cssprop [--ag-text-muted] - Muted text (roles, labels).
|
|
576
|
+
* @cssprop [--ag-row-hover] - Row hover wash.
|
|
577
|
+
* @cssprop [--ag-row-h] - Row height.
|
|
578
|
+
* @cssprop [--ag-header-h] - Header height.
|
|
579
|
+
* @cssprop [--ag-radius] - Outer card corner radius.
|
|
580
|
+
* @cssprop [--ag-font] - Grid font family.
|
|
581
|
+
* @cssprop [--ag-fs-cell] - Cell font size.
|
|
582
|
+
*
|
|
583
|
+
* @see {@link https://github.com/apexcharts/apex-grid/blob/main/packages/core/src/styles/_tokens.scss | _tokens.scss} for the complete `--ag-*` token list.
|
|
559
584
|
*/
|
|
560
585
|
export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGridEventMap<T>> {
|
|
561
586
|
static get tagName(): string;
|
|
@@ -1147,11 +1172,19 @@ export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGri
|
|
|
1147
1172
|
moveColumn(fromKey: Keys<T>, toKey: Keys<T>, position?: ColumnDropPosition): Promise<boolean>;
|
|
1148
1173
|
protected bodyClickHandler(event: MouseEvent): void;
|
|
1149
1174
|
protected bodyKeydownHandler(event: KeyboardEvent): void;
|
|
1175
|
+
/**
|
|
1176
|
+
* Forwards body-cell pointer interactions (press / drag-over / release) to
|
|
1177
|
+
* feature modules via {@link StateController.handleCellInteraction}. Gated on
|
|
1178
|
+
* there being at least one registered module so the community grid does no
|
|
1179
|
+
* per-event work (it registers none). The seam a range-selection feature
|
|
1180
|
+
* builds on.
|
|
1181
|
+
*/
|
|
1182
|
+
protected bodyPointerHandler(event: PointerEvent): void;
|
|
1150
1183
|
protected renderHeaderRow(): import("lit-html").TemplateResult<1>;
|
|
1151
1184
|
protected renderBody(): import("lit-html").TemplateResult<1>;
|
|
1152
|
-
protected renderFilterRow():
|
|
1153
|
-
protected renderToolbar():
|
|
1154
|
-
protected renderPaginator():
|
|
1185
|
+
protected renderFilterRow(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
1186
|
+
protected renderToolbar(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
1187
|
+
protected renderPaginator(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
1155
1188
|
/**
|
|
1156
1189
|
* Renders a visually-hidden polite live region. Status messages set via
|
|
1157
1190
|
* {@link announce} land here; screen readers will read them aloud without
|
package/components/grid.js
CHANGED
|
@@ -196,7 +196,7 @@ export class ApexGrid extends EventEmitterBase {
|
|
|
196
196
|
if (this.stateController?.tree?.enabled) {
|
|
197
197
|
next = this.stateController.tree.process(next);
|
|
198
198
|
}
|
|
199
|
-
this.dataState = next;
|
|
199
|
+
this.dataState = this.stateController ? this.stateController.applyModuleTransforms(next) : next;
|
|
200
200
|
if (this.hasUpdated) {
|
|
201
201
|
this.pipeline();
|
|
202
202
|
}
|
|
@@ -435,6 +435,24 @@ export class ApexGrid extends EventEmitterBase {
|
|
|
435
435
|
this.stateController.navigation.navigate(event);
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
|
+
bodyPointerHandler(event) {
|
|
439
|
+
if (this.stateController.modules.size === 0)
|
|
440
|
+
return;
|
|
441
|
+
const target = event.composedPath().find((el) => el instanceof ApexGridCell);
|
|
442
|
+
if (!target?.row)
|
|
443
|
+
return;
|
|
444
|
+
const kind = event.type === 'pointerdown' ? 'down' : event.type === 'pointerup' ? 'up' : 'over';
|
|
445
|
+
this.stateController.handleCellInteraction({
|
|
446
|
+
kind,
|
|
447
|
+
row: target.row.data,
|
|
448
|
+
rowIndex: target.row.index,
|
|
449
|
+
column: target.column,
|
|
450
|
+
shiftKey: event.shiftKey,
|
|
451
|
+
ctrlKey: event.ctrlKey,
|
|
452
|
+
metaKey: event.metaKey,
|
|
453
|
+
originalEvent: event,
|
|
454
|
+
});
|
|
455
|
+
}
|
|
438
456
|
renderHeaderRow() {
|
|
439
457
|
return html `
|
|
440
458
|
<apex-grid-header-row
|
|
@@ -451,6 +469,9 @@ export class ApexGrid extends EventEmitterBase {
|
|
|
451
469
|
.renderItem=${this.DOM.rowRenderer}
|
|
452
470
|
@click=${this.bodyClickHandler}
|
|
453
471
|
@keydown=${this.bodyKeydownHandler}
|
|
472
|
+
@pointerdown=${this.bodyPointerHandler}
|
|
473
|
+
@pointerover=${this.bodyPointerHandler}
|
|
474
|
+
@pointerup=${this.bodyPointerHandler}
|
|
454
475
|
></apex-virtualizer>
|
|
455
476
|
`;
|
|
456
477
|
}
|