apex-grid 3.0.1 → 3.2.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 +63 -1
- package/README.md +1 -1
- 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 +20 -5
- 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/header.js +1 -1
- package/components/header.js.map +1 -1
- 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/sort.d.ts +1 -1
- package/controllers/sort.js +2 -2
- package/controllers/sort.js.map +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 +437 -3
- package/docs/assets/hierarchy.js +1 -1
- package/docs/classes/ApexGrid.html +27 -21
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +1 -1
- package/docs/interfaces/BaseApexCellContext.html +1 -1
- package/docs/interfaces/BaseApexEditorContext.html +1 -1
- package/docs/interfaces/CSVExportOptions.html +1 -1
- package/docs/interfaces/ExportOptions.html +1 -1
- package/docs/interfaces/PaginationState.html +1 -1
- package/docs/media/_tokens.scss +98 -0
- package/docs/media/package.json +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/_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/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/paginator/paginator.css.js +1 -1
- package/styles/paginator/paginator.css.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,67 @@ 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.0
|
|
7
|
+
## [3.2.0] — 2026-06-23
|
|
8
|
+
|
|
9
|
+
Additive, backward-compatible release. The default look of `<apex-grid>` is
|
|
10
|
+
unchanged; the dark theme is opt-in via a new `theme` attribute.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **Built-in dark theme.** Set `theme="dark"` on the host for a built-in slate
|
|
14
|
+
dark palette — no theme to import and no `configureTheme()` call. Add `tinted`
|
|
15
|
+
(`theme="tinted"` or `theme="dark tinted"`) to mix `--ag-brand` into the chrome
|
|
16
|
+
surfaces so the grid wears its brand even at rest. Further `--ag-*` overrides
|
|
17
|
+
still compose on top.
|
|
18
|
+
- **`--ag-grid-bg` token.** Host card background hook; defaults to the subtle
|
|
19
|
+
light gradient and is driven by the new token-based surfaces.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
- **Multi-sort now requires Ctrl/⌘ to append a column.** With multi-sort
|
|
23
|
+
enabled, a plain header click sorts by that column alone (clearing other sort
|
|
24
|
+
keys); Ctrl/⌘+click appends the column as a lower-priority sort. Keyboard
|
|
25
|
+
activation mirrors the modifier keys, so Ctrl/⌘+Enter is additive too.
|
|
26
|
+
Previously every plain click accumulated a sort key, so a second column added
|
|
27
|
+
behind a unique primary column did not change the visible order.
|
|
28
|
+
|
|
29
|
+
## [3.1.0] — 2026-06-19
|
|
30
|
+
|
|
31
|
+
Additive, backward-compatible release. The public `apex-grid` `.` / `./define`
|
|
32
|
+
API and the runtime behavior of `<apex-grid>` are unchanged; everything added
|
|
33
|
+
here is **inert for the community grid** and surfaced only on the unstable
|
|
34
|
+
`apex-grid/internal` subpath for the first-party `apex-grid-enterprise` package.
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
- **Feature-module seam.** `GridFeatureModule` contract plus a `StateController`
|
|
38
|
+
module registry (`modules`, `module<C>(id)`) and a `createStateController()`
|
|
39
|
+
factory override point, so a subclass can layer in extra features without
|
|
40
|
+
forking core. The built-in controller set and `new StateController(host)`
|
|
41
|
+
remain behavior-identical (an empty module set is a no-op).
|
|
42
|
+
- **Row seams** (`apex-grid/internal`): `RowTransformer.processRows()` (inject /
|
|
43
|
+
reorder rows after filter → sort → tree, before pagination) and
|
|
44
|
+
`RowPresenter.presentRow()` (render a row full-width, like the detail panel,
|
|
45
|
+
with aria-level / expanded).
|
|
46
|
+
- **Cell seams** (`apex-grid/internal`): `CellDecorator.decorateCell()` (a module
|
|
47
|
+
reflects `data-*` attributes onto individual cells; cells re-evaluate on a
|
|
48
|
+
`decorationVersion` token bumped via `bumpDecoration()`) and
|
|
49
|
+
`CellInteractionHandler.handleCellInteraction()` (the grid body forwards
|
|
50
|
+
pointer down/over/up on cells to modules, gated on `modules.size` so the
|
|
51
|
+
community grid pays nothing).
|
|
52
|
+
- Inert, variable-driven cell range / fill-handle styling in `body-cell.scss`,
|
|
53
|
+
keyed off `data-range*` attributes and fully transparent until a theme sets
|
|
54
|
+
the `--apex-range-*` custom properties.
|
|
55
|
+
|
|
56
|
+
### Fixed
|
|
57
|
+
- Row render no longer dereferences `undefined` when a row index transiently
|
|
58
|
+
falls beyond the current `data` (e.g. while a server-side / infinite row model
|
|
59
|
+
resizes the array on a filter or sort change); the row renders nothing for
|
|
60
|
+
that frame and re-renders with the real item.
|
|
61
|
+
|
|
62
|
+
### Notes
|
|
63
|
+
- `apex-grid/internal` is an **unstable, first-party-only** support surface; its
|
|
64
|
+
shape may change in any release. The community `.` and `./define` exports stay
|
|
65
|
+
frozen.
|
|
66
|
+
|
|
67
|
+
## [3.0.1] — 2026-06-10
|
|
8
68
|
|
|
9
69
|
Documentation-only patch (no runtime or API changes).
|
|
10
70
|
|
|
@@ -47,5 +107,7 @@ Documentation-only patch (no runtime or API changes).
|
|
|
47
107
|
- Repository converted to an npm-workspaces monorepo; this package publishes
|
|
48
108
|
from `packages/core`.
|
|
49
109
|
|
|
110
|
+
[3.2.0]: https://github.com/apexcharts/apex-grid/releases
|
|
111
|
+
[3.1.0]: https://github.com/apexcharts/apex-grid/releases
|
|
50
112
|
[3.0.1]: https://github.com/apexcharts/apex-grid/releases
|
|
51
113
|
[3.0.0]: https://github.com/apexcharts/apex-grid/releases
|
package/README.md
CHANGED
|
@@ -182,7 +182,7 @@ grid.sort({ key: 'age', direction: 'asc' });
|
|
|
182
182
|
grid.clearSort(); // or grid.clearSort('age')
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
Events: `sorting` (cancellable), `sorted`.
|
|
185
|
+
When `multiple` is enabled, a plain header click sorts by that column alone; hold Ctrl/Cmd and click to append additional columns as lower-priority sort keys. Events: `sorting` (cancellable), `sorted`.
|
|
186
186
|
|
|
187
187
|
### Filtering
|
|
188
188
|
|
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,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAwB,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOpD,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAS9D,MAAM,CAAC,OAAO,OAAO,YAA+B,SAAQ,UAAU;IAAtE;;QA4BS,WAAM,GAAG,KAAK,CAAC;QAOf,YAAO,GAAG,KAAK,CAAC;QAsDhB,aAAQ,GAAG,CAAC,CAAC;QAsDpB,iBAAY,GAAG,CAAC,KAAiB,EAAE,EAAE;YACnC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBAEnB,KAAK,CAAC,eAAe,EAAE,CAAC;gBACxB,OA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;QACD,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC;IAC/B,CAAC;;AAnaM;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CACA;AAMxB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CACQ;AAOhC;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CACrB;AAOf;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CACpB;AAIhB;IAFN,OAAO,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACvD,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CACG;AAQxB;IADT,KAAK,CAAC,2BAA2B,CAAC;mDACU;AA0CtC;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,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,yBAAyB,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOpD,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAS9D,MAAM,CAAC,OAAO,OAAO,YAA+B,SAAQ,UAAU;IAAtE;;QA4BS,WAAM,GAAG,KAAK,CAAC;QAOf,YAAO,GAAG,KAAK,CAAC;QAsDhB,aAAQ,GAAG,CAAC,CAAC;QASb,sBAAiB,GAAG,CAAC,CAAC;QAG7B,mBAAc,GAAa,EAAE,CAAC;QA2F9B,iBAAY,GAAG,CAAC,KAAiB,EAAE,EAAE;YACnC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBAEnB,KAAK,CAAC,eAAe,EAAE,CAAC;gBACxB,OAAO;YACT,CAAC;YACD,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AAK,EAAE,CAAC;4CACQ;AAOhC;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CACrB;AAOf;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CACpB;AAIhB;IAFN,OAAO,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACvD,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CACG;AAQxB;IADT,KAAK,CAAC,2BAA2B,CAAC;mDACU;AA0CtC;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CACzB;AASb;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAChB","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 /**\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
|
@@ -532,11 +532,17 @@ export interface ApexGridEventMap<T extends object> {
|
|
|
532
532
|
* The grid is styled out of the box through `--ag-*` CSS custom properties —
|
|
533
533
|
* there is no theme to import and no `configureTheme()` call. Override `--ag-*`
|
|
534
534
|
* tokens on the host (or any ancestor) to rebrand; when `igniteui-webcomponents`
|
|
535
|
-
* is present, the brand tokens auto-tint from its palette.
|
|
536
|
-
*
|
|
535
|
+
* is present, the brand tokens auto-tint from its palette. For dark mode, set
|
|
536
|
+
* the `theme="dark"` attribute on the host for the built-in slate dark palette
|
|
537
|
+
* (further `--ag-*` overrides still compose on top). Add `tinted` (e.g.
|
|
538
|
+
* `theme="tinted"` or `theme="dark tinted"`) to mix the brand into the chrome
|
|
539
|
+
* so the grid wears its brand even at rest. See the README "Getting Started"
|
|
540
|
+
* and "Theming" sections for the full example and token list.
|
|
537
541
|
*
|
|
538
542
|
* @element apex-grid
|
|
539
543
|
*
|
|
544
|
+
* @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"`.
|
|
545
|
+
*
|
|
540
546
|
* @fires sorting - Emitted when sorting is initiated through the UI.
|
|
541
547
|
* @fires sorted - Emitted when a sort operation initiated through the UI has completed.
|
|
542
548
|
* @fires filtering - Emitted when filtering is initiated through the UI.
|
|
@@ -565,6 +571,7 @@ export interface ApexGridEventMap<T extends object> {
|
|
|
565
571
|
* @cssprop [--ag-brand] - Brand color for selection, focus rings, and accents. Auto-tints from `--ig-primary-500` when igniteui is present.
|
|
566
572
|
* @cssprop [--ag-brand-strong] - Brand color for hover / pressed states.
|
|
567
573
|
* @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.
|
|
574
|
+
* @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.
|
|
568
575
|
* @cssprop [--ag-surface] - Grid card background (must be opaque).
|
|
569
576
|
* @cssprop [--ag-surface-alt] - Alternating row tint.
|
|
570
577
|
* @cssprop [--ag-surface-elevated] - Header background.
|
|
@@ -1172,11 +1179,19 @@ export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGri
|
|
|
1172
1179
|
moveColumn(fromKey: Keys<T>, toKey: Keys<T>, position?: ColumnDropPosition): Promise<boolean>;
|
|
1173
1180
|
protected bodyClickHandler(event: MouseEvent): void;
|
|
1174
1181
|
protected bodyKeydownHandler(event: KeyboardEvent): void;
|
|
1182
|
+
/**
|
|
1183
|
+
* Forwards body-cell pointer interactions (press / drag-over / release) to
|
|
1184
|
+
* feature modules via {@link StateController.handleCellInteraction}. Gated on
|
|
1185
|
+
* there being at least one registered module so the community grid does no
|
|
1186
|
+
* per-event work (it registers none). The seam a range-selection feature
|
|
1187
|
+
* builds on.
|
|
1188
|
+
*/
|
|
1189
|
+
protected bodyPointerHandler(event: PointerEvent): void;
|
|
1175
1190
|
protected renderHeaderRow(): import("lit-html").TemplateResult<1>;
|
|
1176
1191
|
protected renderBody(): import("lit-html").TemplateResult<1>;
|
|
1177
|
-
protected renderFilterRow():
|
|
1178
|
-
protected renderToolbar():
|
|
1179
|
-
protected renderPaginator():
|
|
1192
|
+
protected renderFilterRow(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
1193
|
+
protected renderToolbar(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
1194
|
+
protected renderPaginator(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
1180
1195
|
/**
|
|
1181
1196
|
* Renders a visually-hidden polite live region. Status messages set via
|
|
1182
1197
|
* {@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
|
}
|