apex-grid 3.3.0 → 3.4.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +29 -0
  3. package/components/cell.d.ts +2 -2
  4. package/components/cell.js +30 -2
  5. package/components/cell.js.map +1 -1
  6. package/components/filter-row.js +65 -6
  7. package/components/filter-row.js.map +1 -1
  8. package/components/grid.d.ts +5 -0
  9. package/components/grid.js +34 -2
  10. package/components/grid.js.map +1 -1
  11. package/components/header.js +80 -9
  12. package/components/header.js.map +1 -1
  13. package/controllers/expansion.js +4 -4
  14. package/controllers/expansion.js.map +1 -1
  15. package/controllers/filter.js +11 -0
  16. package/controllers/filter.js.map +1 -1
  17. package/controllers/history.js +11 -4
  18. package/controllers/history.js.map +1 -1
  19. package/controllers/navigation.d.ts +34 -2
  20. package/controllers/navigation.js +92 -3
  21. package/controllers/navigation.js.map +1 -1
  22. package/controllers/pagination.js +1 -1
  23. package/controllers/pagination.js.map +1 -1
  24. package/controllers/row-pin.js +2 -2
  25. package/controllers/row-pin.js.map +1 -1
  26. package/controllers/row-reorder.js +6 -6
  27. package/controllers/row-reorder.js.map +1 -1
  28. package/controllers/selection.js +3 -3
  29. package/controllers/selection.js.map +1 -1
  30. package/controllers/sort.js +4 -2
  31. package/controllers/sort.js.map +1 -1
  32. package/custom-elements.json +223 -7
  33. package/docs/assets/hierarchy.js +1 -1
  34. package/docs/assets/search.js +1 -1
  35. package/docs/functions/localize.html +2 -2
  36. package/docs/hierarchy.html +1 -1
  37. package/docs/index.html +62 -1
  38. package/docs/interfaces/BaseApexCellContext.html +1 -1
  39. package/docs/interfaces/BaseApexEditorContext.html +1 -1
  40. package/docs/interfaces/CSVExportOptions.html +1 -1
  41. package/docs/interfaces/ExportOptions.html +1 -1
  42. package/docs/interfaces/PaginationState.html +1 -1
  43. package/docs/media/package.json +2 -2
  44. package/docs/variables/EN_LOCALE.html +2 -2
  45. package/i18n/en.d.ts +95 -1
  46. package/i18n/en.js +95 -1
  47. package/i18n/en.js.map +1 -1
  48. package/i18n/es.js +95 -1
  49. package/i18n/es.js.map +1 -1
  50. package/internal/column-types.js +1 -1
  51. package/internal/column-types.js.map +1 -1
  52. package/package.json +1 -1
  53. package/styles/body-cell/body-cell.css.js +1 -1
  54. package/styles/body-cell/body-cell.css.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"grid.js","sourceRoot":"","sources":["../../src/components/grid.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAIL,QAAQ,IAAI,iBAAiB,GAC9B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EACL,QAAQ,EAER,YAAY,GAGb,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAmB,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC5F,OAAO,EACL,iBAAiB,EAEjB,iBAAiB,EAIjB,cAAc,EAId,qBAAqB,EACrB,eAAe,EACf,g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C,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;oCAG9B;AAUD;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;wCAG9B;AAcS;IADT,KAAK,CAAC,SAAS,CAAC;4CAGhB;AAGS;IADT,KAAK,CAAC,MAAM,CAAC;2CAwBb;AAGe;IADf,KAAK,CAAC,QAAQ,CAAC;wCAIf;AAGS;IADT,KAAK,CAAC,YAAY,CAAC;iDAcnB;AAGS;IADT,KAAK,CAAC,aAAa,CAAC;kDAKpB;AAi3BS;IADT,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAS/B","sourcesContent":["import { ContextProvider } from '@lit/context';\nimport { html, nothing } from 'lit';\nimport { eventOptions, property, query, queryAll, state } from 'lit/decorators.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { DataOperationsController } from '../controllers/data-operation.js';\nimport { GridDOMController } from '../controllers/dom.js';\nimport type { RowPinPosition } from '../controllers/row-pin.js';\nimport type { RowDropPosition } from '../controllers/row-reorder.js';\nimport { gridStateContext, StateController } from '../controllers/state.js';\nimport {\n type GridLocaleKey,\n type GridLocaleText,\n type LocaleParams,\n localize as resolveLocaleText,\n} from '../i18n/index.js';\nimport { DEFAULT_COLUMN_CONFIG, PIPELINE } from '../internal/constants.js';\nimport {\n buildCSV,\n type CSVExportOptions,\n downloadBlob,\n type ExportFormat,\n type ExportOptions,\n} from '../internal/export.js';\nimport type { CellInteractionKind } from '../internal/feature-module.js';\nimport { EventEmitterBase } from '../internal/mixins/event-emitter.js';\nimport { registerComponent } from '../internal/register.js';\nimport { columnSchema, type GridSchema, operandsByType } from '../internal/state-schema.js';\nimport {\n applyColumnLayout,\n type ColumnLayoutState,\n deserializeFilter,\n type GetStateOptions,\n type GridState,\n type RowRef,\n resolveRowRefs,\n type SetStateOptions,\n type SetStateResult,\n type SortStateSnapshot,\n serializeColumnLayout,\n serializeFilter,\n serializeRowRefs,\n serializeSort,\n} from '../internal/state-snapshot.js';\nimport { GRID_TAG } from '../internal/tags.js';\nimport type {\n ColumnConfiguration,\n ColumnGroupConfiguration,\n DataPipelineConfiguration,\n GridEditingConfiguration,\n GridExpansionConfiguration,\n GridRowPinningConfiguration,\n GridRowReorderingConfiguration,\n GridSelectionConfiguration,\n GridSortConfiguration,\n GridTreeConfiguration,\n Keys,\n PaginationConfiguration,\n PaginationState,\n PinPosition,\n ToolbarAction,\n} from '../internal/types.js';\nimport {\n asArray,\n autoGenerateColumns,\n getDisplayColumns,\n getFilterOperandsFor,\n} from '../internal/utils.js';\nimport { watch } from '../internal/watch.js';\nimport type { FilterExpression } from '../operations/filter/types.js';\nimport type { SortExpression } from '../operations/sort/types.js';\nimport { styles as gridStyles } from '../styles/grid/grid.css.js';\nimport ApexGridCell from './cell.js';\nimport ApexFilterRow from './filter-row.js';\nimport ApexGridGroupHeaderRow from './group-header-row.js';\nimport ApexGridHeaderRow from './header-row.js';\nimport ApexGridPaginator from './paginator.js';\nimport ApexGridRow from './row.js';\nimport ApexGridToolbar from './toolbar.js';\nimport ApexVirtualizer from './virtualizer.js';\n\n/**\n * Event object for the filtering event of the grid.\n */\nexport interface ApexFilteringEvent<T extends object> {\n /**\n * The target column for the filter operation.\n */\n key: Keys<T>;\n\n /**\n * The filter expression(s) to apply.\n */\n expressions: FilterExpression<T>[];\n\n /**\n * The type of modification which will be applied to the filter\n * state of the column.\n *\n * @remarks\n * `add` - a new filter expression will be added to the state of the column.\n * `modify` - an existing filter expression will be modified.\n * `remove` - the expression(s) will be removed from the state of the column.\n */\n type: 'add' | 'modify' | 'remove';\n}\n\n/**\n * Event object for the filtered event of the grid.\n */\nexport interface ApexFilteredEvent<T extends object> {\n /**\n * The target column for the filter operation.\n */\n key: Keys<T>;\n\n /**\n * The filter state of the column after the operation.\n */\n state: FilterExpression<T>[];\n}\n\n/**\n * Event payload for the cancellable `pageChanging` event.\n */\nexport interface ApexPageChangingEvent {\n /**\n * The current page (zero-based) before the change.\n */\n page: number;\n /**\n * The current page size before the change.\n */\n pageSize: number;\n /**\n * The proposed page (zero-based) the grid will navigate to.\n */\n nextPage: number;\n /**\n * The proposed page size after the change.\n */\n nextPageSize: number;\n}\n\n/**\n * Event payload for the `pageChanged` event. Mirrors {@link PaginationState}.\n */\nexport interface ApexPageChangedEvent extends PaginationState {}\n\n/**\n * Event payload for the cancellable `quickFilterChanging` event.\n */\nexport interface ApexQuickFilterChangingEvent {\n /**\n * The current quick-filter value before the change.\n */\n value: string;\n /**\n * The proposed quick-filter value.\n */\n nextValue: string;\n}\n\n/**\n * Event payload for the `quickFilterChanged` event.\n */\nexport interface ApexQuickFilterChangedEvent {\n /**\n * The resolved quick-filter value after the change.\n */\n value: string;\n}\n\n/**\n * Drop position relative to a target column when reordering.\n */\nexport type ColumnDropPosition = 'before' | 'after';\n\n/**\n * Event payload for the cancellable `cellValueChanging` event.\n */\nexport interface ApexCellValueChangingEvent<T extends object> {\n /**\n * The column key of the edited cell.\n */\n key: Keys<T>;\n /**\n * The view-relative row index (matches {@link ApexGrid.pageItems}).\n */\n rowIndex: number;\n /**\n * The data record being edited (a live reference to the row in\n * {@link ApexGrid.data}).\n */\n data: T;\n /**\n * The value before the edit.\n */\n oldValue: unknown;\n /**\n * The candidate new value.\n */\n newValue: unknown;\n}\n\n/**\n * Event payload for the `cellValueChanged` event.\n */\nexport interface ApexCellValueChangedEvent<T extends object> {\n /**\n * The column key of the edited cell.\n */\n key: Keys<T>;\n /**\n * The view-relative row index after the change.\n */\n rowIndex: number;\n /**\n * The data record after the change (a live reference to the row in\n * {@link ApexGrid.data}).\n */\n data: T;\n /**\n * The applied value.\n */\n value: unknown;\n}\n\n/**\n * Event payload for the `cellValidationFailed` event.\n */\nexport interface ApexCellValidationFailedEvent<T extends object> {\n /**\n * The column key of the rejected cell.\n */\n key: Keys<T>;\n /**\n * The view-relative row index of the rejected cell.\n */\n rowIndex: number;\n /**\n * The data record being edited (a live reference to the row in\n * {@link ApexGrid.data}).\n */\n data: T;\n /**\n * The candidate value that failed validation.\n */\n value: unknown;\n /**\n * The collected validator error messages.\n */\n errors: readonly string[];\n}\n\n/**\n * Event payload for the cancellable `rowPinning` event and the follow-up\n * `rowPinned` event.\n */\nexport interface ApexRowPinningEvent<T extends object> {\n /** The row being pinned or unpinned (a live reference into {@link ApexGrid.data}). */\n row: T;\n /**\n * The target band: `'top'` / `'bottom'` when pinning, or `null` when\n * unpinning.\n */\n position: RowPinPosition | null;\n}\n\n/**\n * Event payload for the cancellable `rowMoving` event and the follow-up\n * `rowMoved` event.\n */\nexport interface ApexRowMovingEvent<T extends object> {\n /** The moving row's view index before the move. */\n from: number;\n /** The target row's view index. */\n to: number;\n /** The row being moved (a live reference into {@link ApexGrid.data}). */\n data: T;\n}\n\n/**\n * Event payload for the `historyChanged` event.\n */\nexport interface ApexHistoryChangedEvent {\n /** Whether there is at least one command to undo. */\n canUndo: boolean;\n /** Whether there is at least one command to redo. */\n canRedo: boolean;\n}\n\n/**\n * Event payload for the `stateChanged` event.\n */\nexport interface ApexStateChangedEvent {\n /** The grid's restorable state after the change, as captured by `getState`. */\n state: GridState;\n}\n\n/**\n * Event payload for the `rowEditStarted` event.\n */\nexport interface ApexRowEditStartedEvent {\n /**\n * The view-relative row index entering edit mode.\n */\n rowIndex: number;\n}\n\n/**\n * Event payload for the `rowEditEnded` event.\n */\nexport interface ApexRowEditEndedEvent {\n /**\n * The view-relative row index that left edit mode.\n */\n rowIndex: number;\n /**\n * `true` when pending edits were applied, `false` when discarded.\n */\n committed: boolean;\n}\n\n/**\n * Event payload for the cancellable `columnMoving` event.\n */\nexport interface ApexColumnMovingEvent<T extends object> {\n /**\n * The column being moved.\n */\n key: Keys<T>;\n /**\n * The current index of the moving column in {@link ApexGrid.columns}.\n */\n fromIndex: number;\n /**\n * The target column key. The dragged column will be placed `position`\n * (before/after) this column.\n */\n toKey: Keys<T>;\n /**\n * Whether the dragged column is being placed before or after `toKey`.\n */\n position: ColumnDropPosition;\n}\n\n/**\n * Event payload for the `columnMoved` event.\n */\nexport interface ApexColumnMovedEvent<T extends object> {\n /**\n * The column that was moved.\n */\n key: Keys<T>;\n /**\n * The original index in {@link ApexGrid.columns}.\n */\n fromIndex: number;\n /**\n * The resolved index in {@link ApexGrid.columns} after the move.\n */\n toIndex: number;\n}\n\n/**\n * Event payload for the cancellable `rowSelecting` event.\n */\nexport interface ApexRowSelectingEvent<T extends object> {\n /**\n * The rows that will become selected by this change.\n */\n added: T[];\n /**\n * The rows that will become deselected by this change.\n */\n removed: T[];\n /**\n * The full current selection before this change is applied.\n */\n current: T[];\n /**\n * The full selection after this change would be applied. Listeners can\n * inspect this to decide whether to cancel.\n */\n next: T[];\n}\n\n/**\n * Event payload for the `rowSelected` event.\n */\nexport interface ApexRowSelectedEvent<T extends object> {\n /**\n * The rows that became selected in this change.\n */\n added: T[];\n /**\n * The rows that became deselected in this change.\n */\n removed: T[];\n /**\n * The full current selection after the change has been applied.\n */\n selected: T[];\n}\n\n/**\n * Event payload for the cancellable `treeRowExpanding` event.\n */\nexport interface ApexTreeRowExpandingEvent<T extends object> {\n /** Rows that will become expanded by this change. */\n added: T[];\n /** Rows that will become collapsed by this change. */\n removed: T[];\n /** The full current tree-expansion set before this change is applied. */\n current: T[];\n /** The full set after this change would be applied. */\n next: T[];\n}\n\n/**\n * Event payload for the `treeRowExpanded` event.\n */\nexport interface ApexTreeRowExpandedEvent<T extends object> {\n /** Rows that became expanded in this change. */\n added: T[];\n /** Rows that became collapsed in this change. */\n removed: T[];\n /** The full tree-expansion set after the change has been applied. */\n expanded: T[];\n}\n\n/**\n * Event payload for the cancellable `rowExpanding` event.\n */\nexport interface ApexRowExpandingEvent<T extends object> {\n /** The rows that will become expanded by this change. */\n added: T[];\n /** The rows that will become collapsed by this change. */\n removed: T[];\n /** The full current expansion set before this change is applied. */\n current: T[];\n /**\n * The full expansion set after this change would be applied. Listeners can\n * inspect this to decide whether to cancel.\n */\n next: T[];\n}\n\n/**\n * Event payload for the `rowExpanded` event.\n */\nexport interface ApexRowExpandedEvent<T extends object> {\n /** The rows that became expanded in this change. */\n added: T[];\n /** The rows that became collapsed in this change. */\n removed: T[];\n /** The full expansion set after the change has been applied. */\n expanded: T[];\n}\n\n/**\n * Event payload for the cancellable `columnPinning` event.\n */\nexport interface ApexColumnPinningEvent<T extends object> {\n /**\n * The target column key.\n */\n key: Keys<T>;\n /**\n * The current pin position before the change (`null` if unpinned).\n */\n previous: PinPosition;\n /**\n * The proposed pin position (`null` to unpin).\n */\n next: PinPosition;\n}\n\n/**\n * Event payload for the `columnPinned` event.\n */\nexport interface ApexColumnPinnedEvent<T extends object> {\n /**\n * The target column key.\n */\n key: Keys<T>;\n /**\n * The resolved pin position after the change.\n */\n pinned: PinPosition;\n}\n\n/**\n * Events for the apex-grid.\n */\nexport interface ApexGridEventMap<T extends object> {\n /**\n * Emitted when sorting is initiated through the UI.\n * Returns the sort expression which will be used for the operation.\n *\n * @remarks\n * The event is cancellable which prevents the operation from being applied.\n * The expression can be modified prior to the operation running.\n *\n * @event\n */\n sorting: CustomEvent<SortExpression<T>>;\n /**\n * Emitted when a sort operation initiated through the UI has completed.\n * Returns the sort expression used for the operation.\n *\n * @event\n */\n sorted: CustomEvent<SortExpression<T>>;\n /**\n * Emitted when filtering is initiated through the UI.\n *\n * @remarks\n * The event is cancellable which prevents the operation from being applied.\n * The expression can be modified prior to the operation running.\n *\n * @event\n */\n filtering: CustomEvent<ApexFilteringEvent<T>>;\n /**\n * Emitted when a filter operation initiated through the UI has completed.\n * Returns the filter state for the affected column.\n *\n * @event\n */\n filtered: CustomEvent<ApexFilteredEvent<T>>;\n /**\n * Emitted before the grid navigates to a new page or applies a new page size.\n *\n * @remarks\n * Cancellable — calling `preventDefault()` (or returning a falsy result from\n * `addEventListener` synchronously) aborts the page change.\n *\n * @event\n */\n pageChanging: CustomEvent<ApexPageChangingEvent>;\n /**\n * Emitted after a page or page-size change has been applied and the pipeline has run.\n *\n * @event\n */\n pageChanged: CustomEvent<ApexPageChangedEvent>;\n /**\n * Emitted before the quick-filter value is applied.\n *\n * @remarks\n * Cancellable — calling `preventDefault()` aborts the change. The value can\n * be replaced inside the listener by reassigning {@link ApexGrid.quickFilter}.\n *\n * @event\n */\n quickFilterChanging: CustomEvent<ApexQuickFilterChangingEvent>;\n /**\n * Emitted after a quick-filter change has been applied and the pipeline has run.\n *\n * @event\n */\n quickFilterChanged: CustomEvent<ApexQuickFilterChangedEvent>;\n /**\n * Emitted before a column's pin position changes.\n *\n * @remarks\n * Cancellable — calling `preventDefault()` aborts the change.\n *\n * @event\n */\n columnPinning: CustomEvent<ApexColumnPinningEvent<T>>;\n /**\n * Emitted after a column's pin position change has been applied.\n *\n * @event\n */\n columnPinned: CustomEvent<ApexColumnPinnedEvent<T>>;\n /**\n * Emitted before a column is moved through the UI or {@link ApexGrid.moveColumn}.\n *\n * @remarks\n * Cancellable — calling `preventDefault()` aborts the move. The event detail\n * carries the source column key, its current array index, the target column\n * key and the drop position.\n *\n * @event\n */\n columnMoving: CustomEvent<ApexColumnMovingEvent<T>>;\n /**\n * Emitted after a column has been moved.\n *\n * @event\n */\n columnMoved: CustomEvent<ApexColumnMovedEvent<T>>;\n /**\n * Emitted before a cell value is committed.\n *\n * @remarks\n * Cancellable — `preventDefault()` rolls back the candidate value. In row\n * edit mode the event still fires per-cell at commit time.\n *\n * @event\n */\n cellValueChanging: CustomEvent<ApexCellValueChangingEvent<T>>;\n /**\n * Emitted after a cell value has been committed.\n *\n * @event\n */\n cellValueChanged: CustomEvent<ApexCellValueChangedEvent<T>>;\n /**\n * Emitted when a candidate cell value is rejected by one or more of the\n * column's {@link BaseColumnConfiguration.validators}. The value is not\n * written; in inline edit mode the editor stays open. Fires for single,\n * row-mode, and bulk (paste / fill) edits.\n *\n * @event\n */\n cellValidationFailed: CustomEvent<ApexCellValidationFailedEvent<T>>;\n /**\n * Emitted after the undo / redo stacks change (a recorded edit, an undo, a\n * redo, or a clear). Carries the current `canUndo` / `canRedo` so a toolbar\n * can enable or disable its buttons.\n *\n * @event\n */\n historyChanged: CustomEvent<ApexHistoryChangedEvent>;\n /**\n * Emitted (debounced, after the render pipeline settles) whenever the grid's\n * restorable state changes, carrying the new {@link ApexGrid.getState}\n * snapshot. The single signal for persistence (save the snapshot) or for\n * re-prompting an AI layer. The payload is only computed while at least one\n * `stateChanged` listener is attached, so it is zero-cost otherwise.\n *\n * @remarks\n * Fires for programmatic changes (including `setState`) as well as user\n * interaction. To avoid a save loop, compare the snapshot to your last-saved\n * one before persisting (identical snapshots never fire a second time).\n *\n * @event\n */\n stateChanged: CustomEvent<ApexStateChangedEvent>;\n /**\n * Emitted before a row is pinned, moved between bands, or unpinned.\n *\n * @remarks\n * Cancellable — `preventDefault()` aborts the change.\n *\n * @event\n */\n rowPinning: CustomEvent<ApexRowPinningEvent<T>>;\n /**\n * Emitted after a row's pin state has changed.\n *\n * @event\n */\n rowPinned: CustomEvent<ApexRowPinningEvent<T>>;\n /**\n * Emitted before a row is moved via drag, keyboard, or {@link ApexGrid.moveRow}.\n *\n * @remarks\n * Cancellable — `preventDefault()` aborts the move.\n *\n * @event\n */\n rowMoving: CustomEvent<ApexRowMovingEvent<T>>;\n /**\n * Emitted after a row has been moved.\n *\n * @event\n */\n rowMoved: CustomEvent<ApexRowMovingEvent<T>>;\n /**\n * Emitted when a row enters edit mode (row edit mode only).\n *\n * @event\n */\n rowEditStarted: CustomEvent<ApexRowEditStartedEvent>;\n /**\n * Emitted when a row leaves edit mode, with `committed` reporting whether\n * pending edits were applied (row edit mode only).\n *\n * @event\n */\n rowEditEnded: CustomEvent<ApexRowEditEndedEvent>;\n /**\n * Emitted before the tree-row expansion set changes.\n *\n * @remarks\n * Fires only when {@link ApexGrid.tree} is enabled and a row's tree\n * expansion is toggled (via the chevron, the public API, or\n * `expand-all/collapse-all`). Cancellable.\n *\n * @event\n */\n treeRowExpanding: CustomEvent<ApexTreeRowExpandingEvent<T>>;\n /**\n * Emitted after a tree-row expansion change has been applied.\n *\n * @event\n */\n treeRowExpanded: CustomEvent<ApexTreeRowExpandedEvent<T>>;\n /**\n * Emitted before the row expansion set changes.\n *\n * @remarks\n * Cancellable — calling `preventDefault()` aborts the change. Fires for\n * every expansion-mutating call (toggle, expand-all, programmatic\n * `expandedRows = ...`).\n *\n * @event\n */\n rowExpanding: CustomEvent<ApexRowExpandingEvent<T>>;\n /**\n * Emitted after a row-expansion change has been applied.\n *\n * @event\n */\n rowExpanded: CustomEvent<ApexRowExpandedEvent<T>>;\n /**\n * Emitted before the row selection set changes.\n *\n * @remarks\n * Cancellable — calling `preventDefault()` aborts the selection change.\n * Fires for every selection-mutating call (toggle, range select, select-all,\n * programmatic `selectedRows = ...`).\n *\n * @event\n */\n rowSelecting: CustomEvent<ApexRowSelectingEvent<T>>;\n /**\n * Emitted after a row-selection change has been applied.\n *\n * @event\n */\n rowSelected: CustomEvent<ApexRowSelectedEvent<T>>;\n}\n\n/**\n * Apex grid is a web component for displaying data in a tabular format quick and easy.\n *\n * Out of the box it provides row virtualization, sort and filter operations (client and server side),\n * the ability to template cells and headers and column hiding.\n *\n * @remarks\n * A working, styled grid requires three things:\n * 1. Register the element: `import 'apex-grid/define'` (or `ApexGrid.register()`).\n * 2. Give the host element a bounded height, e.g. `apex-grid { height: 480px }` —\n * the virtualizer collapses without one.\n * 3. Do NOT set `display` on the host — the component declares `:host { display: grid }`\n * internally and any override breaks the track layout.\n *\n * The grid is styled out of the box through `--ag-*` CSS custom properties —\n * there is no theme to import and no `configureTheme()` call. Override `--ag-*`\n * tokens on the host (or any ancestor) to rebrand; when `igniteui-webcomponents`\n * is present, the brand tokens auto-tint from its palette. For dark mode, set\n * the `theme=\"dark\"` attribute on the host for the built-in slate dark palette\n * (further `--ag-*` overrides still compose on top). Add `tinted` (e.g.\n * `theme=\"tinted\"` or `theme=\"dark tinted\"`) to mix the brand into the chrome\n * so the grid wears its brand even at rest. See the README \"Getting Started\"\n * and \"Theming\" sections for the full example and token list.\n *\n * @element apex-grid\n *\n * @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\"`.\n *\n * @fires sorting - Emitted when sorting is initiated through the UI.\n * @fires sorted - Emitted when a sort operation initiated through the UI has completed.\n * @fires filtering - Emitted when filtering is initiated through the UI.\n * @fires filtered - Emitted when a filter operation initiated through the UI has completed.\n * @fires pageChanging - Cancellable. Emitted before page/page-size changes are applied.\n * @fires pageChanged - Emitted after a page/page-size change has been applied.\n * @fires quickFilterChanging - Cancellable. Emitted before a quick-filter value is applied.\n * @fires quickFilterChanged - Emitted after a quick-filter change has been applied.\n * @fires columnPinning - Cancellable. Emitted before a column's pin position changes.\n * @fires columnPinned - Emitted after a column's pin position has changed.\n * @fires columnMoving - Cancellable. Emitted before a column is moved.\n * @fires columnMoved - Emitted after a column has been moved.\n * @fires cellValueChanging - Cancellable. Emitted before a cell value is committed.\n * @fires cellValueChanged - Emitted after a cell value has been committed.\n * @fires rowEditStarted - Emitted when a row enters edit mode (row mode only).\n * @fires rowEditEnded - Emitted when a row leaves edit mode (row mode only).\n * @fires rowSelecting - Cancellable. Emitted before a selection-set change is applied.\n * @fires rowSelected - Emitted after a selection-set change has been applied.\n * @fires rowExpanding - Cancellable. Emitted before the row-expansion set changes (master-detail).\n * @fires rowExpanded - Emitted after a row-expansion change has been applied.\n * @fires treeRowExpanding - Cancellable. Emitted before a tree-row expansion change (tree mode).\n * @fires treeRowExpanded - Emitted after a tree-row expansion change has been applied.\n *\n * @csspart live-region - Visually-hidden ARIA live region used for screen-reader announcements.\n *\n * @cssprop [--ag-brand] - Brand color for selection, focus rings, and accents. Auto-tints from `--ig-primary-500` when igniteui is present.\n * @cssprop [--ag-brand-strong] - Brand color for hover / pressed states.\n * @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.\n * @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.\n * @cssprop [--ag-surface] - Grid card background (must be opaque).\n * @cssprop [--ag-surface-alt] - Alternating row tint.\n * @cssprop [--ag-surface-elevated] - Header background.\n * @cssprop [--ag-hairline] - Header / structural gridline color.\n * @cssprop [--ag-border] - Row separator color.\n * @cssprop [--ag-text] - Primary text color.\n * @cssprop [--ag-text-body] - Row text color.\n * @cssprop [--ag-text-muted] - Muted text (roles, labels).\n * @cssprop [--ag-row-hover] - Row hover wash.\n * @cssprop [--ag-row-h] - Row height.\n * @cssprop [--ag-header-h] - Header height.\n * @cssprop [--ag-radius] - Outer card corner radius.\n * @cssprop [--ag-font] - Grid font family.\n * @cssprop [--ag-fs-cell] - Cell font size.\n *\n * @see {@link https://github.com/apexcharts/apex-grid/blob/main/packages/core/src/styles/_tokens.scss | _tokens.scss} for the complete `--ag-*` token list.\n */\n/** Known `setState` slice names, used to compute the `skipped` report. */\nconst SET_STATE_SLICES = [\n 'columns',\n 'sort',\n 'filter',\n 'quickFilter',\n 'modules',\n 'rowOrder',\n 'tree',\n 'expansion',\n 'rowPinning',\n 'selection',\n 'pagination',\n] as const;\n\nexport class ApexGrid<T extends object> extends EventEmitterBase<ApexGridEventMap<T>> {\n public static get tagName(): string {\n return GRID_TAG;\n }\n\n public static override styles = gridStyles;\n\n /**\n * Registers `<apex-grid>` and its internal dependencies with the custom-element\n * registry. Idempotent — safe to call more than once.\n *\n * @remarks\n * Registering the element is only step one of four required for a visible, styled\n * grid. You must also configure an Ignite UI theme + CSS, give the host a bounded\n * height, and avoid overriding `display` on the host. See the README\n * \"Getting Started\" section for the full setup.\n */\n public static register() {\n registerComponent(\n ApexGrid,\n ApexVirtualizer,\n ApexGridRow,\n ApexGridGroupHeaderRow,\n ApexGridHeaderRow,\n ApexFilterRow,\n ApexGridPaginator,\n ApexGridToolbar\n );\n }\n\n protected stateController = this.createStateController();\n protected DOM = new GridDOMController<T>(this, this.stateController);\n protected dataController = new DataOperationsController<T>(this);\n\n /**\n * Builds the grid's {@link StateController}. This is the single construction\n * site for `stateController` — overriding it (rather than re-declaring the\n * field) is the supported seam for derived grids to inject optional\n * {@link GridFeatureModule}s while preserving field-initializer ordering.\n * The community grid registers no extra modules.\n */\n protected createStateController(): StateController<T> {\n return new StateController<T>(this);\n }\n\n protected stateProvider = new ContextProvider(this, {\n context: gridStateContext,\n initialValue: this.stateController,\n });\n\n @query(ApexVirtualizer.tagName)\n protected scrollContainer!: ApexVirtualizer;\n\n @query(ApexGridHeaderRow.tagName)\n protected headerRow!: ApexGridHeaderRow<T>;\n\n @query(ApexFilterRow.tagName)\n protected filterRow!: ApexFilterRow<T>;\n\n @query(ApexGridPaginator.tagName)\n protected paginator!: ApexGridPaginator<T>;\n\n @query(ApexGridToolbar.tagName)\n protected toolbar!: ApexGridToolbar<T>;\n\n @state()\n protected dataState: Array<T> = [];\n\n @queryAll(ApexGridRow.tagName)\n protected _rows!: NodeListOf<ApexGridRow<T>>;\n\n /** Column configuration for the grid. */\n @property({ attribute: false })\n public columns: Array<ColumnConfiguration<T>> = [];\n\n /** The data source for the grid. */\n @property({ attribute: false })\n public data: Array<T> = [];\n\n /**\n * Optional stable row-identity resolver.\n *\n * @remarks\n * When provided, {@link ApexGrid.getState} captures selection / expansion /\n * tree rows by the returned id, so they survive a wholesale {@link ApexGrid.data}\n * reload. Without it those rows are captured by positional index into\n * {@link ApexGrid.data}, which round-trips within a session but not across a\n * data swap. The id must be unique per row and stable across reloads.\n */\n @property({ attribute: false })\n public rowId?: (row: T) => string | number;\n\n /**\n * Whether the grid will try to \"resolve\" its column configuration based on the passed\n * data source.\n *\n * @remarks\n * This is usually executed on initial rendering in the DOM. It depends on having an existing data source\n * to infer the column configuration for the grid.\n * Passing an empty data source or having a late bound data source (such as a HTTP request) will usually\n * result in empty column configuration for the grid.\n *\n * This property is ignored if any existing column configuration already exists in the grid.\n *\n * In a scenario where you want to bind a new data source and still keep the auto-generation behavior,\n * make sure to reset the column collection of the grid before passing in the new data source.\n *\n * @example\n * ```typescript\n * // assuming autoGenerate is set to true\n * grid.columns = [];\n * grid.data = [...];\n * ```\n *\n * @attr auto-generate\n */\n @property({ type: Boolean, attribute: 'auto-generate' })\n public autoGenerate = false;\n\n /** Sort configuration property for the grid. */\n @property({ attribute: false })\n public sortConfiguration: GridSortConfiguration = {\n multiple: true,\n triState: true,\n };\n\n /**\n * Configuration object which controls remote data operations for the grid.\n */\n @property({ attribute: false })\n public dataPipelineConfiguration!: DataPipelineConfiguration<T>;\n\n /**\n * Pagination configuration for the grid.\n *\n * @remarks\n * Pagination is disabled by default. Set `enabled: true` and (optionally) `pageSize`\n * to render the built-in `<apex-grid-paginator>` and slice the dataView. For\n * server-side pagination set `mode: 'remote'` and supply `totalItems`. The grid\n * emits the cancellable `pageChanging` event before applying a change and the\n * `pageChanged` event after the pipeline has run.\n *\n * @example\n * ```ts\n * grid.pagination = { enabled: true, pageSize: 25 };\n * grid.addEventListener('pageChanged', (event) => {\n * console.log('Now on page', event.detail.page, 'of', event.detail.pageCount);\n * });\n * ```\n */\n @property({ attribute: false })\n public pagination?: PaginationConfiguration;\n\n /**\n * The quick-filter (global search) value applied to the dataView.\n *\n * @remarks\n * When non-empty, the grid filters records whose visible-column values contain\n * the term (case-insensitive substring match). Customise by providing\n * {@link DataPipelineConfiguration.quickFilter}.\n *\n * @attr quick-filter\n */\n @property({ type: String, attribute: 'quick-filter' })\n public quickFilter = '';\n\n /**\n * Whether the built-in quick-filter input is rendered in the toolbar.\n *\n * @remarks\n * The {@link ApexGrid.quickFilter} value can be controlled programmatically\n * regardless of this flag; this only controls the toolbar input UI.\n *\n * @attr show-quick-filter\n */\n @property({ type: Boolean, attribute: 'show-quick-filter' })\n public showQuickFilter = false;\n\n /**\n * Whether the built-in export menu is rendered in the toolbar.\n *\n * @remarks\n * When `true`, the toolbar shows a download button on the trailing side;\n * clicking it opens a menu with one entry per {@link ApexGrid.exportFormats}\n * (CSV in the community grid) that calls {@link ApexGrid.exportAs}.\n * {@link ApexGrid.exportToCSV} remains callable programmatically regardless\n * of this flag.\n *\n * @attr show-export\n */\n @property({ type: Boolean, attribute: 'show-export' })\n public showExport = false;\n\n /**\n * Localization overrides for the grid's built-in UI text (pagination, filter\n * operators and controls, row/selection labels, the toolbar, and so on).\n *\n * @remarks\n * A (possibly partial) map of locale keys to translated strings. Any key you\n * omit falls back to the built-in English default, so partial maps are valid.\n * A ready-made Spanish dictionary ships as `esLocale`; community translations\n * are just plain objects of the same shape.\n *\n * @example\n * ```ts\n * import { esLocale } from '@apexcharts/grid';\n *\n * // Whole-UI translation:\n * grid.localeText = esLocale;\n *\n * // Or override a handful of strings:\n * grid.localeText = { 'toolbar.searchPlaceholder': 'Buscar productos…' };\n * ```\n */\n @property({ attribute: false })\n public localeText?: GridLocaleText;\n\n /**\n * Resolves a built-in locale key to its display string, applying any\n * {@link ApexGrid.localeText} override over the English default and\n * interpolating `{placeholder}` tokens from `params`.\n *\n * @remarks\n * Used internally by the grid's components. `fallback` is returned when the\n * key is not part of the built-in set (for example a custom filter operand's\n * own label).\n */\n public localize(key: GridLocaleKey, params?: LocaleParams, fallback?: string): string {\n return resolveLocaleText(this.localeText, key, params, fallback);\n }\n\n /**\n * Enables drag-and-drop column reordering on the column headers.\n *\n * @remarks\n * Per-column opt-out is available through {@link BaseColumnConfiguration.reorderable}.\n * Reordering is constrained to a column's own pinning group — start-pinned\n * columns can only swap with start-pinned, unpinned with unpinned, and\n * end-pinned with end-pinned.\n *\n * @attr column-reordering\n */\n @property({ type: Boolean, attribute: 'column-reordering' })\n public columnReordering = false;\n\n /**\n * Shows a persistent vertical divider on the trailing edge of every column\n * header, rather than only the frozen-column pin edges.\n *\n * @remarks\n * On by default. On columns that opt into resizing (via\n * {@link BaseColumnConfiguration.resizable}) the divider doubles as the\n * resize handle: it takes the `col-resize` cursor and can be dragged to\n * resize, so the always-visible line is also the grab target. On\n * non-resizable columns it is purely decorative.\n *\n * Because the default is `true`, hide the dividers by setting the property to\n * `false` (`grid.columnSeparator = false`); the reflected `column-separator`\n * attribute is then removed. The line's color and vertical inset are themeable\n * through the `--ag-header-separator` / `--header-separator-color` custom\n * properties and `--apex-header-separator-inset`.\n *\n * @attr column-separator\n */\n @property({ type: Boolean, attribute: 'column-separator', reflect: true })\n public columnSeparator = true;\n\n /**\n * Inline editing configuration for the grid.\n *\n * @remarks\n * Editing is disabled by default. Set `enabled: true` and (optionally) `mode`\n * (`'cell' | 'row'`) and `trigger` (`'click' | 'doubleClick'`) to opt in.\n * Per-column opt-in is required via {@link BaseColumnConfiguration.editable}.\n *\n * @example\n * ```ts\n * grid.editing = { enabled: true, mode: 'cell', trigger: 'doubleClick' };\n * ```\n */\n @property({ attribute: false })\n public editing?: GridEditingConfiguration;\n\n /**\n * Row selection configuration for the grid.\n *\n * @remarks\n * Selection is disabled by default. Set `enabled: true` and (optionally)\n * `mode` (`'single' | 'multiple'`) and `showCheckboxColumn` to opt in.\n *\n * @example\n * ```ts\n * grid.selection = { enabled: true, mode: 'multiple', showCheckboxColumn: true };\n * ```\n */\n @property({ attribute: false })\n public selection?: GridSelectionConfiguration;\n\n /**\n * The currently selected rows, in insertion order.\n *\n * @remarks\n * Returned as a plain array snapshot — mutating the returned array does\n * not change the grid's selection. Set this property to replace the\n * selection programmatically (goes through the cancellable\n * `rowSelecting` event).\n */\n public get selectedRows(): T[] {\n return this.stateController.selection.selectedRows();\n }\n\n public set selectedRows(rows: ReadonlyArray<T>) {\n void this.stateController.selection.replaceSelection(rows);\n }\n\n /**\n * Selects `row`, replacing the existing selection in `'single'` mode or\n * adding to it in `'multiple'` mode.\n *\n * @returns `true` if the selection changed, `false` if the change was\n * rejected by a `rowSelecting` listener or selection is disabled.\n */\n public selectRow(row: T): Promise<boolean> {\n return this.stateController.selection.selectRow(row);\n }\n\n /**\n * Deselects `row`. No-op if `row` is not currently selected.\n */\n public deselectRow(row: T): Promise<boolean> {\n return this.stateController.selection.deselectRow(row);\n }\n\n /**\n * Toggles selection of `row`.\n */\n public toggleRowSelection(row: T): Promise<boolean> {\n return this.stateController.selection.toggleRow(row);\n }\n\n /**\n * Selects every row in the current view ({@link dataView}). No-op in\n * `'single'` selection mode.\n */\n public selectAllRows(): Promise<boolean> {\n return this.stateController.selection.selectAll();\n }\n\n /**\n * Clears the row selection.\n */\n public clearSelection(): Promise<boolean> {\n return this.stateController.selection.clear();\n }\n\n /**\n * Whether `row` is currently selected.\n */\n public isRowSelected(row: T): boolean {\n return this.stateController.selection.isSelected(row);\n }\n\n /**\n * Row-expansion (master-detail) configuration for the grid.\n *\n * @remarks\n * Expansion is disabled by default. Set `enabled: true` and supply a\n * `detailTemplate` to opt in. The default UX renders a chevron toggle in a\n * dedicated leading column; set `showToggleColumn: false` to drive\n * expansion entirely through the public API or a custom cell template.\n *\n * @example\n * ```ts\n * grid.expansion = {\n * enabled: true,\n * detailTemplate: ({ data }) => html`<order-summary .order=${data}></order-summary>`,\n * };\n * ```\n */\n @property({ attribute: false })\n public expansion?: GridExpansionConfiguration<T>;\n\n /**\n * Row-pinning configuration.\n *\n * @remarks\n * Disabled by default. Set `enabled: true` to allow pinning rows to a sticky\n * top / bottom band via {@link ApexGrid.pinRow}.\n *\n * @example\n * ```ts\n * grid.rowPinning = { enabled: true };\n * grid.pinRow(grid.data[0], 'top');\n * ```\n */\n @property({ attribute: false })\n public rowPinning?: GridRowPinningConfiguration;\n\n /**\n * Row-reordering configuration.\n *\n * @remarks\n * Disabled by default. Set `enabled: true` to allow drag / keyboard reorder\n * and {@link ApexGrid.moveRow}. A manual order is mutually exclusive with\n * column sorting (applying a sort clears it). Set `applyToData: true` to also\n * splice {@link ApexGrid.data} in place.\n *\n * @example\n * ```ts\n * grid.rowReordering = { enabled: true };\n * ```\n */\n @property({ attribute: false })\n public rowReordering?: GridRowReorderingConfiguration;\n\n /**\n * Transient spreadsheet coordinate hints: when `true`, a leading row-number\n * gutter (1, 2, 3, ...) and A / B / C column letters are revealed so cell\n * references are discoverable. Enterprise toggles this while a formula cell is\n * being edited; it can also be set directly for a persistent spreadsheet look.\n * Reflected so styling / tests can observe it on the host.\n */\n @property({ type: Boolean, reflect: true, attribute: 'coordinate-hints' })\n public coordinateHints = false;\n\n /**\n * Whether column headers show the column-menu (kebab) button. On by default,\n * and the button is always visible (not hover-only). Set to `false` to hide it\n * entirely; a feature module's menu (e.g. the enterprise context menu) stays\n * reachable by right-click. This is a JS property (no attribute) so it can\n * stay `true` by default.\n */\n @property({ attribute: false })\n public columnMenu = true;\n\n /**\n * Column groups rendered as spanning headers above the column header row.\n *\n * @remarks\n * A column joins a group via its {@link BaseColumnConfiguration.group} id.\n * Members must be contiguous within one pin region. `columns` stays flat — all\n * width / pin / resize / reorder machinery is unchanged; grouping is a\n * presentational header layer. v1 ships static spanning headers (no collapse).\n *\n * @example\n * ```ts\n * grid.columnGroups = [{ id: 'name', headerText: 'Name' }];\n * grid.columns = [{ key: 'first', group: 'name' }, { key: 'last', group: 'name' }];\n * ```\n */\n @property({ attribute: false })\n public columnGroups?: ColumnGroupConfiguration[];\n\n /**\n * Whether a group header row should render: at least one configured group has\n * a visible member column.\n */\n public get hasColumnGroups(): boolean {\n if (!this.columnGroups?.length) return false;\n const ids = new Set(this.columnGroups.map((group) => group.id));\n return this.columns.some((column) => !column.hidden && column.group && ids.has(column.group));\n }\n\n /**\n * Number of group header rows above the column header (0 or 1 in v1).\n */\n public get columnGroupDepth(): number {\n return this.hasColumnGroups ? 1 : 0;\n }\n\n /**\n * The currently expanded rows, in insertion order.\n *\n * @remarks\n * Returned as a plain array snapshot — mutating the returned array does\n * not change the grid's expansion state. Set this property to replace the\n * expansion set programmatically (goes through the cancellable\n * `rowExpanding` event).\n */\n public get expandedRows(): T[] {\n return this.stateController.expansion.expandedRows();\n }\n\n public set expandedRows(rows: ReadonlyArray<T>) {\n void this.stateController.expansion.replaceExpansion(rows);\n }\n\n /**\n * Expands `row`. No-op when the row is already expanded, expansion is\n * disabled, or the optional `isExpandable` predicate rejects it.\n */\n public expandRow(row: T): Promise<boolean> {\n return this.stateController.expansion.expandRow(row);\n }\n\n /**\n * Collapses `row`. No-op when the row is not currently expanded.\n */\n public collapseRow(row: T): Promise<boolean> {\n return this.stateController.expansion.collapseRow(row);\n }\n\n /**\n * Toggles expansion of `row`.\n */\n public toggleRowExpansion(row: T): Promise<boolean> {\n return this.stateController.expansion.toggleRow(row);\n }\n\n /**\n * Expands every row in {@link ApexGrid.dataView} that passes the optional\n * `isExpandable` predicate.\n */\n public expandAllRows(): Promise<boolean> {\n return this.stateController.expansion.expandAll();\n }\n\n /**\n * Collapses every currently expanded row.\n */\n public collapseAllRows(): Promise<boolean> {\n return this.stateController.expansion.collapseAll();\n }\n\n /**\n * Whether `row` is currently expanded.\n */\n public isRowExpanded(row: T): boolean {\n return this.stateController.expansion.isExpanded(row);\n }\n\n /**\n * Tree-data (nested rows) configuration for the grid.\n *\n * @remarks\n * Tree mode keeps {@link ApexGrid.data} flat; the grid derives the\n * hierarchy from a user-supplied `getDataPath(row)` callback (the\n * flat-array \"tree data\" pattern). When enabled, the first visible data column (or\n * the column referenced by `groupColumnKey`) renders a chevron toggle\n * and depth-based indentation.\n *\n * @example\n * ```ts\n * grid.tree = {\n * enabled: true,\n * getDataPath: (row) => row.path, // e.g., ['Adrian'], ['Adrian', 'Bryan']\n * defaultExpanded: true,\n * };\n * ```\n */\n @property({ attribute: false })\n public tree?: GridTreeConfiguration<T>;\n\n /**\n * Toggles tree-expansion of `row`. No-op when tree mode is disabled or\n * the row has no children.\n */\n public toggleTreeRow(row: T): Promise<boolean> {\n return this.stateController.tree.toggleRow(row);\n }\n\n /**\n * Expands a tree row. No-op when the row is already expanded, has no\n * children, or tree mode is disabled.\n */\n public expandTreeRow(row: T): Promise<boolean> {\n return this.stateController.tree.expandRow(row);\n }\n\n /**\n * Collapses a tree row. No-op when the row is not currently expanded.\n */\n public collapseTreeRow(row: T): Promise<boolean> {\n return this.stateController.tree.collapseRow(row);\n }\n\n /** Expands every parent row in the current tree. */\n public expandAllTreeRows(): Promise<boolean> {\n return this.stateController.tree.expandAll();\n }\n\n /** Collapses every currently-expanded tree row. */\n public collapseAllTreeRows(): Promise<boolean> {\n return this.stateController.tree.collapseAll();\n }\n\n /** Whether `row` is currently expanded in the tree. */\n public isTreeRowExpanded(row: T): boolean {\n return this.stateController.tree.isExpanded(row);\n }\n\n /**\n * Set the sort state for the grid.\n */\n public set sortExpressions(expressions: SortExpression<T>[]) {\n if (expressions.length) {\n this.sort(expressions);\n }\n }\n\n /**\n * Get the sort state for the grid.\n */\n @property({ attribute: false })\n public get sortExpressions(): SortExpression<T>[] {\n return Array.from(this.stateController.sorting.state.values());\n }\n\n /**\n * Set the filter state for the grid.\n */\n public set filterExpressions(expressions: FilterExpression<T>[]) {\n if (expressions.length) {\n this.filter(expressions);\n }\n }\n\n /**\n * Get the filter state for the grid.\n */\n @property({ attribute: false })\n public get filterExpressions(): FilterExpression<T>[] {\n const expressions: FilterExpression<T>[] = [];\n\n for (const each of this.stateController.filtering.state.values) {\n expressions.push(...each.all);\n }\n\n return expressions;\n }\n\n /**\n * Returns the collection of rendered row elements in the grid.\n *\n * @remarks\n * Since the grid has virtualization, this property returns only the currently rendered\n * chunk of elements in the DOM.\n */\n public get rows() {\n return Array.from(this._rows);\n }\n\n /**\n * Returns the state of the data source after sort/filter operations\n * have been applied.\n */\n public get dataView(): ReadonlyArray<T> {\n return this.dataState;\n }\n\n /**\n * The columns in visual render order: `'start'`-pinned columns first, then\n * unpinned columns, then `'end'`-pinned columns.\n *\n * @remarks\n * Use this when you need to iterate the columns in the same order the grid\n * actually displays them (for example to build a column chooser). Public APIs\n * like {@link ApexGrid.getColumn} continue to operate on the user-supplied\n * {@link ApexGrid.columns} array.\n */\n public get displayColumns(): ReadonlyArray<ColumnConfiguration<T>> {\n return getDisplayColumns(this.columns);\n }\n\n /**\n * The total number of items in the {@link ApexGrid.dataView} collection.\n *\n * @remarks\n * This is always the post-filter, post-sort row count — pagination does not change it.\n * Use {@link ApexGrid.pageItems} to read the rows currently rendered into the body.\n */\n public get totalItems() {\n if (this.pagination?.mode === 'remote') {\n return Math.max(0, this.pagination?.totalItems ?? 0);\n }\n return this.dataState.length;\n }\n\n /**\n * The records currently rendered into the virtualized body.\n *\n * @remarks\n * Equal to {@link ApexGrid.dataView} when pagination is disabled. With pagination\n * enabled (`'local'` mode) this is the active page slice.\n */\n public get pageItems(): ReadonlyArray<T> {\n // Pinned rows are lifted out of the scrollable body and rendered in their\n // own sticky bands, so they're excluded here to avoid duplication. The\n // exclusion happens before pagination so a pinned row never consumes a body\n // page slot.\n const rowPin = this.stateController.rowPin;\n const base =\n rowPin?.enabled && rowPin.hasPinnedRows\n ? this.dataState.filter((row) => !rowPin.isPinned(row))\n : this.dataState;\n if (!this.stateController.pagination.enabled) return base;\n if (this.pagination?.mode === 'remote') return base;\n const { page, pageSize } = this.stateController.pagination;\n if (!pageSize) return base;\n const start = page * pageSize;\n return base.slice(start, start + pageSize);\n }\n\n /**\n * The current zero-based page index.\n */\n @property({ attribute: false })\n public get page(): number {\n return this.stateController.pagination.page;\n }\n\n public set page(value: number) {\n this.stateController.pagination.gotoPage(value);\n }\n\n /**\n * The current page size.\n */\n @property({ attribute: false })\n public get pageSize(): number {\n return this.stateController.pagination.pageSize;\n }\n\n public set pageSize(value: number) {\n this.stateController.pagination.setPageSize(value);\n }\n\n /**\n * The total number of pages computed from {@link ApexGrid.totalItems} and {@link ApexGrid.pageSize}.\n */\n public get pageCount(): number {\n return this.stateController.pagination.pageCount;\n }\n\n @watch('columns')\n protected watchColumns(_: ColumnConfiguration<T>[], newConfig: ColumnConfiguration<T>[] = []) {\n this.columns = newConfig.map((config) => ({ ...DEFAULT_COLUMN_CONFIG, ...config }));\n }\n\n @watch('data')\n protected dataChanged() {\n // Shallow copy of the array — items keep reference equality with\n // `this.data` so cell edits can write through to the source record.\n let next: T[] = [...this.data];\n autoGenerateColumns(this);\n // Tree controller needs to re-apply `defaultExpanded` against the new\n // record set when data is swapped wholesale.\n this.stateController?.tree?.resetForDataChange();\n // Tree mode applies its flatten step synchronously here so the first\n // paint shows the right shape. Sort/filter/quickFilter still run via\n // the async pipeline on subsequent updates — they take this dataState\n // as input and re-apply tree at the end. Running tree both here and\n // inside the pipeline is idempotent because `process` is pure.\n if (this.stateController?.tree?.enabled) {\n next = this.stateController.tree.process(next);\n }\n // Run any feature-module row transforms (e.g. enterprise grouping) so\n // injected rows appear on first paint, not only after the async pipeline.\n // Identity pass-through when no modules are registered (community grid).\n this.dataState = this.stateController ? this.stateController.applyModuleTransforms(next) : next;\n if (this.hasUpdated) {\n this.pipeline();\n }\n }\n\n @watch(PIPELINE)\n protected async pipeline() {\n this.dataState = await this.dataController.apply([...this.data], this.stateController);\n this.stateController.pagination.reclamp();\n }\n\n @watch('pagination')\n protected paginationChanged() {\n const ctrl = this.stateController?.pagination;\n if (!ctrl) return;\n const next = this.pagination ?? {};\n if (typeof next.pageSize === 'number' && next.pageSize > 0) {\n ctrl.pageSize = next.pageSize;\n }\n if (typeof next.page === 'number') {\n ctrl.page = next.page;\n }\n if (this.hasUpdated) {\n this.pipeline();\n }\n }\n\n @watch('quickFilter')\n protected quickFilterChanged() {\n if (this.hasUpdated) {\n this.pipeline();\n }\n }\n\n protected override updated(): void {\n // Expose ARIA grid semantics on the host so screen readers announce the\n // structure correctly. We do this in `updated()` (post-render) rather\n // than `willUpdate()` because `@watch('data')` runs *after* the original\n // willUpdate via decorator wrapping — reading `pageItems` earlier would\n // see a stale (empty) `dataState`.\n this.setAttribute('role', this.stateController.tree.enabled ? 'treegrid' : 'grid');\n const pinned = this.stateController.rowPin.pinnedRows;\n this.setAttribute(\n 'aria-rowcount',\n String(this.headerRowCount + pinned.top.length + this.pageItems.length + pinned.bottom.length)\n );\n const visibleColumns = this.columns.filter((column) => !column.hidden).length;\n const extras =\n (this.stateController.selection.showCheckboxColumn ? 1 : 0) +\n (this.stateController.expansion.showToggleColumn ? 1 : 0);\n this.setAttribute('aria-colcount', String(visibleColumns + extras));\n\n this.#emitStateChangedIfNeeded();\n }\n\n /**\n * Listener count for `stateChanged`, so the (potentially non-trivial) snapshot\n * is only computed while something is actually listening.\n */\n #stateChangedListeners = 0;\n /** Serialized last-emitted state, to fire `stateChanged` only on real changes. */\n #lastStateJson: string | null = null;\n\n public override addEventListener<\n K extends keyof M,\n M extends ApexGridEventMap<T> & HTMLElementEventMap,\n >(\n type: K,\n listener: (this: HTMLElement, ev: M[K]) => unknown,\n options?: boolean | AddEventListenerOptions\n ): void;\n public override addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions\n ): void {\n if (type === 'stateChanged') {\n this.#stateChangedListeners += 1;\n // Baseline at subscription time so the next real change is the first emit.\n this.#lastStateJson = this.hasUpdated ? JSON.stringify(this.getState()) : null;\n }\n (\n super.addEventListener as (\n t: string,\n l: EventListenerOrEventListenerObject,\n o?: boolean | AddEventListenerOptions\n ) => void\n )(type, listener, options);\n }\n\n public override removeEventListener<\n K extends keyof M,\n M extends ApexGridEventMap<T> & HTMLElementEventMap,\n >(\n type: K,\n listener: (this: HTMLElement, ev: M[K]) => unknown,\n options?: boolean | EventListenerOptions\n ): void;\n public override removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions\n ): void {\n if (type === 'stateChanged') {\n this.#stateChangedListeners = Math.max(0, this.#stateChangedListeners - 1);\n }\n (\n super.removeEventListener as (\n t: string,\n l: EventListenerOrEventListenerObject,\n o?: boolean | EventListenerOptions\n ) => void\n )(type, listener, options);\n }\n\n /**\n * Emit `stateChanged` when the restorable state differs from the last emitted\n * snapshot. No-op (and no snapshot computed) when nothing is listening. Called\n * from `updated()`, so the snapshot reflects the settled post-pipeline view.\n */\n #emitStateChangedIfNeeded(): void {\n if (this.#stateChangedListeners === 0) return;\n const snapshot = this.getState();\n const json = JSON.stringify(snapshot);\n if (json === this.#lastStateJson) return;\n this.#lastStateJson = json;\n this.emitEvent('stateChanged', { detail: { state: snapshot } });\n }\n\n protected override firstUpdated(): void {\n // The component declares `:host { display: grid }` for its internal track\n // layout (header / filter / virtualized body). If a consumer rule overrides\n // it, the virtualizer collapses and only a few rows render. Warn loudly so\n // the failure mode isn't silent.\n if (typeof getComputedStyle === 'function' && getComputedStyle(this).display !== 'grid') {\n // biome-ignore lint/suspicious/noConsole: intentional one-shot user diagnostic\n console.warn(\n '[apex-grid] Host `display` has been overridden. The grid requires ' +\n '`display: grid` for its internal track layout and will not render correctly. ' +\n 'Remove any CSS rule that sets `display` on <apex-grid>. ' +\n 'See: https://github.com/apexcharts/apexgrid#4-size-the-host'\n );\n }\n }\n\n /**\n * Performs a filter operation in the grid based on the passed expression(s).\n */\n public filter(config: FilterExpression<T> | FilterExpression<T>[]) {\n this.stateController.filtering.filter(\n asArray(config).map((each) =>\n typeof each.condition === 'string'\n ? // XXX: Types\n Object.assign(each, {\n condition: (getFilterOperandsFor(this.getColumn(each.key)!) as any)[each.condition],\n })\n : each\n )\n );\n }\n\n /**\n * Performs a sort operation in the grid based on the passed expression(s).\n */\n public sort(expressions: SortExpression<T> | SortExpression<T>[]) {\n this.stateController.sorting.sort(expressions);\n }\n\n /**\n * Returns a serializable, JSON-safe snapshot of the grid's restorable state:\n * column layout, sort, filter, quick-filter, pagination, selection, expansion,\n * tree expansion, and any feature-module state. Functions and templates are\n * omitted (see {@link GridState}).\n *\n * @remarks\n * Pair with {@link ApexGrid.setState} to persist/restore views, drive an AI\n * assistant, or implement save/restore. Set {@link ApexGrid.rowId} for\n * selection/expansion to survive a wholesale data reload.\n *\n * @example\n * ```ts\n * const snapshot = grid.getState();\n * localStorage.setItem('grid', JSON.stringify(snapshot));\n * // later …\n * grid.setState(JSON.parse(localStorage.getItem('grid')!));\n * ```\n */\n public getState(options?: GetStateOptions<T>): GridState {\n const rowId = options?.rowId ?? this.rowId;\n const pinned = this.stateController.rowPin.pinnedRows;\n const manualOrder = this.stateController.rowReorder.getManualOrder();\n return {\n version: 1,\n columns: serializeColumnLayout(this.columns),\n sort: serializeSort(this.sortExpressions),\n filter: serializeFilter(this.filterExpressions),\n quickFilter: this.quickFilter,\n pagination: { page: this.page, pageSize: this.pageSize },\n selection: serializeRowRefs(this.selectedRows, this.data, rowId),\n expansion: serializeRowRefs(this.expandedRows, this.data, rowId),\n treeExpanded: serializeRowRefs([...this.stateController.tree.expanded], this.data, rowId),\n treeExpandedKeys: [...this.stateController.tree.expandedKeys],\n rowPinning: {\n top: serializeRowRefs(pinned.top, this.data, rowId),\n bottom: serializeRowRefs(pinned.bottom, this.data, rowId),\n },\n rowOrder: manualOrder ? serializeRowRefs(manualOrder, this.data, rowId) : null,\n modules: this.stateController.serializeModuleState(),\n };\n }\n\n /**\n * A machine-readable description of the grid: its columns and data types, the\n * operations available per column (sort directions, filter operands), the\n * grid-level capabilities, and the current {@link ApexGrid.getState} snapshot.\n *\n * @remarks\n * This is the contract an AI layer hands to an LLM (to constrain its output)\n * and validates a returned patch against before {@link ApexGrid.setState}, but\n * it is AI-agnostic: it equally drives a view-editor UI or documentation. It is\n * a descriptor, not a JSON-Schema document. The enterprise grid extends it with\n * grouping / pivot / aggregation availability.\n */\n public getSchema(): GridSchema {\n return {\n version: 1,\n columns: this.columns.map((column) => columnSchema(column)),\n capabilities: {\n sort: {\n directions: ['ascending', 'descending'],\n multi: Boolean(this.sortConfiguration?.multiple),\n },\n filter: { operandsByType: operandsByType(this.columns) },\n pagination: Boolean(this.pagination?.enabled),\n selection: this.selection?.enabled ? (this.selection.mode ?? 'multiple') : false,\n rowPinning: Boolean(this.rowPinning?.enabled),\n rowReordering: Boolean(this.rowReordering?.enabled),\n },\n state: this.getState(),\n };\n }\n\n /**\n * Applies a (partial) state snapshot produced by {@link ApexGrid.getState}.\n *\n * @remarks\n * Only the slices present on `state` are applied — omit a slice to leave it\n * untouched (e.g. pass `{ sort }` to change only sorting). A present-but-empty\n * `sort`/`filter` array clears that operation. Slices are applied in dependency\n * order (columns → sort → filter → quick-filter → module structure → row order\n * → tree → expansion → row pinning → selection → pagination) so row-referencing\n * state resolves against the transformed view. `rowOrder` is mutually exclusive\n * with an active `sort`: a snapshot carrying both keeps the sort and drops\n * `rowOrder`.\n *\n * **Defensive by design.** `setState` is written into by persisted blobs and\n * LLM output, so it never throws on malformed input (unless\n * {@link SetStateOptions.strict}): unknown columns / operands, out-of-range\n * pages, unresolvable rows, and wrong-typed slices are dropped, clamped, or\n * skipped, each recorded in the returned {@link SetStateResult}.\n */\n public setState(state: Partial<GridState>, options?: SetStateOptions<T>): SetStateResult {\n const rowId = options?.rowId ?? this.rowId;\n const strict = options?.strict ?? false;\n const applied: string[] = [];\n const warnings: string[] = [];\n const warn = (message: string): void => {\n if (strict) throw new Error(`[apex-grid] setState: ${message}`);\n warnings.push(message);\n };\n\n // Defensive accessors: a wrong-typed slice is skipped with a warning rather\n // than throwing mid-apply.\n const asArray = <V>(value: unknown, label: string): V[] | null => {\n if (value === undefined) return null;\n if (!Array.isArray(value)) {\n warn(`${label}: expected an array, got ${typeof value}; skipped`);\n return null;\n }\n return value as V[];\n };\n const resolveCounted = (refs: ReadonlyArray<RowRef>, label: string): T[] => {\n const rows = resolveRowRefs(refs, this.data, rowId);\n if (rows.length < refs.length) {\n warn(\n `${label}: ${refs.length - rows.length} of ${refs.length} row(s) could not be resolved`\n );\n }\n return rows;\n };\n\n if (state.version !== undefined && state.version !== 1) {\n warn(\n `unsupported snapshot version ${String(state.version)}; applying recognized slices best-effort`\n );\n }\n\n const columns = asArray<ColumnLayoutState>(state.columns, 'columns');\n if (columns) {\n this.columns = applyColumnLayout(this.columns, columns);\n applied.push('columns');\n }\n\n const sort = asArray<SortStateSnapshot>(state.sort, 'sort');\n if (sort) {\n this.stateController.sorting.reset();\n const valid: SortStateSnapshot[] = [];\n for (const entry of sort) {\n if (this.getColumn(entry.key as Keys<T>)) {\n valid.push(entry);\n } else {\n warn(`sort: unknown column \"${entry.key}\"; dropped`);\n }\n }\n if (valid.length) this.sort(valid as unknown as SortExpression<T>[]);\n applied.push('sort');\n }\n\n const filter = asArray<GridState['filter'][number]>(state.filter, 'filter');\n if (filter) {\n this.stateController.filtering.reset();\n const expressions = deserializeFilter<T>(\n filter,\n (key) => this.getColumn(key as Keys<T>),\n (snapshot, reason) => warn(`filter: \"${snapshot.key}\" dropped (${reason})`)\n );\n if (expressions.length) this.filter(expressions);\n applied.push('filter');\n }\n\n if (state.quickFilter !== undefined) {\n if (typeof state.quickFilter === 'string') {\n this.quickFilter = state.quickFilter;\n applied.push('quickFilter');\n } else {\n warn(`quickFilter: expected a string, got ${typeof state.quickFilter}; skipped`);\n }\n }\n\n // Module structure (e.g. grouping / pivot) before the row-referencing slices,\n // so the transformed view exists when selection / expansion are resolved.\n if (state.modules !== undefined) {\n if (state.modules && typeof state.modules === 'object') {\n this.stateController.restoreModuleState(state.modules);\n applied.push('modules');\n } else {\n warn(`modules: expected an object, got ${typeof state.modules}; skipped`);\n }\n }\n\n // Manual row order, applied after sort so the conflict is resolvable here:\n // a manual order is mutually exclusive with sorting, so drop it when the\n // restored state also carries an active sort (the sort wins).\n if (state.rowOrder !== undefined) {\n if (state.rowOrder === null) {\n this.stateController.rowReorder.restoreManualOrder(null);\n applied.push('rowOrder');\n } else {\n const order = asArray<RowRef>(state.rowOrder, 'rowOrder');\n if (order) {\n if (this.sortExpressions.length) {\n warn('rowOrder dropped: a manual order is mutually exclusive with an active sort');\n } else {\n this.stateController.rowReorder.restoreManualOrder(resolveCounted(order, 'rowOrder'));\n }\n applied.push('rowOrder');\n }\n }\n }\n\n if (state.treeExpanded !== undefined || state.treeExpandedKeys !== undefined) {\n const refs = asArray<RowRef>(state.treeExpanded, 'treeExpanded') ?? [];\n const keys = asArray<string>(state.treeExpandedKeys, 'treeExpandedKeys') ?? [];\n this.stateController.tree.restoreExpansion(resolveCounted(refs, 'treeExpanded'), keys);\n applied.push('tree');\n }\n\n const expansion = asArray<RowRef>(state.expansion, 'expansion');\n if (expansion) {\n this.expandedRows = resolveCounted(expansion, 'expansion');\n applied.push('expansion');\n }\n\n if (state.rowPinning !== undefined) {\n const pinning = state.rowPinning;\n if (pinning && typeof pinning === 'object') {\n this.stateController.rowPin.restore(\n resolveCounted(asArray<RowRef>(pinning.top, 'rowPinning.top') ?? [], 'rowPinning.top'),\n resolveCounted(\n asArray<RowRef>(pinning.bottom, 'rowPinning.bottom') ?? [],\n 'rowPinning.bottom'\n )\n );\n applied.push('rowPinning');\n } else {\n warn(`rowPinning: expected an object, got ${typeof pinning}; skipped`);\n }\n }\n\n const selection = asArray<RowRef>(state.selection, 'selection');\n if (selection) {\n this.selectedRows = resolveCounted(selection, 'selection');\n applied.push('selection');\n }\n\n if (state.pagination !== undefined) {\n const pagination = state.pagination;\n if (pagination && typeof pagination === 'object') {\n const { page, pageSize } = pagination;\n if (pageSize !== undefined) {\n if (typeof pageSize === 'number' && Number.isFinite(pageSize) && pageSize > 0) {\n this.pageSize = pageSize;\n } else {\n warn(`pagination: invalid pageSize ${String(pageSize)}; ignored`);\n }\n }\n if (page !== undefined) {\n if (typeof page === 'number' && Number.isFinite(page)) {\n const requested = Math.trunc(page);\n this.page = requested;\n if (this.page !== requested) {\n warn(`pagination: page ${requested} out of range; clamped to ${this.page}`);\n }\n } else {\n warn(`pagination: invalid page ${String(page)}; ignored`);\n }\n }\n applied.push('pagination');\n } else {\n warn(`pagination: expected an object, got ${typeof pagination}; skipped`);\n }\n }\n\n this.requestUpdate(PIPELINE);\n\n const skipped = SET_STATE_SLICES.filter((slice) => !applied.includes(slice));\n return { applied, skipped, warnings };\n }\n\n /**\n * Resets the current sort state of the control.\n */\n public clearSort(key?: Keys<T>) {\n this.stateController.sorting.reset(key);\n this.requestUpdate(PIPELINE);\n }\n\n /**\n * Resets the current filter state of the control.\n */\n public clearFilter(key?: Keys<T>) {\n this.stateController.filtering.reset(key);\n this.requestUpdate(PIPELINE);\n }\n\n /**\n * Navigates the grid to the given zero-based `page` index.\n *\n * @remarks\n * Emits the cancellable `pageChanging` event before applying the change and the\n * `pageChanged` event after. Out-of-range values are clamped into `[0, pageCount - 1]`.\n *\n * @param page - The target zero-based page index.\n * @returns `true` if the change was applied, `false` if cancelled or a no-op.\n *\n * @example\n * ```ts\n * await grid.gotoPage(2);\n * ```\n */\n public gotoPage(page: number): Promise<boolean> {\n return this.stateController.pagination.gotoPage(page);\n }\n\n /**\n * Updates the grid's page size and returns to the first page.\n *\n * @remarks\n * Emits the cancellable `pageChanging` event before applying the change and the\n * `pageChanged` event after.\n *\n * @param size - The new page size (must be a positive integer).\n * @returns `true` if the change was applied, `false` if cancelled or a no-op.\n */\n public setPageSize(size: number): Promise<boolean> {\n return this.stateController.pagination.setPageSize(size);\n }\n\n /**\n * Navigates to the next page. No-op if already on the last page.\n */\n public nextPage() {\n return this.stateController.pagination.nextPage();\n }\n\n /**\n * Navigates to the previous page. No-op if already on the first page.\n */\n public previousPage() {\n return this.stateController.pagination.previousPage();\n }\n\n /**\n * Navigates to the first page.\n */\n public firstPage() {\n return this.stateController.pagination.firstPage();\n }\n\n /**\n * Navigates to the last page.\n */\n public lastPage() {\n return this.stateController.pagination.lastPage();\n }\n\n /**\n * Applies a new quick-filter (global search) value, emitting the cancellable\n * `quickFilterChanging` event first and the `quickFilterChanged` event after the\n * pipeline has run.\n *\n * @param value - The new quick-filter value. Pass `''` to clear.\n * @returns `true` if the change was applied, `false` if cancelled or a no-op.\n *\n * @example\n * ```ts\n * await grid.setQuickFilter('john');\n * ```\n */\n public async setQuickFilter(value: string): Promise<boolean> {\n const next = value ?? '';\n if (next === this.quickFilter) return false;\n\n const proceed = this.emitEvent('quickFilterChanging', {\n detail: { value: this.quickFilter, nextValue: next },\n cancelable: true,\n });\n if (!proceed) return false;\n\n this.quickFilter = next;\n this.stateController.pagination.page = 0;\n await this.updateComplete;\n this.emitEvent('quickFilterChanged', { detail: { value: this.quickFilter } });\n return true;\n }\n\n /**\n * Returns a {@link ColumnConfiguration} for a given column.\n */\n public getColumn(id: Keys<T> | number) {\n return typeof id === 'number'\n ? this.columns.at(id)\n : this.columns.find(({ key }) => key === id);\n }\n\n /**\n * Updates the column configuration of the grid.\n *\n * @remarks\n * Each updated column is replaced with a fresh object reference so that cells\n * and headers re-render with the new template / configuration. The\n * user-supplied `columns` array is also reassigned for Lit reactivity.\n */\n public updateColumns(columns: ColumnConfiguration<T> | ColumnConfiguration<T>[]) {\n const updates = new Map(asArray(columns).map((c) => [c.key, c]));\n if (updates.size === 0) return;\n\n let touched = false;\n const next = this.columns.map((column) => {\n const patch = updates.get(column.key);\n if (!patch) return column;\n touched = true;\n return { ...column, ...patch };\n });\n\n if (!touched) return;\n this.columns = next;\n this.requestUpdate(PIPELINE);\n }\n\n /**\n * Pins a column to one of the grid's edges, or unpins it when `position` is `null`.\n *\n * @remarks\n * Emits the cancellable `columnPinning` event first and the `columnPinned`\n * event after the update is applied. The user-supplied {@link ApexGrid.columns}\n * array is not reordered — only the visual render order changes.\n *\n * @param key - The target column key.\n * @param position - `'start'`, `'end'`, or `null` to unpin.\n * @returns `true` if the change was applied, `false` if cancelled or a no-op.\n *\n * @example\n * ```ts\n * await grid.pinColumn('name', 'start');\n * await grid.pinColumn('actions', 'end');\n * ```\n */\n public async pinColumn(key: Keys<T>, position: PinPosition): Promise<boolean> {\n const column = this.getColumn(key);\n if (!column) return false;\n\n const previous = column.pinned ?? null;\n const next = position ?? null;\n if (previous === next) return false;\n\n const proceed = this.emitEvent('columnPinning', {\n detail: { key, previous, next },\n cancelable: true,\n });\n if (!proceed) return false;\n\n column.pinned = next ?? undefined;\n this.columns = [...this.columns];\n await this.updateComplete;\n this.emitEvent('columnPinned', { detail: { key, pinned: next } });\n return true;\n }\n\n /**\n * Unpins a column. Equivalent to {@link ApexGrid.pinColumn}(`key`, `null`).\n *\n * @param key - The target column key.\n * @returns `true` if the change was applied, `false` if the column was already\n * unpinned or the operation was cancelled.\n */\n public unpinColumn(key: Keys<T>): Promise<boolean> {\n return this.pinColumn(key, null);\n }\n\n /**\n * The cell currently in edit mode, or `null`.\n */\n public get editingCell(): { rowIndex: number; columnKey: Keys<T> } | null {\n const active = this.stateController.editing.activeCell;\n return active ? { rowIndex: active.rowIndex, columnKey: active.columnKey } : null;\n }\n\n /**\n * The view-relative index of the row currently in edit mode (row edit mode\n * only), or `null`.\n */\n public get editingRow(): number | null {\n return this.stateController.editing.activeRow?.rowIndex ?? null;\n }\n\n /**\n * Begins editing the cell at `(rowIndex, columnKey)`.\n *\n * @remarks\n * `rowIndex` is the view-relative index (matches {@link ApexGrid.pageItems}).\n * Returns `false` when the column isn't editable, the row index is out of\n * range, or the request was rejected (for example in row mode with pending\n * changes that couldn't be committed).\n */\n public editCell(rowIndex: number, columnKey: Keys<T>): Promise<boolean> {\n return this.stateController.editing.editCell(rowIndex, columnKey);\n }\n\n /**\n * Begins editing the entire row at `rowIndex` (row edit mode only).\n *\n * @returns `false` when editing is disabled, the grid is in cell mode, or\n * the row index is out of range.\n */\n public editRow(rowIndex: number): Promise<boolean> {\n return this.stateController.editing.editRow(rowIndex);\n }\n\n /**\n * Commits the current edit.\n *\n * @remarks\n * In cell mode this writes the active cell's pending value. In row mode it\n * flushes all pending values for the active row. Emits `cellValueChanging`\n * per changed cell (cancellable) and `cellValueChanged` after, followed by\n * `rowEditEnded` in row mode.\n */\n public commitEdit(): Promise<boolean> {\n const editing = this.stateController.editing;\n return editing.mode === 'row' ? editing.commitRow() : editing.commitCell();\n }\n\n /**\n * Discards the current edit without writing back to {@link ApexGrid.data}.\n */\n public cancelEdit(): void {\n const editing = this.stateController.editing;\n if (editing.mode === 'row') {\n editing.cancelRow();\n } else {\n editing.cancelCell();\n }\n }\n\n /**\n * Whether there is a recorded edit to undo.\n *\n * @remarks\n * Always `false` unless `editing.history.enabled` is set.\n */\n public get canUndo(): boolean {\n return this.stateController.history.canUndo;\n }\n\n /**\n * Whether there is a previously-undone edit to redo.\n */\n public get canRedo(): boolean {\n return this.stateController.history.canRedo;\n }\n\n /**\n * Reverts the most recent cell-data edit (single, row-mode, or bulk paste /\n * fill commits each as one step). No-op when there is nothing to undo or\n * history is disabled.\n */\n public undo(): void {\n this.stateController.history.undo();\n }\n\n /**\n * Re-applies the most recently undone edit. No-op when there is nothing to\n * redo or history is disabled.\n */\n public redo(): void {\n this.stateController.history.redo();\n }\n\n /**\n * Clears the undo / redo stacks.\n */\n public clearHistory(): void {\n this.stateController.history.clear();\n }\n\n /**\n * Pins `row` to a sticky top or bottom band, lifting it out of the scrolling\n * body. Moves it between bands when already pinned elsewhere.\n *\n * @remarks\n * Requires `rowPinning.enabled`. Goes through the cancellable `rowPinning`\n * event and emits `rowPinned` on success. Identity is by reference, so pass\n * the same object held in {@link ApexGrid.data}.\n *\n * @returns `true` when applied, `false` when disabled or cancelled.\n */\n public pinRow(row: T, position: RowPinPosition = 'top'): boolean {\n return this.stateController.rowPin.pinRow(row, position);\n }\n\n /**\n * Unpins `row` from whichever band holds it, returning it to the scrolling\n * body.\n *\n * @returns `true` when applied (or already unpinned), `false` when cancelled.\n */\n public unpinRow(row: T): boolean {\n return this.stateController.rowPin.unpinRow(row);\n }\n\n /**\n * The currently pinned rows per band, in the order they were pinned.\n */\n public get pinnedRows(): { top: T[]; bottom: T[] } {\n return this.stateController.rowPin.pinnedRows;\n }\n\n /**\n * Moves the row at view index `from` to land `position` (`'before'` /\n * `'after'`) the row at view index `to`. Indices are into\n * {@link ApexGrid.pageItems}.\n *\n * @remarks\n * Requires `rowReordering.enabled`. Establishes a manual order (mutually\n * exclusive with column sorting), goes through the cancellable `rowMoving`\n * event, emits `rowMoved`, and animates the affected rows.\n *\n * @returns `true` when applied, `false` when disabled, out of range, or\n * cancelled.\n */\n public moveRow(from: number, to: number, position: RowDropPosition = 'before'): boolean {\n return this.stateController.rowReorder.moveRow(from, to, position);\n }\n\n /**\n * Exports the current grid contents as a CSV string and (in a browser\n * context) triggers a download.\n *\n * @remarks\n * By default the export uses the post-filter/post-sort `dataView`, includes\n * every visible column with `exportable !== false`, and prepends a UTF-8 BOM\n * so Excel opens the file with the right encoding. Pass `source: 'page'` to\n * export only the current page, `source: 'selected'` to export the current\n * row selection, or `source: 'all'` to export the raw `data` array. The\n * returned string is the same content written to the file — useful for\n * tests or routing the bytes elsewhere.\n *\n * @example\n * ```ts\n * grid.exportToCSV(); // download data.csv\n * grid.exportToCSV({ filename: 'users', source: 'selected' });\n * const text = grid.exportToCSV({ filename: '' }); // string only, no download\n * ```\n */\n public exportToCSV(options: CSVExportOptions<T> = {}): string {\n const csv = buildCSV(this, options);\n const filename = options.filename;\n if (filename) {\n downloadBlob(`${filename}.csv`, csv, 'text/csv;charset=utf-8;');\n } else if (filename === undefined) {\n downloadBlob('data.csv', csv, 'text/csv;charset=utf-8;');\n }\n return csv;\n }\n\n /**\n * The export formats offered in the toolbar's export menu, in order.\n *\n * @remarks\n * The community grid offers CSV only. This is the seam derived grids use to\n * contribute more formats: `@apexcharts/grid-enterprise` overrides it to add\n * `'xlsx'`. The toolbar renders one menu item per entry and dispatches the\n * chosen id to {@link ApexGrid.exportAs}.\n */\n public get exportFormats(): ReadonlyArray<ExportFormat> {\n return [{ id: 'csv', label: 'Export CSV' }];\n }\n\n /**\n * Custom action buttons rendered in the toolbar's trailing actions area, in\n * order.\n *\n * @remarks\n * The community grid contributes none. This is the seam derived grids use to\n * add toolbar buttons (mirroring {@link ApexGrid.exportFormats}):\n * `@apexcharts/grid-enterprise` overrides it to add a \"Create chart\" action.\n * The toolbar renders one button per entry and calls its `run()` on click.\n */\n public get toolbarActions(): ReadonlyArray<ToolbarAction> {\n return [];\n }\n\n /**\n * Exports the grid in the given format (one of {@link ApexGrid.exportFormats}).\n * Called by the toolbar's export menu. The community grid handles `'csv'`;\n * derived grids override to handle additional formats, delegating to `super`\n * for the ones they don't add.\n */\n public exportAs(formatId: string, options: ExportOptions<T> = {}): void {\n if (formatId === 'csv') {\n this.exportToCSV(options as CSVExportOptions<T>);\n }\n }\n\n /**\n * Moves a column relative to another column.\n *\n * @remarks\n * Emits the cancellable `columnMoving` event first and `columnMoved` after.\n * Reordering only succeeds when the source and target columns share the same\n * pinning group (start / unpinned / end) — cross-group moves return `false`.\n * Use {@link ApexGrid.pinColumn} to change a column's pinning group first.\n *\n * @param fromKey - The column to move.\n * @param toKey - The reference column.\n * @param position - Whether to place `fromKey` before or after `toKey`. Defaults to `'before'`.\n * @returns `true` if the move was applied, `false` if cancelled or a no-op.\n *\n * @example\n * ```ts\n * await grid.moveColumn('email', 'name', 'after');\n * ```\n */\n public async moveColumn(\n fromKey: Keys<T>,\n toKey: Keys<T>,\n position: ColumnDropPosition = 'before'\n ): Promise<boolean> {\n if (fromKey === toKey) return false;\n const fromIndex = this.columns.findIndex((column) => column.key === fromKey);\n const toIndex = this.columns.findIndex((column) => column.key === toKey);\n if (fromIndex < 0 || toIndex < 0) return false;\n\n const source = this.columns[fromIndex];\n const target = this.columns[toIndex];\n if ((source.pinned ?? null) !== (target.pinned ?? null)) return false;\n\n const proceed = this.emitEvent('columnMoving', {\n detail: { key: fromKey, fromIndex, toKey, position },\n cancelable: true,\n });\n if (!proceed) return false;\n\n const next = this.columns.slice();\n const [moved] = next.splice(fromIndex, 1);\n let insertIndex = next.findIndex((column) => column.key === toKey);\n if (insertIndex < 0) return false;\n if (position === 'after') insertIndex += 1;\n next.splice(insertIndex, 0, moved);\n\n if (next.every((column, index) => column === this.columns[index])) return false;\n\n this.columns = next;\n await this.updateComplete;\n const resolvedIndex = this.columns.findIndex((column) => column.key === fromKey);\n this.emitEvent('columnMoved', {\n detail: { key: fromKey, fromIndex, toIndex: resolvedIndex },\n });\n return true;\n }\n\n @eventOptions({ capture: true })\n protected bodyClickHandler(event: MouseEvent) {\n const target = event.composedPath().find((el) => el instanceof ApexGridCell) as ApexGridCell<T>;\n if (target) {\n this.stateController.active = {\n column: target.column.key,\n row: target.row.index,\n };\n }\n }\n\n protected bodyKeydownHandler(event: KeyboardEvent) {\n if (this.scrollContainer.isSameNode(event.target as HTMLElement)) {\n this.stateController.navigation.navigate(event);\n }\n }\n\n /**\n * Forwards body-cell pointer interactions (press / drag-over / release) to\n * feature modules via {@link StateController.handleCellInteraction}. Gated on\n * there being at least one registered module so the community grid does no\n * per-event work (it registers none). The seam a range-selection feature\n * builds on.\n */\n protected bodyPointerHandler(event: PointerEvent) {\n if (this.stateController.modules.size === 0) return;\n // `pointermove` drives the drag-extend (`over`): tracking the move (not just\n // cell-entry via `pointerover`) means a cell is flagged the instant the\n // cursor crosses into it, even while in-range cells re-render under the\n // pointer. Plain hover moves carry no held button, so skip them — a drag\n // always opens with a `pointerdown` that keeps the button down.\n if (event.type === 'pointermove' && event.buttons === 0) return;\n const target = event.composedPath().find((el) => el instanceof ApexGridCell) as\n | ApexGridCell<T>\n | undefined;\n if (!target?.row) return;\n const kind: CellInteractionKind =\n event.type === 'pointerdown' ? 'down' : event.type === 'pointerup' ? 'up' : 'over';\n this.stateController.handleCellInteraction({\n kind,\n row: target.row.data,\n rowIndex: target.row.index,\n column: target.column,\n shiftKey: event.shiftKey,\n ctrlKey: event.ctrlKey,\n metaKey: event.metaKey,\n originalEvent: event,\n });\n }\n\n protected renderGroupHeaderRow() {\n if (!this.hasColumnGroups) return nothing;\n return html`\n <apex-grid-group-header-row\n style=${styleMap(this.DOM.columnSizes)}\n .columns=${this.DOM.displayColumns}\n .pinOffsets=${this.DOM.pinOffsets}\n .groups=${this.columnGroups ?? []}\n ></apex-grid-group-header-row>\n `;\n }\n\n protected renderHeaderRow() {\n return html`\n <apex-grid-header-row\n style=${styleMap(this.DOM.columnSizes)}\n .columns=${this.DOM.displayColumns}\n .pinOffsets=${this.DOM.pinOffsets}\n .coordinateHints=${this.coordinateHints}\n ></apex-grid-header-row>\n `;\n }\n\n protected renderBody() {\n return html`\n <apex-virtualizer\n .items=${this.pageItems as T[]}\n .renderItem=${this.DOM.rowRenderer}\n @click=${this.bodyClickHandler}\n @keydown=${this.bodyKeydownHandler}\n @pointerdown=${this.bodyPointerHandler}\n @pointermove=${this.bodyPointerHandler}\n @pointerup=${this.bodyPointerHandler}\n ></apex-virtualizer>\n `;\n }\n\n /** Number of chrome rows above the body (group header + header + optional filter). */\n protected get headerRowCount(): number {\n return this.columnGroupDepth + 1 + (this.columns.some((column) => column.filter) ? 1 : 0);\n }\n\n protected renderPinnedTop() {\n const rowPin = this.stateController.rowPin;\n if (!rowPin.enabled) return nothing;\n const rows = rowPin.pinnedRows.top;\n if (rows.length === 0) return nothing;\n return html`<div part=\"pinned-rows pinned-top\">\n ${rows.map((data, i) => this.DOM.pinnedRowRenderer(data, i, this.headerRowCount))}\n </div>`;\n }\n\n protected renderPinnedBottom() {\n const rowPin = this.stateController.rowPin;\n if (!rowPin.enabled) return nothing;\n const rows = rowPin.pinnedRows.bottom;\n if (rows.length === 0) return nothing;\n // Pinned-bottom rows follow the chrome rows, the pinned-top band, and the\n // body in the aria-rowindex sequence.\n const offset = this.headerRowCount + rowPin.pinnedRows.top.length + this.pageItems.length;\n return html`<div part=\"pinned-rows pinned-bottom\">\n ${rows.map((data, i) => this.DOM.pinnedRowRenderer(data, i, offset))}\n </div>`;\n }\n\n protected renderFilterRow() {\n // The filter row is a floating panel overlay (position: fixed), not a grid\n // row. It must stay in the shadow root so the @query selector can find it,\n // but it takes up no layout space when inactive.\n return this.columns.some((column) => column.filter)\n ? html`<apex-filter-row></apex-filter-row>`\n : nothing;\n }\n\n protected renderToolbar() {\n // Toolbar is shared by all toolbar-housed features. Render it whenever\n // any one of them is enabled.\n if (!this.showQuickFilter && !this.showExport && this.toolbarActions.length === 0) {\n return nothing;\n }\n return html`<apex-grid-toolbar\n .value=${this.quickFilter}\n .showQuickFilter=${this.showQuickFilter}\n .showExport=${this.showExport}\n @apex-quick-filter=${(event: CustomEvent<string>) => {\n event.stopPropagation();\n this.setQuickFilter(event.detail);\n }}\n ></apex-grid-toolbar>`;\n }\n\n protected renderPaginator() {\n if (!this.stateController.pagination.enabled) return nothing;\n const options =\n this.pagination?.pageSizeOptions && this.pagination.pageSizeOptions.length > 0\n ? this.pagination.pageSizeOptions\n : [10, 25, 50, 100];\n return html`<apex-grid-paginator .pageSizeOptions=${options}></apex-grid-paginator>`;\n }\n\n /**\n * Renders a visually-hidden polite live region. Status messages set via\n * {@link announce} land here; screen readers will read them aloud without\n * stealing focus. We intentionally keep this in the shadow root so we\n * don't have to coordinate consumer DOM placement.\n */\n protected renderLiveRegion() {\n return html`<div\n part=\"live-region\"\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n style=\"position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;\"\n >\n ${this.stateController.announcement}\n </div>`;\n }\n\n /**\n * Floating \"ghost\" of the row being pointer-dragged for reorder. Rendered at\n * the top of the shadow tree (outside the virtualizer) so its `position: fixed`\n * tracks the viewport, and painted from the cell snapshot captured at grab\n * time so it mirrors the row's visible content and column widths.\n */\n protected renderRowDragGhost() {\n const ghost = this.stateController.rowReorder.ghost;\n if (!ghost) return nothing;\n return html`<div\n part=\"row-drag-ghost\"\n style=${styleMap({\n left: `${ghost.x}px`,\n top: `${ghost.y}px`,\n height: `${ghost.height}px`,\n })}\n >\n <span part=\"row-drag-ghost-grip\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\">\n <circle cx=\"6\" cy=\"3.5\" r=\"1.25\" />\n <circle cx=\"10\" cy=\"3.5\" r=\"1.25\" />\n <circle cx=\"6\" cy=\"8\" r=\"1.25\" />\n <circle cx=\"10\" cy=\"8\" r=\"1.25\" />\n <circle cx=\"6\" cy=\"12.5\" r=\"1.25\" />\n <circle cx=\"10\" cy=\"12.5\" r=\"1.25\" />\n </svg>\n </span>\n ${ghost.cells.map(\n (cell) =>\n html`<span\n part=\"row-drag-ghost-cell\"\n style=${styleMap({ width: `${cell.width}px`, textAlign: cell.align })}\n >${cell.text}</span\n >`\n )}\n </div>`;\n }\n\n protected override render() {\n return html`\n ${this.stateController.resizing.renderIndicator()}\n ${this.renderToolbar()}\n ${this.renderGroupHeaderRow()}\n ${this.renderHeaderRow()}\n ${this.renderFilterRow()}\n ${this.renderPinnedTop()}\n ${this.renderBody()}\n ${this.renderPinnedBottom()}\n ${this.renderPaginator()}\n ${this.renderLiveRegion()}\n ${this.renderRowDragGhost()}\n `;\n }\n\n /**\n * Sets the live region's announcement text. Screen readers configured to\n * read polite live updates will read the new value aloud.\n *\n * @remarks\n * Use this from custom UI affordances (e.g. an \"Apply filter\" button) so\n * the change is announced. Built-in operations (sort / filter / page /\n * select / expand) call this internally already.\n */\n public announce(message: string): void {\n this.stateController.setAnnouncement(message);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [ApexGrid.tagName]: ApexGrid<object>;\n }\n}\n"]}
1
+ {"version":3,"file":"grid.js","sourceRoot":"","sources":["../../src/components/grid.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAIL,QAAQ,IAAI,iBAAiB,GAC9B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,EACL,QAAQ,EAER,YAAY,GAGb,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAA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ACuB;AAU/C;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;iDAC3C;AAUxB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CACN;AAkBlB;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;8CACkB;AAoG1C;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;sCACQ;AAqDvC;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+CAG9B;AAeD;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDAS9B;AA8ED;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;oCAG9B;AAUD;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;wCAG9B;AAcS;IADT,KAAK,CAAC,SAAS,CAAC;4CAGhB;AAGS;IADT,KAAK,CAAC,MAAM,CAAC;2CAwBb;AAGe;IADf,KAAK,CAAC,QAAQ,CAAC;wCAIf;AAGS;IADT,KAAK,CAAC,YAAY,CAAC;iDAcnB;AAGS;IADT,KAAK,CAAC,aAAa,CAAC;kDAKpB;AAg5BS;IADT,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAa/B","sourcesContent":["import { ContextProvider } from '@lit/context';\nimport { html, nothing } from 'lit';\nimport { eventOptions, property, query, queryAll, state } from 'lit/decorators.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { DataOperationsController } from '../controllers/data-operation.js';\nimport { GridDOMController } from '../controllers/dom.js';\nimport type { RowPinPosition } from '../controllers/row-pin.js';\nimport type { RowDropPosition } from '../controllers/row-reorder.js';\nimport { gridStateContext, StateController } from '../controllers/state.js';\nimport {\n type GridLocaleKey,\n type GridLocaleText,\n type LocaleParams,\n localize as resolveLocaleText,\n} from '../i18n/index.js';\nimport { DEFAULT_COLUMN_CONFIG, PIPELINE, SENTINEL_NODE } from '../internal/constants.js';\nimport {\n buildCSV,\n type CSVExportOptions,\n downloadBlob,\n type ExportFormat,\n type ExportOptions,\n} from '../internal/export.js';\nimport type { CellInteractionKind } from '../internal/feature-module.js';\nimport { EventEmitterBase } from '../internal/mixins/event-emitter.js';\nimport { registerComponent } from '../internal/register.js';\nimport { columnSchema, type GridSchema, operandsByType } from '../internal/state-schema.js';\nimport {\n applyColumnLayout,\n type ColumnLayoutState,\n deserializeFilter,\n type GetStateOptions,\n type GridState,\n type RowRef,\n resolveRowRefs,\n type SetStateOptions,\n type SetStateResult,\n type SortStateSnapshot,\n serializeColumnLayout,\n serializeFilter,\n serializeRowRefs,\n serializeSort,\n} from '../internal/state-snapshot.js';\nimport { GRID_TAG } from '../internal/tags.js';\nimport type {\n ColumnConfiguration,\n ColumnGroupConfiguration,\n DataPipelineConfiguration,\n GridEditingConfiguration,\n GridExpansionConfiguration,\n GridRowPinningConfiguration,\n GridRowReorderingConfiguration,\n GridSelectionConfiguration,\n GridSortConfiguration,\n GridTreeConfiguration,\n Keys,\n PaginationConfiguration,\n PaginationState,\n PinPosition,\n ToolbarAction,\n} from '../internal/types.js';\nimport {\n asArray,\n autoGenerateColumns,\n getDisplayColumns,\n getFilterOperandsFor,\n} from '../internal/utils.js';\nimport { watch } from '../internal/watch.js';\nimport type { FilterExpression } from '../operations/filter/types.js';\nimport type { SortExpression } from '../operations/sort/types.js';\nimport { styles as gridStyles } from '../styles/grid/grid.css.js';\nimport ApexGridCell from './cell.js';\nimport ApexFilterRow from './filter-row.js';\nimport ApexGridGroupHeaderRow from './group-header-row.js';\nimport ApexGridHeaderRow from './header-row.js';\nimport ApexGridPaginator from './paginator.js';\nimport ApexGridRow from './row.js';\nimport ApexGridToolbar from './toolbar.js';\nimport ApexVirtualizer from './virtualizer.js';\n\n/**\n * Event object for the filtering event of the grid.\n */\nexport interface ApexFilteringEvent<T extends object> {\n /**\n * The target column for the filter operation.\n */\n key: Keys<T>;\n\n /**\n * The filter expression(s) to apply.\n */\n expressions: FilterExpression<T>[];\n\n /**\n * The type of modification which will be applied to the filter\n * state of the column.\n *\n * @remarks\n * `add` - a new filter expression will be added to the state of the column.\n * `modify` - an existing filter expression will be modified.\n * `remove` - the expression(s) will be removed from the state of the column.\n */\n type: 'add' | 'modify' | 'remove';\n}\n\n/**\n * Event object for the filtered event of the grid.\n */\nexport interface ApexFilteredEvent<T extends object> {\n /**\n * The target column for the filter operation.\n */\n key: Keys<T>;\n\n /**\n * The filter state of the column after the operation.\n */\n state: FilterExpression<T>[];\n}\n\n/**\n * Event payload for the cancellable `pageChanging` event.\n */\nexport interface ApexPageChangingEvent {\n /**\n * The current page (zero-based) before the change.\n */\n page: number;\n /**\n * The current page size before the change.\n */\n pageSize: number;\n /**\n * The proposed page (zero-based) the grid will navigate to.\n */\n nextPage: number;\n /**\n * The proposed page size after the change.\n */\n nextPageSize: number;\n}\n\n/**\n * Event payload for the `pageChanged` event. Mirrors {@link PaginationState}.\n */\nexport interface ApexPageChangedEvent extends PaginationState {}\n\n/**\n * Event payload for the cancellable `quickFilterChanging` event.\n */\nexport interface ApexQuickFilterChangingEvent {\n /**\n * The current quick-filter value before the change.\n */\n value: string;\n /**\n * The proposed quick-filter value.\n */\n nextValue: string;\n}\n\n/**\n * Event payload for the `quickFilterChanged` event.\n */\nexport interface ApexQuickFilterChangedEvent {\n /**\n * The resolved quick-filter value after the change.\n */\n value: string;\n}\n\n/**\n * Drop position relative to a target column when reordering.\n */\nexport type ColumnDropPosition = 'before' | 'after';\n\n/**\n * Event payload for the cancellable `cellValueChanging` event.\n */\nexport interface ApexCellValueChangingEvent<T extends object> {\n /**\n * The column key of the edited cell.\n */\n key: Keys<T>;\n /**\n * The view-relative row index (matches {@link ApexGrid.pageItems}).\n */\n rowIndex: number;\n /**\n * The data record being edited (a live reference to the row in\n * {@link ApexGrid.data}).\n */\n data: T;\n /**\n * The value before the edit.\n */\n oldValue: unknown;\n /**\n * The candidate new value.\n */\n newValue: unknown;\n}\n\n/**\n * Event payload for the `cellValueChanged` event.\n */\nexport interface ApexCellValueChangedEvent<T extends object> {\n /**\n * The column key of the edited cell.\n */\n key: Keys<T>;\n /**\n * The view-relative row index after the change.\n */\n rowIndex: number;\n /**\n * The data record after the change (a live reference to the row in\n * {@link ApexGrid.data}).\n */\n data: T;\n /**\n * The applied value.\n */\n value: unknown;\n}\n\n/**\n * Event payload for the `cellValidationFailed` event.\n */\nexport interface ApexCellValidationFailedEvent<T extends object> {\n /**\n * The column key of the rejected cell.\n */\n key: Keys<T>;\n /**\n * The view-relative row index of the rejected cell.\n */\n rowIndex: number;\n /**\n * The data record being edited (a live reference to the row in\n * {@link ApexGrid.data}).\n */\n data: T;\n /**\n * The candidate value that failed validation.\n */\n value: unknown;\n /**\n * The collected validator error messages.\n */\n errors: readonly string[];\n}\n\n/**\n * Event payload for the cancellable `rowPinning` event and the follow-up\n * `rowPinned` event.\n */\nexport interface ApexRowPinningEvent<T extends object> {\n /** The row being pinned or unpinned (a live reference into {@link ApexGrid.data}). */\n row: T;\n /**\n * The target band: `'top'` / `'bottom'` when pinning, or `null` when\n * unpinning.\n */\n position: RowPinPosition | null;\n}\n\n/**\n * Event payload for the cancellable `rowMoving` event and the follow-up\n * `rowMoved` event.\n */\nexport interface ApexRowMovingEvent<T extends object> {\n /** The moving row's view index before the move. */\n from: number;\n /** The target row's view index. */\n to: number;\n /** The row being moved (a live reference into {@link ApexGrid.data}). */\n data: T;\n}\n\n/**\n * Event payload for the `historyChanged` event.\n */\nexport interface ApexHistoryChangedEvent {\n /** Whether there is at least one command to undo. */\n canUndo: boolean;\n /** Whether there is at least one command to redo. */\n canRedo: boolean;\n}\n\n/**\n * Event payload for the `stateChanged` event.\n */\nexport interface ApexStateChangedEvent {\n /** The grid's restorable state after the change, as captured by `getState`. */\n state: GridState;\n}\n\n/**\n * Event payload for the `rowEditStarted` event.\n */\nexport interface ApexRowEditStartedEvent {\n /**\n * The view-relative row index entering edit mode.\n */\n rowIndex: number;\n}\n\n/**\n * Event payload for the `rowEditEnded` event.\n */\nexport interface ApexRowEditEndedEvent {\n /**\n * The view-relative row index that left edit mode.\n */\n rowIndex: number;\n /**\n * `true` when pending edits were applied, `false` when discarded.\n */\n committed: boolean;\n}\n\n/**\n * Event payload for the cancellable `columnMoving` event.\n */\nexport interface ApexColumnMovingEvent<T extends object> {\n /**\n * The column being moved.\n */\n key: Keys<T>;\n /**\n * The current index of the moving column in {@link ApexGrid.columns}.\n */\n fromIndex: number;\n /**\n * The target column key. The dragged column will be placed `position`\n * (before/after) this column.\n */\n toKey: Keys<T>;\n /**\n * Whether the dragged column is being placed before or after `toKey`.\n */\n position: ColumnDropPosition;\n}\n\n/**\n * Event payload for the `columnMoved` event.\n */\nexport interface ApexColumnMovedEvent<T extends object> {\n /**\n * The column that was moved.\n */\n key: Keys<T>;\n /**\n * The original index in {@link ApexGrid.columns}.\n */\n fromIndex: number;\n /**\n * The resolved index in {@link ApexGrid.columns} after the move.\n */\n toIndex: number;\n}\n\n/**\n * Event payload for the cancellable `rowSelecting` event.\n */\nexport interface ApexRowSelectingEvent<T extends object> {\n /**\n * The rows that will become selected by this change.\n */\n added: T[];\n /**\n * The rows that will become deselected by this change.\n */\n removed: T[];\n /**\n * The full current selection before this change is applied.\n */\n current: T[];\n /**\n * The full selection after this change would be applied. Listeners can\n * inspect this to decide whether to cancel.\n */\n next: T[];\n}\n\n/**\n * Event payload for the `rowSelected` event.\n */\nexport interface ApexRowSelectedEvent<T extends object> {\n /**\n * The rows that became selected in this change.\n */\n added: T[];\n /**\n * The rows that became deselected in this change.\n */\n removed: T[];\n /**\n * The full current selection after the change has been applied.\n */\n selected: T[];\n}\n\n/**\n * Event payload for the cancellable `treeRowExpanding` event.\n */\nexport interface ApexTreeRowExpandingEvent<T extends object> {\n /** Rows that will become expanded by this change. */\n added: T[];\n /** Rows that will become collapsed by this change. */\n removed: T[];\n /** The full current tree-expansion set before this change is applied. */\n current: T[];\n /** The full set after this change would be applied. */\n next: T[];\n}\n\n/**\n * Event payload for the `treeRowExpanded` event.\n */\nexport interface ApexTreeRowExpandedEvent<T extends object> {\n /** Rows that became expanded in this change. */\n added: T[];\n /** Rows that became collapsed in this change. */\n removed: T[];\n /** The full tree-expansion set after the change has been applied. */\n expanded: T[];\n}\n\n/**\n * Event payload for the cancellable `rowExpanding` event.\n */\nexport interface ApexRowExpandingEvent<T extends object> {\n /** The rows that will become expanded by this change. */\n added: T[];\n /** The rows that will become collapsed by this change. */\n removed: T[];\n /** The full current expansion set before this change is applied. */\n current: T[];\n /**\n * The full expansion set after this change would be applied. Listeners can\n * inspect this to decide whether to cancel.\n */\n next: T[];\n}\n\n/**\n * Event payload for the `rowExpanded` event.\n */\nexport interface ApexRowExpandedEvent<T extends object> {\n /** The rows that became expanded in this change. */\n added: T[];\n /** The rows that became collapsed in this change. */\n removed: T[];\n /** The full expansion set after the change has been applied. */\n expanded: T[];\n}\n\n/**\n * Event payload for the cancellable `columnPinning` event.\n */\nexport interface ApexColumnPinningEvent<T extends object> {\n /**\n * The target column key.\n */\n key: Keys<T>;\n /**\n * The current pin position before the change (`null` if unpinned).\n */\n previous: PinPosition;\n /**\n * The proposed pin position (`null` to unpin).\n */\n next: PinPosition;\n}\n\n/**\n * Event payload for the `columnPinned` event.\n */\nexport interface ApexColumnPinnedEvent<T extends object> {\n /**\n * The target column key.\n */\n key: Keys<T>;\n /**\n * The resolved pin position after the change.\n */\n pinned: PinPosition;\n}\n\n/**\n * Events for the apex-grid.\n */\nexport interface ApexGridEventMap<T extends object> {\n /**\n * Emitted when sorting is initiated through the UI.\n * Returns the sort expression which will be used for the operation.\n *\n * @remarks\n * The event is cancellable which prevents the operation from being applied.\n * The expression can be modified prior to the operation running.\n *\n * @event\n */\n sorting: CustomEvent<SortExpression<T>>;\n /**\n * Emitted when a sort operation initiated through the UI has completed.\n * Returns the sort expression used for the operation.\n *\n * @event\n */\n sorted: CustomEvent<SortExpression<T>>;\n /**\n * Emitted when filtering is initiated through the UI.\n *\n * @remarks\n * The event is cancellable which prevents the operation from being applied.\n * The expression can be modified prior to the operation running.\n *\n * @event\n */\n filtering: CustomEvent<ApexFilteringEvent<T>>;\n /**\n * Emitted when a filter operation initiated through the UI has completed.\n * Returns the filter state for the affected column.\n *\n * @event\n */\n filtered: CustomEvent<ApexFilteredEvent<T>>;\n /**\n * Emitted before the grid navigates to a new page or applies a new page size.\n *\n * @remarks\n * Cancellable — calling `preventDefault()` (or returning a falsy result from\n * `addEventListener` synchronously) aborts the page change.\n *\n * @event\n */\n pageChanging: CustomEvent<ApexPageChangingEvent>;\n /**\n * Emitted after a page or page-size change has been applied and the pipeline has run.\n *\n * @event\n */\n pageChanged: CustomEvent<ApexPageChangedEvent>;\n /**\n * Emitted before the quick-filter value is applied.\n *\n * @remarks\n * Cancellable — calling `preventDefault()` aborts the change. The value can\n * be replaced inside the listener by reassigning {@link ApexGrid.quickFilter}.\n *\n * @event\n */\n quickFilterChanging: CustomEvent<ApexQuickFilterChangingEvent>;\n /**\n * Emitted after a quick-filter change has been applied and the pipeline has run.\n *\n * @event\n */\n quickFilterChanged: CustomEvent<ApexQuickFilterChangedEvent>;\n /**\n * Emitted before a column's pin position changes.\n *\n * @remarks\n * Cancellable — calling `preventDefault()` aborts the change.\n *\n * @event\n */\n columnPinning: CustomEvent<ApexColumnPinningEvent<T>>;\n /**\n * Emitted after a column's pin position change has been applied.\n *\n * @event\n */\n columnPinned: CustomEvent<ApexColumnPinnedEvent<T>>;\n /**\n * Emitted before a column is moved through the UI or {@link ApexGrid.moveColumn}.\n *\n * @remarks\n * Cancellable — calling `preventDefault()` aborts the move. The event detail\n * carries the source column key, its current array index, the target column\n * key and the drop position.\n *\n * @event\n */\n columnMoving: CustomEvent<ApexColumnMovingEvent<T>>;\n /**\n * Emitted after a column has been moved.\n *\n * @event\n */\n columnMoved: CustomEvent<ApexColumnMovedEvent<T>>;\n /**\n * Emitted before a cell value is committed.\n *\n * @remarks\n * Cancellable — `preventDefault()` rolls back the candidate value. In row\n * edit mode the event still fires per-cell at commit time.\n *\n * @event\n */\n cellValueChanging: CustomEvent<ApexCellValueChangingEvent<T>>;\n /**\n * Emitted after a cell value has been committed.\n *\n * @event\n */\n cellValueChanged: CustomEvent<ApexCellValueChangedEvent<T>>;\n /**\n * Emitted when a candidate cell value is rejected by one or more of the\n * column's {@link BaseColumnConfiguration.validators}. The value is not\n * written; in inline edit mode the editor stays open. Fires for single,\n * row-mode, and bulk (paste / fill) edits.\n *\n * @event\n */\n cellValidationFailed: CustomEvent<ApexCellValidationFailedEvent<T>>;\n /**\n * Emitted after the undo / redo stacks change (a recorded edit, an undo, a\n * redo, or a clear). Carries the current `canUndo` / `canRedo` so a toolbar\n * can enable or disable its buttons.\n *\n * @event\n */\n historyChanged: CustomEvent<ApexHistoryChangedEvent>;\n /**\n * Emitted (debounced, after the render pipeline settles) whenever the grid's\n * restorable state changes, carrying the new {@link ApexGrid.getState}\n * snapshot. The single signal for persistence (save the snapshot) or for\n * re-prompting an AI layer. The payload is only computed while at least one\n * `stateChanged` listener is attached, so it is zero-cost otherwise.\n *\n * @remarks\n * Fires for programmatic changes (including `setState`) as well as user\n * interaction. To avoid a save loop, compare the snapshot to your last-saved\n * one before persisting (identical snapshots never fire a second time).\n *\n * @event\n */\n stateChanged: CustomEvent<ApexStateChangedEvent>;\n /**\n * Emitted before a row is pinned, moved between bands, or unpinned.\n *\n * @remarks\n * Cancellable — `preventDefault()` aborts the change.\n *\n * @event\n */\n rowPinning: CustomEvent<ApexRowPinningEvent<T>>;\n /**\n * Emitted after a row's pin state has changed.\n *\n * @event\n */\n rowPinned: CustomEvent<ApexRowPinningEvent<T>>;\n /**\n * Emitted before a row is moved via drag, keyboard, or {@link ApexGrid.moveRow}.\n *\n * @remarks\n * Cancellable — `preventDefault()` aborts the move.\n *\n * @event\n */\n rowMoving: CustomEvent<ApexRowMovingEvent<T>>;\n /**\n * Emitted after a row has been moved.\n *\n * @event\n */\n rowMoved: CustomEvent<ApexRowMovingEvent<T>>;\n /**\n * Emitted when a row enters edit mode (row edit mode only).\n *\n * @event\n */\n rowEditStarted: CustomEvent<ApexRowEditStartedEvent>;\n /**\n * Emitted when a row leaves edit mode, with `committed` reporting whether\n * pending edits were applied (row edit mode only).\n *\n * @event\n */\n rowEditEnded: CustomEvent<ApexRowEditEndedEvent>;\n /**\n * Emitted before the tree-row expansion set changes.\n *\n * @remarks\n * Fires only when {@link ApexGrid.tree} is enabled and a row's tree\n * expansion is toggled (via the chevron, the public API, or\n * `expand-all/collapse-all`). Cancellable.\n *\n * @event\n */\n treeRowExpanding: CustomEvent<ApexTreeRowExpandingEvent<T>>;\n /**\n * Emitted after a tree-row expansion change has been applied.\n *\n * @event\n */\n treeRowExpanded: CustomEvent<ApexTreeRowExpandedEvent<T>>;\n /**\n * Emitted before the row expansion set changes.\n *\n * @remarks\n * Cancellable — calling `preventDefault()` aborts the change. Fires for\n * every expansion-mutating call (toggle, expand-all, programmatic\n * `expandedRows = ...`).\n *\n * @event\n */\n rowExpanding: CustomEvent<ApexRowExpandingEvent<T>>;\n /**\n * Emitted after a row-expansion change has been applied.\n *\n * @event\n */\n rowExpanded: CustomEvent<ApexRowExpandedEvent<T>>;\n /**\n * Emitted before the row selection set changes.\n *\n * @remarks\n * Cancellable — calling `preventDefault()` aborts the selection change.\n * Fires for every selection-mutating call (toggle, range select, select-all,\n * programmatic `selectedRows = ...`).\n *\n * @event\n */\n rowSelecting: CustomEvent<ApexRowSelectingEvent<T>>;\n /**\n * Emitted after a row-selection change has been applied.\n *\n * @event\n */\n rowSelected: CustomEvent<ApexRowSelectedEvent<T>>;\n}\n\n/**\n * Apex grid is a web component for displaying data in a tabular format quick and easy.\n *\n * Out of the box it provides row virtualization, sort and filter operations (client and server side),\n * the ability to template cells and headers and column hiding.\n *\n * @remarks\n * A working, styled grid requires three things:\n * 1. Register the element: `import 'apex-grid/define'` (or `ApexGrid.register()`).\n * 2. Give the host element a bounded height, e.g. `apex-grid { height: 480px }` —\n * the virtualizer collapses without one.\n * 3. Do NOT set `display` on the host — the component declares `:host { display: grid }`\n * internally and any override breaks the track layout.\n *\n * The grid is styled out of the box through `--ag-*` CSS custom properties —\n * there is no theme to import and no `configureTheme()` call. Override `--ag-*`\n * tokens on the host (or any ancestor) to rebrand; when `igniteui-webcomponents`\n * is present, the brand tokens auto-tint from its palette. For dark mode, set\n * the `theme=\"dark\"` attribute on the host for the built-in slate dark palette\n * (further `--ag-*` overrides still compose on top). Add `tinted` (e.g.\n * `theme=\"tinted\"` or `theme=\"dark tinted\"`) to mix the brand into the chrome\n * so the grid wears its brand even at rest. See the README \"Getting Started\"\n * and \"Theming\" sections for the full example and token list.\n *\n * @element apex-grid\n *\n * @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\"`.\n *\n * @fires sorting - Emitted when sorting is initiated through the UI.\n * @fires sorted - Emitted when a sort operation initiated through the UI has completed.\n * @fires filtering - Emitted when filtering is initiated through the UI.\n * @fires filtered - Emitted when a filter operation initiated through the UI has completed.\n * @fires pageChanging - Cancellable. Emitted before page/page-size changes are applied.\n * @fires pageChanged - Emitted after a page/page-size change has been applied.\n * @fires quickFilterChanging - Cancellable. Emitted before a quick-filter value is applied.\n * @fires quickFilterChanged - Emitted after a quick-filter change has been applied.\n * @fires columnPinning - Cancellable. Emitted before a column's pin position changes.\n * @fires columnPinned - Emitted after a column's pin position has changed.\n * @fires columnMoving - Cancellable. Emitted before a column is moved.\n * @fires columnMoved - Emitted after a column has been moved.\n * @fires cellValueChanging - Cancellable. Emitted before a cell value is committed.\n * @fires cellValueChanged - Emitted after a cell value has been committed.\n * @fires rowEditStarted - Emitted when a row enters edit mode (row mode only).\n * @fires rowEditEnded - Emitted when a row leaves edit mode (row mode only).\n * @fires rowSelecting - Cancellable. Emitted before a selection-set change is applied.\n * @fires rowSelected - Emitted after a selection-set change has been applied.\n * @fires rowExpanding - Cancellable. Emitted before the row-expansion set changes (master-detail).\n * @fires rowExpanded - Emitted after a row-expansion change has been applied.\n * @fires treeRowExpanding - Cancellable. Emitted before a tree-row expansion change (tree mode).\n * @fires treeRowExpanded - Emitted after a tree-row expansion change has been applied.\n *\n * @csspart live-region - Visually-hidden ARIA live region used for screen-reader announcements.\n *\n * @cssprop [--ag-brand] - Brand color for selection, focus rings, and accents. Auto-tints from `--ig-primary-500` when igniteui is present.\n * @cssprop [--ag-brand-strong] - Brand color for hover / pressed states.\n * @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.\n * @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.\n * @cssprop [--ag-surface] - Grid card background (must be opaque).\n * @cssprop [--ag-surface-alt] - Alternating row tint.\n * @cssprop [--ag-surface-elevated] - Header background.\n * @cssprop [--ag-hairline] - Header / structural gridline color.\n * @cssprop [--ag-border] - Row separator color.\n * @cssprop [--ag-text] - Primary text color.\n * @cssprop [--ag-text-body] - Row text color.\n * @cssprop [--ag-text-muted] - Muted text (roles, labels).\n * @cssprop [--ag-row-hover] - Row hover wash.\n * @cssprop [--ag-row-h] - Row height.\n * @cssprop [--ag-header-h] - Header height.\n * @cssprop [--ag-radius] - Outer card corner radius.\n * @cssprop [--ag-font] - Grid font family.\n * @cssprop [--ag-fs-cell] - Cell font size.\n *\n * @see {@link https://github.com/apexcharts/apex-grid/blob/main/packages/core/src/styles/_tokens.scss | _tokens.scss} for the complete `--ag-*` token list.\n */\n/** Known `setState` slice names, used to compute the `skipped` report. */\nconst SET_STATE_SLICES = [\n 'columns',\n 'sort',\n 'filter',\n 'quickFilter',\n 'modules',\n 'rowOrder',\n 'tree',\n 'expansion',\n 'rowPinning',\n 'selection',\n 'pagination',\n] as const;\n\nexport class ApexGrid<T extends object> extends EventEmitterBase<ApexGridEventMap<T>> {\n public static get tagName(): string {\n return GRID_TAG;\n }\n\n public static override styles = gridStyles;\n\n /**\n * Registers `<apex-grid>` and its internal dependencies with the custom-element\n * registry. Idempotent — safe to call more than once.\n *\n * @remarks\n * Registering the element is only step one of four required for a visible, styled\n * grid. You must also configure an Ignite UI theme + CSS, give the host a bounded\n * height, and avoid overriding `display` on the host. See the README\n * \"Getting Started\" section for the full setup.\n */\n public static register() {\n registerComponent(\n ApexGrid,\n ApexVirtualizer,\n ApexGridRow,\n ApexGridGroupHeaderRow,\n ApexGridHeaderRow,\n ApexFilterRow,\n ApexGridPaginator,\n ApexGridToolbar\n );\n }\n\n protected stateController = this.createStateController();\n protected DOM = new GridDOMController<T>(this, this.stateController);\n protected dataController = new DataOperationsController<T>(this);\n\n /**\n * Builds the grid's {@link StateController}. This is the single construction\n * site for `stateController` — overriding it (rather than re-declaring the\n * field) is the supported seam for derived grids to inject optional\n * {@link GridFeatureModule}s while preserving field-initializer ordering.\n * The community grid registers no extra modules.\n */\n protected createStateController(): StateController<T> {\n return new StateController<T>(this);\n }\n\n protected stateProvider = new ContextProvider(this, {\n context: gridStateContext,\n initialValue: this.stateController,\n });\n\n @query(ApexVirtualizer.tagName)\n protected scrollContainer!: ApexVirtualizer;\n\n @query(ApexGridHeaderRow.tagName)\n protected headerRow!: ApexGridHeaderRow<T>;\n\n @query(ApexFilterRow.tagName)\n protected filterRow!: ApexFilterRow<T>;\n\n @query(ApexGridPaginator.tagName)\n protected paginator!: ApexGridPaginator<T>;\n\n @query(ApexGridToolbar.tagName)\n protected toolbar!: ApexGridToolbar<T>;\n\n @state()\n protected dataState: Array<T> = [];\n\n @queryAll(ApexGridRow.tagName)\n protected _rows!: NodeListOf<ApexGridRow<T>>;\n\n /** Column configuration for the grid. */\n @property({ attribute: false })\n public columns: Array<ColumnConfiguration<T>> = [];\n\n /** The data source for the grid. */\n @property({ attribute: false })\n public data: Array<T> = [];\n\n /**\n * Optional stable row-identity resolver.\n *\n * @remarks\n * When provided, {@link ApexGrid.getState} captures selection / expansion /\n * tree rows by the returned id, so they survive a wholesale {@link ApexGrid.data}\n * reload. Without it those rows are captured by positional index into\n * {@link ApexGrid.data}, which round-trips within a session but not across a\n * data swap. The id must be unique per row and stable across reloads.\n */\n @property({ attribute: false })\n public rowId?: (row: T) => string | number;\n\n /**\n * Whether the grid will try to \"resolve\" its column configuration based on the passed\n * data source.\n *\n * @remarks\n * This is usually executed on initial rendering in the DOM. It depends on having an existing data source\n * to infer the column configuration for the grid.\n * Passing an empty data source or having a late bound data source (such as a HTTP request) will usually\n * result in empty column configuration for the grid.\n *\n * This property is ignored if any existing column configuration already exists in the grid.\n *\n * In a scenario where you want to bind a new data source and still keep the auto-generation behavior,\n * make sure to reset the column collection of the grid before passing in the new data source.\n *\n * @example\n * ```typescript\n * // assuming autoGenerate is set to true\n * grid.columns = [];\n * grid.data = [...];\n * ```\n *\n * @attr auto-generate\n */\n @property({ type: Boolean, attribute: 'auto-generate' })\n public autoGenerate = false;\n\n /** Sort configuration property for the grid. */\n @property({ attribute: false })\n public sortConfiguration: GridSortConfiguration = {\n multiple: true,\n triState: true,\n };\n\n /**\n * Configuration object which controls remote data operations for the grid.\n */\n @property({ attribute: false })\n public dataPipelineConfiguration!: DataPipelineConfiguration<T>;\n\n /**\n * Pagination configuration for the grid.\n *\n * @remarks\n * Pagination is disabled by default. Set `enabled: true` and (optionally) `pageSize`\n * to render the built-in `<apex-grid-paginator>` and slice the dataView. For\n * server-side pagination set `mode: 'remote'` and supply `totalItems`. The grid\n * emits the cancellable `pageChanging` event before applying a change and the\n * `pageChanged` event after the pipeline has run.\n *\n * @example\n * ```ts\n * grid.pagination = { enabled: true, pageSize: 25 };\n * grid.addEventListener('pageChanged', (event) => {\n * console.log('Now on page', event.detail.page, 'of', event.detail.pageCount);\n * });\n * ```\n */\n @property({ attribute: false })\n public pagination?: PaginationConfiguration;\n\n /**\n * The quick-filter (global search) value applied to the dataView.\n *\n * @remarks\n * When non-empty, the grid filters records whose visible-column values contain\n * the term (case-insensitive substring match). Customise by providing\n * {@link DataPipelineConfiguration.quickFilter}.\n *\n * @attr quick-filter\n */\n @property({ type: String, attribute: 'quick-filter' })\n public quickFilter = '';\n\n /**\n * Whether the built-in quick-filter input is rendered in the toolbar.\n *\n * @remarks\n * The {@link ApexGrid.quickFilter} value can be controlled programmatically\n * regardless of this flag; this only controls the toolbar input UI.\n *\n * @attr show-quick-filter\n */\n @property({ type: Boolean, attribute: 'show-quick-filter' })\n public showQuickFilter = false;\n\n /**\n * Whether the built-in export menu is rendered in the toolbar.\n *\n * @remarks\n * When `true`, the toolbar shows a download button on the trailing side;\n * clicking it opens a menu with one entry per {@link ApexGrid.exportFormats}\n * (CSV in the community grid) that calls {@link ApexGrid.exportAs}.\n * {@link ApexGrid.exportToCSV} remains callable programmatically regardless\n * of this flag.\n *\n * @attr show-export\n */\n @property({ type: Boolean, attribute: 'show-export' })\n public showExport = false;\n\n /**\n * Localization overrides for the grid's built-in UI text (pagination, filter\n * operators and controls, row/selection labels, the toolbar, and so on).\n *\n * @remarks\n * A (possibly partial) map of locale keys to translated strings. Any key you\n * omit falls back to the built-in English default, so partial maps are valid.\n * A ready-made Spanish dictionary ships as `esLocale`; community translations\n * are just plain objects of the same shape.\n *\n * @example\n * ```ts\n * import { esLocale } from '@apexcharts/grid';\n *\n * // Whole-UI translation:\n * grid.localeText = esLocale;\n *\n * // Or override a handful of strings:\n * grid.localeText = { 'toolbar.searchPlaceholder': 'Buscar productos…' };\n * ```\n */\n @property({ attribute: false })\n public localeText?: GridLocaleText;\n\n /**\n * Resolves a built-in locale key to its display string, applying any\n * {@link ApexGrid.localeText} override over the English default and\n * interpolating `{placeholder}` tokens from `params`.\n *\n * @remarks\n * Used internally by the grid's components. `fallback` is returned when the\n * key is not part of the built-in set (for example a custom filter operand's\n * own label).\n */\n public localize(key: GridLocaleKey, params?: LocaleParams, fallback?: string): string {\n return resolveLocaleText(this.localeText, key, params, fallback);\n }\n\n /**\n * Enables drag-and-drop column reordering on the column headers.\n *\n * @remarks\n * Per-column opt-out is available through {@link BaseColumnConfiguration.reorderable}.\n * Reordering is constrained to a column's own pinning group — start-pinned\n * columns can only swap with start-pinned, unpinned with unpinned, and\n * end-pinned with end-pinned.\n *\n * @attr column-reordering\n */\n @property({ type: Boolean, attribute: 'column-reordering' })\n public columnReordering = false;\n\n /**\n * Shows a persistent vertical divider on the trailing edge of every column\n * header, rather than only the frozen-column pin edges.\n *\n * @remarks\n * On by default. On columns that opt into resizing (via\n * {@link BaseColumnConfiguration.resizable}) the divider doubles as the\n * resize handle: it takes the `col-resize` cursor and can be dragged to\n * resize, so the always-visible line is also the grab target. On\n * non-resizable columns it is purely decorative.\n *\n * Because the default is `true`, hide the dividers by setting the property to\n * `false` (`grid.columnSeparator = false`); the reflected `column-separator`\n * attribute is then removed. The line's color and vertical inset are themeable\n * through the `--ag-header-separator` / `--header-separator-color` custom\n * properties and `--apex-header-separator-inset`.\n *\n * @attr column-separator\n */\n @property({ type: Boolean, attribute: 'column-separator', reflect: true })\n public columnSeparator = true;\n\n /**\n * Inline editing configuration for the grid.\n *\n * @remarks\n * Editing is disabled by default. Set `enabled: true` and (optionally) `mode`\n * (`'cell' | 'row'`) and `trigger` (`'click' | 'doubleClick'`) to opt in.\n * Per-column opt-in is required via {@link BaseColumnConfiguration.editable}.\n *\n * @example\n * ```ts\n * grid.editing = { enabled: true, mode: 'cell', trigger: 'doubleClick' };\n * ```\n */\n @property({ attribute: false })\n public editing?: GridEditingConfiguration;\n\n /**\n * Row selection configuration for the grid.\n *\n * @remarks\n * Selection is disabled by default. Set `enabled: true` and (optionally)\n * `mode` (`'single' | 'multiple'`) and `showCheckboxColumn` to opt in.\n *\n * @example\n * ```ts\n * grid.selection = { enabled: true, mode: 'multiple', showCheckboxColumn: true };\n * ```\n */\n @property({ attribute: false })\n public selection?: GridSelectionConfiguration;\n\n /**\n * The currently selected rows, in insertion order.\n *\n * @remarks\n * Returned as a plain array snapshot — mutating the returned array does\n * not change the grid's selection. Set this property to replace the\n * selection programmatically (goes through the cancellable\n * `rowSelecting` event).\n */\n public get selectedRows(): T[] {\n return this.stateController.selection.selectedRows();\n }\n\n public set selectedRows(rows: ReadonlyArray<T>) {\n void this.stateController.selection.replaceSelection(rows);\n }\n\n /**\n * Selects `row`, replacing the existing selection in `'single'` mode or\n * adding to it in `'multiple'` mode.\n *\n * @returns `true` if the selection changed, `false` if the change was\n * rejected by a `rowSelecting` listener or selection is disabled.\n */\n public selectRow(row: T): Promise<boolean> {\n return this.stateController.selection.selectRow(row);\n }\n\n /**\n * Deselects `row`. No-op if `row` is not currently selected.\n */\n public deselectRow(row: T): Promise<boolean> {\n return this.stateController.selection.deselectRow(row);\n }\n\n /**\n * Toggles selection of `row`.\n */\n public toggleRowSelection(row: T): Promise<boolean> {\n return this.stateController.selection.toggleRow(row);\n }\n\n /**\n * Selects every row in the current view ({@link dataView}). No-op in\n * `'single'` selection mode.\n */\n public selectAllRows(): Promise<boolean> {\n return this.stateController.selection.selectAll();\n }\n\n /**\n * Clears the row selection.\n */\n public clearSelection(): Promise<boolean> {\n return this.stateController.selection.clear();\n }\n\n /**\n * Whether `row` is currently selected.\n */\n public isRowSelected(row: T): boolean {\n return this.stateController.selection.isSelected(row);\n }\n\n /**\n * Row-expansion (master-detail) configuration for the grid.\n *\n * @remarks\n * Expansion is disabled by default. Set `enabled: true` and supply a\n * `detailTemplate` to opt in. The default UX renders a chevron toggle in a\n * dedicated leading column; set `showToggleColumn: false` to drive\n * expansion entirely through the public API or a custom cell template.\n *\n * @example\n * ```ts\n * grid.expansion = {\n * enabled: true,\n * detailTemplate: ({ data }) => html`<order-summary .order=${data}></order-summary>`,\n * };\n * ```\n */\n @property({ attribute: false })\n public expansion?: GridExpansionConfiguration<T>;\n\n /**\n * Row-pinning configuration.\n *\n * @remarks\n * Disabled by default. Set `enabled: true` to allow pinning rows to a sticky\n * top / bottom band via {@link ApexGrid.pinRow}.\n *\n * @example\n * ```ts\n * grid.rowPinning = { enabled: true };\n * grid.pinRow(grid.data[0], 'top');\n * ```\n */\n @property({ attribute: false })\n public rowPinning?: GridRowPinningConfiguration;\n\n /**\n * Row-reordering configuration.\n *\n * @remarks\n * Disabled by default. Set `enabled: true` to allow drag / keyboard reorder\n * and {@link ApexGrid.moveRow}. A manual order is mutually exclusive with\n * column sorting (applying a sort clears it). Set `applyToData: true` to also\n * splice {@link ApexGrid.data} in place.\n *\n * @example\n * ```ts\n * grid.rowReordering = { enabled: true };\n * ```\n */\n @property({ attribute: false })\n public rowReordering?: GridRowReorderingConfiguration;\n\n /**\n * Transient spreadsheet coordinate hints: when `true`, a leading row-number\n * gutter (1, 2, 3, ...) and A / B / C column letters are revealed so cell\n * references are discoverable. Enterprise toggles this while a formula cell is\n * being edited; it can also be set directly for a persistent spreadsheet look.\n * Reflected so styling / tests can observe it on the host.\n */\n @property({ type: Boolean, reflect: true, attribute: 'coordinate-hints' })\n public coordinateHints = false;\n\n /**\n * Whether column headers show the column-menu (kebab) button. On by default,\n * and the button is always visible (not hover-only). Set to `false` to hide it\n * entirely; a feature module's menu (e.g. the enterprise context menu) stays\n * reachable by right-click. This is a JS property (no attribute) so it can\n * stay `true` by default.\n */\n @property({ attribute: false })\n public columnMenu = true;\n\n /**\n * Column groups rendered as spanning headers above the column header row.\n *\n * @remarks\n * A column joins a group via its {@link BaseColumnConfiguration.group} id.\n * Members must be contiguous within one pin region. `columns` stays flat — all\n * width / pin / resize / reorder machinery is unchanged; grouping is a\n * presentational header layer. v1 ships static spanning headers (no collapse).\n *\n * @example\n * ```ts\n * grid.columnGroups = [{ id: 'name', headerText: 'Name' }];\n * grid.columns = [{ key: 'first', group: 'name' }, { key: 'last', group: 'name' }];\n * ```\n */\n @property({ attribute: false })\n public columnGroups?: ColumnGroupConfiguration[];\n\n /**\n * Whether a group header row should render: at least one configured group has\n * a visible member column.\n */\n public get hasColumnGroups(): boolean {\n if (!this.columnGroups?.length) return false;\n const ids = new Set(this.columnGroups.map((group) => group.id));\n return this.columns.some((column) => !column.hidden && column.group && ids.has(column.group));\n }\n\n /**\n * Number of group header rows above the column header (0 or 1 in v1).\n */\n public get columnGroupDepth(): number {\n return this.hasColumnGroups ? 1 : 0;\n }\n\n /**\n * The currently expanded rows, in insertion order.\n *\n * @remarks\n * Returned as a plain array snapshot — mutating the returned array does\n * not change the grid's expansion state. Set this property to replace the\n * expansion set programmatically (goes through the cancellable\n * `rowExpanding` event).\n */\n public get expandedRows(): T[] {\n return this.stateController.expansion.expandedRows();\n }\n\n public set expandedRows(rows: ReadonlyArray<T>) {\n void this.stateController.expansion.replaceExpansion(rows);\n }\n\n /**\n * Expands `row`. No-op when the row is already expanded, expansion is\n * disabled, or the optional `isExpandable` predicate rejects it.\n */\n public expandRow(row: T): Promise<boolean> {\n return this.stateController.expansion.expandRow(row);\n }\n\n /**\n * Collapses `row`. No-op when the row is not currently expanded.\n */\n public collapseRow(row: T): Promise<boolean> {\n return this.stateController.expansion.collapseRow(row);\n }\n\n /**\n * Toggles expansion of `row`.\n */\n public toggleRowExpansion(row: T): Promise<boolean> {\n return this.stateController.expansion.toggleRow(row);\n }\n\n /**\n * Expands every row in {@link ApexGrid.dataView} that passes the optional\n * `isExpandable` predicate.\n */\n public expandAllRows(): Promise<boolean> {\n return this.stateController.expansion.expandAll();\n }\n\n /**\n * Collapses every currently expanded row.\n */\n public collapseAllRows(): Promise<boolean> {\n return this.stateController.expansion.collapseAll();\n }\n\n /**\n * Whether `row` is currently expanded.\n */\n public isRowExpanded(row: T): boolean {\n return this.stateController.expansion.isExpanded(row);\n }\n\n /**\n * Tree-data (nested rows) configuration for the grid.\n *\n * @remarks\n * Tree mode keeps {@link ApexGrid.data} flat; the grid derives the\n * hierarchy from a user-supplied `getDataPath(row)` callback (the\n * flat-array \"tree data\" pattern). When enabled, the first visible data column (or\n * the column referenced by `groupColumnKey`) renders a chevron toggle\n * and depth-based indentation.\n *\n * @example\n * ```ts\n * grid.tree = {\n * enabled: true,\n * getDataPath: (row) => row.path, // e.g., ['Adrian'], ['Adrian', 'Bryan']\n * defaultExpanded: true,\n * };\n * ```\n */\n @property({ attribute: false })\n public tree?: GridTreeConfiguration<T>;\n\n /**\n * Toggles tree-expansion of `row`. No-op when tree mode is disabled or\n * the row has no children.\n */\n public toggleTreeRow(row: T): Promise<boolean> {\n return this.stateController.tree.toggleRow(row);\n }\n\n /**\n * Expands a tree row. No-op when the row is already expanded, has no\n * children, or tree mode is disabled.\n */\n public expandTreeRow(row: T): Promise<boolean> {\n return this.stateController.tree.expandRow(row);\n }\n\n /**\n * Collapses a tree row. No-op when the row is not currently expanded.\n */\n public collapseTreeRow(row: T): Promise<boolean> {\n return this.stateController.tree.collapseRow(row);\n }\n\n /** Expands every parent row in the current tree. */\n public expandAllTreeRows(): Promise<boolean> {\n return this.stateController.tree.expandAll();\n }\n\n /** Collapses every currently-expanded tree row. */\n public collapseAllTreeRows(): Promise<boolean> {\n return this.stateController.tree.collapseAll();\n }\n\n /** Whether `row` is currently expanded in the tree. */\n public isTreeRowExpanded(row: T): boolean {\n return this.stateController.tree.isExpanded(row);\n }\n\n /**\n * Set the sort state for the grid.\n */\n public set sortExpressions(expressions: SortExpression<T>[]) {\n if (expressions.length) {\n this.sort(expressions);\n }\n }\n\n /**\n * Get the sort state for the grid.\n */\n @property({ attribute: false })\n public get sortExpressions(): SortExpression<T>[] {\n return Array.from(this.stateController.sorting.state.values());\n }\n\n /**\n * Set the filter state for the grid.\n */\n public set filterExpressions(expressions: FilterExpression<T>[]) {\n if (expressions.length) {\n this.filter(expressions);\n }\n }\n\n /**\n * Get the filter state for the grid.\n */\n @property({ attribute: false })\n public get filterExpressions(): FilterExpression<T>[] {\n const expressions: FilterExpression<T>[] = [];\n\n for (const each of this.stateController.filtering.state.values) {\n expressions.push(...each.all);\n }\n\n return expressions;\n }\n\n /**\n * Returns the collection of rendered row elements in the grid.\n *\n * @remarks\n * Since the grid has virtualization, this property returns only the currently rendered\n * chunk of elements in the DOM.\n */\n public get rows() {\n return Array.from(this._rows);\n }\n\n /**\n * Returns the state of the data source after sort/filter operations\n * have been applied.\n */\n public get dataView(): ReadonlyArray<T> {\n return this.dataState;\n }\n\n /**\n * The columns in visual render order: `'start'`-pinned columns first, then\n * unpinned columns, then `'end'`-pinned columns.\n *\n * @remarks\n * Use this when you need to iterate the columns in the same order the grid\n * actually displays them (for example to build a column chooser). Public APIs\n * like {@link ApexGrid.getColumn} continue to operate on the user-supplied\n * {@link ApexGrid.columns} array.\n */\n public get displayColumns(): ReadonlyArray<ColumnConfiguration<T>> {\n return getDisplayColumns(this.columns);\n }\n\n /**\n * The total number of items in the {@link ApexGrid.dataView} collection.\n *\n * @remarks\n * This is always the post-filter, post-sort row count — pagination does not change it.\n * Use {@link ApexGrid.pageItems} to read the rows currently rendered into the body.\n */\n public get totalItems() {\n if (this.pagination?.mode === 'remote') {\n return Math.max(0, this.pagination?.totalItems ?? 0);\n }\n return this.dataState.length;\n }\n\n /**\n * The records currently rendered into the virtualized body.\n *\n * @remarks\n * Equal to {@link ApexGrid.dataView} when pagination is disabled. With pagination\n * enabled (`'local'` mode) this is the active page slice.\n */\n public get pageItems(): ReadonlyArray<T> {\n // Pinned rows are lifted out of the scrollable body and rendered in their\n // own sticky bands, so they're excluded here to avoid duplication. The\n // exclusion happens before pagination so a pinned row never consumes a body\n // page slot.\n const rowPin = this.stateController.rowPin;\n const base =\n rowPin?.enabled && rowPin.hasPinnedRows\n ? this.dataState.filter((row) => !rowPin.isPinned(row))\n : this.dataState;\n if (!this.stateController.pagination.enabled) return base;\n if (this.pagination?.mode === 'remote') return base;\n const { page, pageSize } = this.stateController.pagination;\n if (!pageSize) return base;\n const start = page * pageSize;\n return base.slice(start, start + pageSize);\n }\n\n /**\n * The current zero-based page index.\n */\n @property({ attribute: false })\n public get page(): number {\n return this.stateController.pagination.page;\n }\n\n public set page(value: number) {\n this.stateController.pagination.gotoPage(value);\n }\n\n /**\n * The current page size.\n */\n @property({ attribute: false })\n public get pageSize(): number {\n return this.stateController.pagination.pageSize;\n }\n\n public set pageSize(value: number) {\n this.stateController.pagination.setPageSize(value);\n }\n\n /**\n * The total number of pages computed from {@link ApexGrid.totalItems} and {@link ApexGrid.pageSize}.\n */\n public get pageCount(): number {\n return this.stateController.pagination.pageCount;\n }\n\n @watch('columns')\n protected watchColumns(_: ColumnConfiguration<T>[], newConfig: ColumnConfiguration<T>[] = []) {\n this.columns = newConfig.map((config) => ({ ...DEFAULT_COLUMN_CONFIG, ...config }));\n }\n\n @watch('data')\n protected dataChanged() {\n // Shallow copy of the array — items keep reference equality with\n // `this.data` so cell edits can write through to the source record.\n let next: T[] = [...this.data];\n autoGenerateColumns(this);\n // Tree controller needs to re-apply `defaultExpanded` against the new\n // record set when data is swapped wholesale.\n this.stateController?.tree?.resetForDataChange();\n // Tree mode applies its flatten step synchronously here so the first\n // paint shows the right shape. Sort/filter/quickFilter still run via\n // the async pipeline on subsequent updates — they take this dataState\n // as input and re-apply tree at the end. Running tree both here and\n // inside the pipeline is idempotent because `process` is pure.\n if (this.stateController?.tree?.enabled) {\n next = this.stateController.tree.process(next);\n }\n // Run any feature-module row transforms (e.g. enterprise grouping) so\n // injected rows appear on first paint, not only after the async pipeline.\n // Identity pass-through when no modules are registered (community grid).\n this.dataState = this.stateController ? this.stateController.applyModuleTransforms(next) : next;\n if (this.hasUpdated) {\n this.pipeline();\n }\n }\n\n @watch(PIPELINE)\n protected async pipeline() {\n this.dataState = await this.dataController.apply([...this.data], this.stateController);\n this.stateController.pagination.reclamp();\n }\n\n @watch('pagination')\n protected paginationChanged() {\n const ctrl = this.stateController?.pagination;\n if (!ctrl) return;\n const next = this.pagination ?? {};\n if (typeof next.pageSize === 'number' && next.pageSize > 0) {\n ctrl.pageSize = next.pageSize;\n }\n if (typeof next.page === 'number') {\n ctrl.page = next.page;\n }\n if (this.hasUpdated) {\n this.pipeline();\n }\n }\n\n @watch('quickFilter')\n protected quickFilterChanged() {\n if (this.hasUpdated) {\n this.pipeline();\n }\n }\n\n protected override updated(): void {\n // Expose ARIA grid semantics on the host so screen readers announce the\n // structure correctly. We do this in `updated()` (post-render) rather\n // than `willUpdate()` because `@watch('data')` runs *after* the original\n // willUpdate via decorator wrapping — reading `pageItems` earlier would\n // see a stale (empty) `dataState`.\n this.setAttribute('role', this.stateController.tree.enabled ? 'treegrid' : 'grid');\n const pinned = this.stateController.rowPin.pinnedRows;\n this.setAttribute(\n 'aria-rowcount',\n String(this.headerRowCount + pinned.top.length + this.pageItems.length + pinned.bottom.length)\n );\n const visibleColumns = this.columns.filter((column) => !column.hidden).length;\n const extras =\n (this.stateController.selection.showCheckboxColumn ? 1 : 0) +\n (this.stateController.expansion.showToggleColumn ? 1 : 0);\n this.setAttribute('aria-colcount', String(visibleColumns + extras));\n\n const selection = this.stateController.selection;\n if (selection.enabled && selection.mode === 'multiple') {\n this.setAttribute('aria-multiselectable', 'true');\n } else {\n this.removeAttribute('aria-multiselectable');\n }\n\n // Roving tabindex: once a cell is active it is the body's single tab stop,\n // so the scroll container leaves the tab order. Keeping both focusable\n // would make Shift+Tab bounce off the container back into the grid (a\n // keyboard trap). With no active cell the container stays the entry point.\n if (this.scrollContainer) {\n this.scrollContainer.tabIndex = this.stateController.active === SENTINEL_NODE ? 0 : -1;\n }\n\n // Default accessible name for the host. An author-provided `aria-label`\n // or `aria-labelledby` always wins; only the value this grid set itself\n // is kept in sync (e.g. when `localeText` changes).\n const currentLabel = this.getAttribute('aria-label');\n const authorLabeled =\n this.hasAttribute('aria-labelledby') ||\n (currentLabel !== null && currentLabel !== this.#autoAriaLabel);\n if (!authorLabeled) {\n const label = this.localize('grid.label');\n if (currentLabel !== label) this.setAttribute('aria-label', label);\n this.#autoAriaLabel = label;\n }\n\n this.#emitStateChangedIfNeeded();\n }\n\n /** The `aria-label` value this grid last auto-applied (never an author's). */\n #autoAriaLabel: string | null = null;\n\n /**\n * Listener count for `stateChanged`, so the (potentially non-trivial) snapshot\n * is only computed while something is actually listening.\n */\n #stateChangedListeners = 0;\n /** Serialized last-emitted state, to fire `stateChanged` only on real changes. */\n #lastStateJson: string | null = null;\n\n public override addEventListener<\n K extends keyof M,\n M extends ApexGridEventMap<T> & HTMLElementEventMap,\n >(\n type: K,\n listener: (this: HTMLElement, ev: M[K]) => unknown,\n options?: boolean | AddEventListenerOptions\n ): void;\n public override addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions\n ): void {\n if (type === 'stateChanged') {\n this.#stateChangedListeners += 1;\n // Baseline at subscription time so the next real change is the first emit.\n this.#lastStateJson = this.hasUpdated ? JSON.stringify(this.getState()) : null;\n }\n (\n super.addEventListener as (\n t: string,\n l: EventListenerOrEventListenerObject,\n o?: boolean | AddEventListenerOptions\n ) => void\n )(type, listener, options);\n }\n\n public override removeEventListener<\n K extends keyof M,\n M extends ApexGridEventMap<T> & HTMLElementEventMap,\n >(\n type: K,\n listener: (this: HTMLElement, ev: M[K]) => unknown,\n options?: boolean | EventListenerOptions\n ): void;\n public override removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions\n ): void {\n if (type === 'stateChanged') {\n this.#stateChangedListeners = Math.max(0, this.#stateChangedListeners - 1);\n }\n (\n super.removeEventListener as (\n t: string,\n l: EventListenerOrEventListenerObject,\n o?: boolean | EventListenerOptions\n ) => void\n )(type, listener, options);\n }\n\n /**\n * Emit `stateChanged` when the restorable state differs from the last emitted\n * snapshot. No-op (and no snapshot computed) when nothing is listening. Called\n * from `updated()`, so the snapshot reflects the settled post-pipeline view.\n */\n #emitStateChangedIfNeeded(): void {\n if (this.#stateChangedListeners === 0) return;\n const snapshot = this.getState();\n const json = JSON.stringify(snapshot);\n if (json === this.#lastStateJson) return;\n this.#lastStateJson = json;\n this.emitEvent('stateChanged', { detail: { state: snapshot } });\n }\n\n protected override firstUpdated(): void {\n // The component declares `:host { display: grid }` for its internal track\n // layout (header / filter / virtualized body). If a consumer rule overrides\n // it, the virtualizer collapses and only a few rows render. Warn loudly so\n // the failure mode isn't silent.\n if (typeof getComputedStyle === 'function' && getComputedStyle(this).display !== 'grid') {\n // biome-ignore lint/suspicious/noConsole: intentional one-shot user diagnostic\n console.warn(\n '[apex-grid] Host `display` has been overridden. The grid requires ' +\n '`display: grid` for its internal track layout and will not render correctly. ' +\n 'Remove any CSS rule that sets `display` on <apex-grid>. ' +\n 'See: https://github.com/apexcharts/apexgrid#4-size-the-host'\n );\n }\n }\n\n /**\n * Performs a filter operation in the grid based on the passed expression(s).\n */\n public filter(config: FilterExpression<T> | FilterExpression<T>[]) {\n this.stateController.filtering.filter(\n asArray(config).map((each) =>\n typeof each.condition === 'string'\n ? // XXX: Types\n Object.assign(each, {\n condition: (getFilterOperandsFor(this.getColumn(each.key)!) as any)[each.condition],\n })\n : each\n )\n );\n }\n\n /**\n * Performs a sort operation in the grid based on the passed expression(s).\n */\n public sort(expressions: SortExpression<T> | SortExpression<T>[]) {\n this.stateController.sorting.sort(expressions);\n }\n\n /**\n * Returns a serializable, JSON-safe snapshot of the grid's restorable state:\n * column layout, sort, filter, quick-filter, pagination, selection, expansion,\n * tree expansion, and any feature-module state. Functions and templates are\n * omitted (see {@link GridState}).\n *\n * @remarks\n * Pair with {@link ApexGrid.setState} to persist/restore views, drive an AI\n * assistant, or implement save/restore. Set {@link ApexGrid.rowId} for\n * selection/expansion to survive a wholesale data reload.\n *\n * @example\n * ```ts\n * const snapshot = grid.getState();\n * localStorage.setItem('grid', JSON.stringify(snapshot));\n * // later …\n * grid.setState(JSON.parse(localStorage.getItem('grid')!));\n * ```\n */\n public getState(options?: GetStateOptions<T>): GridState {\n const rowId = options?.rowId ?? this.rowId;\n const pinned = this.stateController.rowPin.pinnedRows;\n const manualOrder = this.stateController.rowReorder.getManualOrder();\n return {\n version: 1,\n columns: serializeColumnLayout(this.columns),\n sort: serializeSort(this.sortExpressions),\n filter: serializeFilter(this.filterExpressions),\n quickFilter: this.quickFilter,\n pagination: { page: this.page, pageSize: this.pageSize },\n selection: serializeRowRefs(this.selectedRows, this.data, rowId),\n expansion: serializeRowRefs(this.expandedRows, this.data, rowId),\n treeExpanded: serializeRowRefs([...this.stateController.tree.expanded], this.data, rowId),\n treeExpandedKeys: [...this.stateController.tree.expandedKeys],\n rowPinning: {\n top: serializeRowRefs(pinned.top, this.data, rowId),\n bottom: serializeRowRefs(pinned.bottom, this.data, rowId),\n },\n rowOrder: manualOrder ? serializeRowRefs(manualOrder, this.data, rowId) : null,\n modules: this.stateController.serializeModuleState(),\n };\n }\n\n /**\n * A machine-readable description of the grid: its columns and data types, the\n * operations available per column (sort directions, filter operands), the\n * grid-level capabilities, and the current {@link ApexGrid.getState} snapshot.\n *\n * @remarks\n * This is the contract an AI layer hands to an LLM (to constrain its output)\n * and validates a returned patch against before {@link ApexGrid.setState}, but\n * it is AI-agnostic: it equally drives a view-editor UI or documentation. It is\n * a descriptor, not a JSON-Schema document. The enterprise grid extends it with\n * grouping / pivot / aggregation availability.\n */\n public getSchema(): GridSchema {\n return {\n version: 1,\n columns: this.columns.map((column) => columnSchema(column)),\n capabilities: {\n sort: {\n directions: ['ascending', 'descending'],\n multi: Boolean(this.sortConfiguration?.multiple),\n },\n filter: { operandsByType: operandsByType(this.columns) },\n pagination: Boolean(this.pagination?.enabled),\n selection: this.selection?.enabled ? (this.selection.mode ?? 'multiple') : false,\n rowPinning: Boolean(this.rowPinning?.enabled),\n rowReordering: Boolean(this.rowReordering?.enabled),\n },\n state: this.getState(),\n };\n }\n\n /**\n * Applies a (partial) state snapshot produced by {@link ApexGrid.getState}.\n *\n * @remarks\n * Only the slices present on `state` are applied — omit a slice to leave it\n * untouched (e.g. pass `{ sort }` to change only sorting). A present-but-empty\n * `sort`/`filter` array clears that operation. Slices are applied in dependency\n * order (columns → sort → filter → quick-filter → module structure → row order\n * → tree → expansion → row pinning → selection → pagination) so row-referencing\n * state resolves against the transformed view. `rowOrder` is mutually exclusive\n * with an active `sort`: a snapshot carrying both keeps the sort and drops\n * `rowOrder`.\n *\n * **Defensive by design.** `setState` is written into by persisted blobs and\n * LLM output, so it never throws on malformed input (unless\n * {@link SetStateOptions.strict}): unknown columns / operands, out-of-range\n * pages, unresolvable rows, and wrong-typed slices are dropped, clamped, or\n * skipped, each recorded in the returned {@link SetStateResult}.\n */\n public setState(state: Partial<GridState>, options?: SetStateOptions<T>): SetStateResult {\n const rowId = options?.rowId ?? this.rowId;\n const strict = options?.strict ?? false;\n const applied: string[] = [];\n const warnings: string[] = [];\n const warn = (message: string): void => {\n if (strict) throw new Error(`[apex-grid] setState: ${message}`);\n warnings.push(message);\n };\n\n // Defensive accessors: a wrong-typed slice is skipped with a warning rather\n // than throwing mid-apply.\n const asArray = <V>(value: unknown, label: string): V[] | null => {\n if (value === undefined) return null;\n if (!Array.isArray(value)) {\n warn(`${label}: expected an array, got ${typeof value}; skipped`);\n return null;\n }\n return value as V[];\n };\n const resolveCounted = (refs: ReadonlyArray<RowRef>, label: string): T[] => {\n const rows = resolveRowRefs(refs, this.data, rowId);\n if (rows.length < refs.length) {\n warn(\n `${label}: ${refs.length - rows.length} of ${refs.length} row(s) could not be resolved`\n );\n }\n return rows;\n };\n\n if (state.version !== undefined && state.version !== 1) {\n warn(\n `unsupported snapshot version ${String(state.version)}; applying recognized slices best-effort`\n );\n }\n\n const columns = asArray<ColumnLayoutState>(state.columns, 'columns');\n if (columns) {\n this.columns = applyColumnLayout(this.columns, columns);\n applied.push('columns');\n }\n\n const sort = asArray<SortStateSnapshot>(state.sort, 'sort');\n if (sort) {\n this.stateController.sorting.reset();\n const valid: SortStateSnapshot[] = [];\n for (const entry of sort) {\n if (this.getColumn(entry.key as Keys<T>)) {\n valid.push(entry);\n } else {\n warn(`sort: unknown column \"${entry.key}\"; dropped`);\n }\n }\n if (valid.length) this.sort(valid as unknown as SortExpression<T>[]);\n applied.push('sort');\n }\n\n const filter = asArray<GridState['filter'][number]>(state.filter, 'filter');\n if (filter) {\n this.stateController.filtering.reset();\n const expressions = deserializeFilter<T>(\n filter,\n (key) => this.getColumn(key as Keys<T>),\n (snapshot, reason) => warn(`filter: \"${snapshot.key}\" dropped (${reason})`)\n );\n if (expressions.length) this.filter(expressions);\n applied.push('filter');\n }\n\n if (state.quickFilter !== undefined) {\n if (typeof state.quickFilter === 'string') {\n this.quickFilter = state.quickFilter;\n applied.push('quickFilter');\n } else {\n warn(`quickFilter: expected a string, got ${typeof state.quickFilter}; skipped`);\n }\n }\n\n // Module structure (e.g. grouping / pivot) before the row-referencing slices,\n // so the transformed view exists when selection / expansion are resolved.\n if (state.modules !== undefined) {\n if (state.modules && typeof state.modules === 'object') {\n this.stateController.restoreModuleState(state.modules);\n applied.push('modules');\n } else {\n warn(`modules: expected an object, got ${typeof state.modules}; skipped`);\n }\n }\n\n // Manual row order, applied after sort so the conflict is resolvable here:\n // a manual order is mutually exclusive with sorting, so drop it when the\n // restored state also carries an active sort (the sort wins).\n if (state.rowOrder !== undefined) {\n if (state.rowOrder === null) {\n this.stateController.rowReorder.restoreManualOrder(null);\n applied.push('rowOrder');\n } else {\n const order = asArray<RowRef>(state.rowOrder, 'rowOrder');\n if (order) {\n if (this.sortExpressions.length) {\n warn('rowOrder dropped: a manual order is mutually exclusive with an active sort');\n } else {\n this.stateController.rowReorder.restoreManualOrder(resolveCounted(order, 'rowOrder'));\n }\n applied.push('rowOrder');\n }\n }\n }\n\n if (state.treeExpanded !== undefined || state.treeExpandedKeys !== undefined) {\n const refs = asArray<RowRef>(state.treeExpanded, 'treeExpanded') ?? [];\n const keys = asArray<string>(state.treeExpandedKeys, 'treeExpandedKeys') ?? [];\n this.stateController.tree.restoreExpansion(resolveCounted(refs, 'treeExpanded'), keys);\n applied.push('tree');\n }\n\n const expansion = asArray<RowRef>(state.expansion, 'expansion');\n if (expansion) {\n this.expandedRows = resolveCounted(expansion, 'expansion');\n applied.push('expansion');\n }\n\n if (state.rowPinning !== undefined) {\n const pinning = state.rowPinning;\n if (pinning && typeof pinning === 'object') {\n this.stateController.rowPin.restore(\n resolveCounted(asArray<RowRef>(pinning.top, 'rowPinning.top') ?? [], 'rowPinning.top'),\n resolveCounted(\n asArray<RowRef>(pinning.bottom, 'rowPinning.bottom') ?? [],\n 'rowPinning.bottom'\n )\n );\n applied.push('rowPinning');\n } else {\n warn(`rowPinning: expected an object, got ${typeof pinning}; skipped`);\n }\n }\n\n const selection = asArray<RowRef>(state.selection, 'selection');\n if (selection) {\n this.selectedRows = resolveCounted(selection, 'selection');\n applied.push('selection');\n }\n\n if (state.pagination !== undefined) {\n const pagination = state.pagination;\n if (pagination && typeof pagination === 'object') {\n const { page, pageSize } = pagination;\n if (pageSize !== undefined) {\n if (typeof pageSize === 'number' && Number.isFinite(pageSize) && pageSize > 0) {\n this.pageSize = pageSize;\n } else {\n warn(`pagination: invalid pageSize ${String(pageSize)}; ignored`);\n }\n }\n if (page !== undefined) {\n if (typeof page === 'number' && Number.isFinite(page)) {\n const requested = Math.trunc(page);\n this.page = requested;\n if (this.page !== requested) {\n warn(`pagination: page ${requested} out of range; clamped to ${this.page}`);\n }\n } else {\n warn(`pagination: invalid page ${String(page)}; ignored`);\n }\n }\n applied.push('pagination');\n } else {\n warn(`pagination: expected an object, got ${typeof pagination}; skipped`);\n }\n }\n\n this.requestUpdate(PIPELINE);\n\n const skipped = SET_STATE_SLICES.filter((slice) => !applied.includes(slice));\n return { applied, skipped, warnings };\n }\n\n /**\n * Resets the current sort state of the control.\n */\n public clearSort(key?: Keys<T>) {\n this.stateController.sorting.reset(key);\n this.requestUpdate(PIPELINE);\n }\n\n /**\n * Resets the current filter state of the control.\n */\n public clearFilter(key?: Keys<T>) {\n this.stateController.filtering.reset(key);\n this.requestUpdate(PIPELINE);\n }\n\n /**\n * Navigates the grid to the given zero-based `page` index.\n *\n * @remarks\n * Emits the cancellable `pageChanging` event before applying the change and the\n * `pageChanged` event after. Out-of-range values are clamped into `[0, pageCount - 1]`.\n *\n * @param page - The target zero-based page index.\n * @returns `true` if the change was applied, `false` if cancelled or a no-op.\n *\n * @example\n * ```ts\n * await grid.gotoPage(2);\n * ```\n */\n public gotoPage(page: number): Promise<boolean> {\n return this.stateController.pagination.gotoPage(page);\n }\n\n /**\n * Updates the grid's page size and returns to the first page.\n *\n * @remarks\n * Emits the cancellable `pageChanging` event before applying the change and the\n * `pageChanged` event after.\n *\n * @param size - The new page size (must be a positive integer).\n * @returns `true` if the change was applied, `false` if cancelled or a no-op.\n */\n public setPageSize(size: number): Promise<boolean> {\n return this.stateController.pagination.setPageSize(size);\n }\n\n /**\n * Navigates to the next page. No-op if already on the last page.\n */\n public nextPage() {\n return this.stateController.pagination.nextPage();\n }\n\n /**\n * Navigates to the previous page. No-op if already on the first page.\n */\n public previousPage() {\n return this.stateController.pagination.previousPage();\n }\n\n /**\n * Navigates to the first page.\n */\n public firstPage() {\n return this.stateController.pagination.firstPage();\n }\n\n /**\n * Navigates to the last page.\n */\n public lastPage() {\n return this.stateController.pagination.lastPage();\n }\n\n /**\n * Applies a new quick-filter (global search) value, emitting the cancellable\n * `quickFilterChanging` event first and the `quickFilterChanged` event after the\n * pipeline has run.\n *\n * @param value - The new quick-filter value. Pass `''` to clear.\n * @returns `true` if the change was applied, `false` if cancelled or a no-op.\n *\n * @example\n * ```ts\n * await grid.setQuickFilter('john');\n * ```\n */\n public async setQuickFilter(value: string): Promise<boolean> {\n const next = value ?? '';\n if (next === this.quickFilter) return false;\n\n const proceed = this.emitEvent('quickFilterChanging', {\n detail: { value: this.quickFilter, nextValue: next },\n cancelable: true,\n });\n if (!proceed) return false;\n\n this.quickFilter = next;\n this.stateController.pagination.page = 0;\n await this.updateComplete;\n this.emitEvent('quickFilterChanged', { detail: { value: this.quickFilter } });\n return true;\n }\n\n /**\n * Returns a {@link ColumnConfiguration} for a given column.\n */\n public getColumn(id: Keys<T> | number) {\n return typeof id === 'number'\n ? this.columns.at(id)\n : this.columns.find(({ key }) => key === id);\n }\n\n /**\n * Updates the column configuration of the grid.\n *\n * @remarks\n * Each updated column is replaced with a fresh object reference so that cells\n * and headers re-render with the new template / configuration. The\n * user-supplied `columns` array is also reassigned for Lit reactivity.\n */\n public updateColumns(columns: ColumnConfiguration<T> | ColumnConfiguration<T>[]) {\n const updates = new Map(asArray(columns).map((c) => [c.key, c]));\n if (updates.size === 0) return;\n\n let touched = false;\n const next = this.columns.map((column) => {\n const patch = updates.get(column.key);\n if (!patch) return column;\n touched = true;\n return { ...column, ...patch };\n });\n\n if (!touched) return;\n this.columns = next;\n this.requestUpdate(PIPELINE);\n }\n\n /**\n * Pins a column to one of the grid's edges, or unpins it when `position` is `null`.\n *\n * @remarks\n * Emits the cancellable `columnPinning` event first and the `columnPinned`\n * event after the update is applied. The user-supplied {@link ApexGrid.columns}\n * array is not reordered — only the visual render order changes.\n *\n * @param key - The target column key.\n * @param position - `'start'`, `'end'`, or `null` to unpin.\n * @returns `true` if the change was applied, `false` if cancelled or a no-op.\n *\n * @example\n * ```ts\n * await grid.pinColumn('name', 'start');\n * await grid.pinColumn('actions', 'end');\n * ```\n */\n public async pinColumn(key: Keys<T>, position: PinPosition): Promise<boolean> {\n const column = this.getColumn(key);\n if (!column) return false;\n\n const previous = column.pinned ?? null;\n const next = position ?? null;\n if (previous === next) return false;\n\n const proceed = this.emitEvent('columnPinning', {\n detail: { key, previous, next },\n cancelable: true,\n });\n if (!proceed) return false;\n\n column.pinned = next ?? undefined;\n this.columns = [...this.columns];\n await this.updateComplete;\n this.emitEvent('columnPinned', { detail: { key, pinned: next } });\n return true;\n }\n\n /**\n * Unpins a column. Equivalent to {@link ApexGrid.pinColumn}(`key`, `null`).\n *\n * @param key - The target column key.\n * @returns `true` if the change was applied, `false` if the column was already\n * unpinned or the operation was cancelled.\n */\n public unpinColumn(key: Keys<T>): Promise<boolean> {\n return this.pinColumn(key, null);\n }\n\n /**\n * The cell currently in edit mode, or `null`.\n */\n public get editingCell(): { rowIndex: number; columnKey: Keys<T> } | null {\n const active = this.stateController.editing.activeCell;\n return active ? { rowIndex: active.rowIndex, columnKey: active.columnKey } : null;\n }\n\n /**\n * The view-relative index of the row currently in edit mode (row edit mode\n * only), or `null`.\n */\n public get editingRow(): number | null {\n return this.stateController.editing.activeRow?.rowIndex ?? null;\n }\n\n /**\n * Begins editing the cell at `(rowIndex, columnKey)`.\n *\n * @remarks\n * `rowIndex` is the view-relative index (matches {@link ApexGrid.pageItems}).\n * Returns `false` when the column isn't editable, the row index is out of\n * range, or the request was rejected (for example in row mode with pending\n * changes that couldn't be committed).\n */\n public editCell(rowIndex: number, columnKey: Keys<T>): Promise<boolean> {\n return this.stateController.editing.editCell(rowIndex, columnKey);\n }\n\n /**\n * Begins editing the entire row at `rowIndex` (row edit mode only).\n *\n * @returns `false` when editing is disabled, the grid is in cell mode, or\n * the row index is out of range.\n */\n public editRow(rowIndex: number): Promise<boolean> {\n return this.stateController.editing.editRow(rowIndex);\n }\n\n /**\n * Commits the current edit.\n *\n * @remarks\n * In cell mode this writes the active cell's pending value. In row mode it\n * flushes all pending values for the active row. Emits `cellValueChanging`\n * per changed cell (cancellable) and `cellValueChanged` after, followed by\n * `rowEditEnded` in row mode.\n */\n public commitEdit(): Promise<boolean> {\n const editing = this.stateController.editing;\n return editing.mode === 'row' ? editing.commitRow() : editing.commitCell();\n }\n\n /**\n * Discards the current edit without writing back to {@link ApexGrid.data}.\n */\n public cancelEdit(): void {\n const editing = this.stateController.editing;\n if (editing.mode === 'row') {\n editing.cancelRow();\n } else {\n editing.cancelCell();\n }\n }\n\n /**\n * Whether there is a recorded edit to undo.\n *\n * @remarks\n * Always `false` unless `editing.history.enabled` is set.\n */\n public get canUndo(): boolean {\n return this.stateController.history.canUndo;\n }\n\n /**\n * Whether there is a previously-undone edit to redo.\n */\n public get canRedo(): boolean {\n return this.stateController.history.canRedo;\n }\n\n /**\n * Reverts the most recent cell-data edit (single, row-mode, or bulk paste /\n * fill commits each as one step). No-op when there is nothing to undo or\n * history is disabled.\n */\n public undo(): void {\n this.stateController.history.undo();\n }\n\n /**\n * Re-applies the most recently undone edit. No-op when there is nothing to\n * redo or history is disabled.\n */\n public redo(): void {\n this.stateController.history.redo();\n }\n\n /**\n * Clears the undo / redo stacks.\n */\n public clearHistory(): void {\n this.stateController.history.clear();\n }\n\n /**\n * Pins `row` to a sticky top or bottom band, lifting it out of the scrolling\n * body. Moves it between bands when already pinned elsewhere.\n *\n * @remarks\n * Requires `rowPinning.enabled`. Goes through the cancellable `rowPinning`\n * event and emits `rowPinned` on success. Identity is by reference, so pass\n * the same object held in {@link ApexGrid.data}.\n *\n * @returns `true` when applied, `false` when disabled or cancelled.\n */\n public pinRow(row: T, position: RowPinPosition = 'top'): boolean {\n return this.stateController.rowPin.pinRow(row, position);\n }\n\n /**\n * Unpins `row` from whichever band holds it, returning it to the scrolling\n * body.\n *\n * @returns `true` when applied (or already unpinned), `false` when cancelled.\n */\n public unpinRow(row: T): boolean {\n return this.stateController.rowPin.unpinRow(row);\n }\n\n /**\n * The currently pinned rows per band, in the order they were pinned.\n */\n public get pinnedRows(): { top: T[]; bottom: T[] } {\n return this.stateController.rowPin.pinnedRows;\n }\n\n /**\n * Moves the row at view index `from` to land `position` (`'before'` /\n * `'after'`) the row at view index `to`. Indices are into\n * {@link ApexGrid.pageItems}.\n *\n * @remarks\n * Requires `rowReordering.enabled`. Establishes a manual order (mutually\n * exclusive with column sorting), goes through the cancellable `rowMoving`\n * event, emits `rowMoved`, and animates the affected rows.\n *\n * @returns `true` when applied, `false` when disabled, out of range, or\n * cancelled.\n */\n public moveRow(from: number, to: number, position: RowDropPosition = 'before'): boolean {\n return this.stateController.rowReorder.moveRow(from, to, position);\n }\n\n /**\n * Exports the current grid contents as a CSV string and (in a browser\n * context) triggers a download.\n *\n * @remarks\n * By default the export uses the post-filter/post-sort `dataView`, includes\n * every visible column with `exportable !== false`, and prepends a UTF-8 BOM\n * so Excel opens the file with the right encoding. Pass `source: 'page'` to\n * export only the current page, `source: 'selected'` to export the current\n * row selection, or `source: 'all'` to export the raw `data` array. The\n * returned string is the same content written to the file — useful for\n * tests or routing the bytes elsewhere.\n *\n * @example\n * ```ts\n * grid.exportToCSV(); // download data.csv\n * grid.exportToCSV({ filename: 'users', source: 'selected' });\n * const text = grid.exportToCSV({ filename: '' }); // string only, no download\n * ```\n */\n public exportToCSV(options: CSVExportOptions<T> = {}): string {\n const csv = buildCSV(this, options);\n const filename = options.filename;\n if (filename) {\n downloadBlob(`${filename}.csv`, csv, 'text/csv;charset=utf-8;');\n } else if (filename === undefined) {\n downloadBlob('data.csv', csv, 'text/csv;charset=utf-8;');\n }\n return csv;\n }\n\n /**\n * The export formats offered in the toolbar's export menu, in order.\n *\n * @remarks\n * The community grid offers CSV only. This is the seam derived grids use to\n * contribute more formats: `@apexcharts/grid-enterprise` overrides it to add\n * `'xlsx'`. The toolbar renders one menu item per entry and dispatches the\n * chosen id to {@link ApexGrid.exportAs}.\n */\n public get exportFormats(): ReadonlyArray<ExportFormat> {\n return [{ id: 'csv', label: 'Export CSV' }];\n }\n\n /**\n * Custom action buttons rendered in the toolbar's trailing actions area, in\n * order.\n *\n * @remarks\n * The community grid contributes none. This is the seam derived grids use to\n * add toolbar buttons (mirroring {@link ApexGrid.exportFormats}):\n * `@apexcharts/grid-enterprise` overrides it to add a \"Create chart\" action.\n * The toolbar renders one button per entry and calls its `run()` on click.\n */\n public get toolbarActions(): ReadonlyArray<ToolbarAction> {\n return [];\n }\n\n /**\n * Exports the grid in the given format (one of {@link ApexGrid.exportFormats}).\n * Called by the toolbar's export menu. The community grid handles `'csv'`;\n * derived grids override to handle additional formats, delegating to `super`\n * for the ones they don't add.\n */\n public exportAs(formatId: string, options: ExportOptions<T> = {}): void {\n if (formatId === 'csv') {\n this.exportToCSV(options as CSVExportOptions<T>);\n }\n }\n\n /**\n * Moves a column relative to another column.\n *\n * @remarks\n * Emits the cancellable `columnMoving` event first and `columnMoved` after.\n * Reordering only succeeds when the source and target columns share the same\n * pinning group (start / unpinned / end) — cross-group moves return `false`.\n * Use {@link ApexGrid.pinColumn} to change a column's pinning group first.\n *\n * @param fromKey - The column to move.\n * @param toKey - The reference column.\n * @param position - Whether to place `fromKey` before or after `toKey`. Defaults to `'before'`.\n * @returns `true` if the move was applied, `false` if cancelled or a no-op.\n *\n * @example\n * ```ts\n * await grid.moveColumn('email', 'name', 'after');\n * ```\n */\n public async moveColumn(\n fromKey: Keys<T>,\n toKey: Keys<T>,\n position: ColumnDropPosition = 'before'\n ): Promise<boolean> {\n if (fromKey === toKey) return false;\n const fromIndex = this.columns.findIndex((column) => column.key === fromKey);\n const toIndex = this.columns.findIndex((column) => column.key === toKey);\n if (fromIndex < 0 || toIndex < 0) return false;\n\n const source = this.columns[fromIndex];\n const target = this.columns[toIndex];\n if ((source.pinned ?? null) !== (target.pinned ?? null)) return false;\n\n const proceed = this.emitEvent('columnMoving', {\n detail: { key: fromKey, fromIndex, toKey, position },\n cancelable: true,\n });\n if (!proceed) return false;\n\n const next = this.columns.slice();\n const [moved] = next.splice(fromIndex, 1);\n let insertIndex = next.findIndex((column) => column.key === toKey);\n if (insertIndex < 0) return false;\n if (position === 'after') insertIndex += 1;\n next.splice(insertIndex, 0, moved);\n\n if (next.every((column, index) => column === this.columns[index])) return false;\n\n this.columns = next;\n await this.updateComplete;\n const resolvedIndex = this.columns.findIndex((column) => column.key === fromKey);\n this.emitEvent('columnMoved', {\n detail: { key: fromKey, fromIndex, toIndex: resolvedIndex },\n });\n return true;\n }\n\n @eventOptions({ capture: true })\n protected bodyClickHandler(event: MouseEvent) {\n const target = event.composedPath().find((el) => el instanceof ApexGridCell) as ApexGridCell<T>;\n if (target) {\n this.stateController.active = {\n column: target.column.key,\n row: target.row.index,\n };\n // The active cell is the body's roving tab stop; give it real focus so\n // keyboard navigation continues from the clicked cell. Skip while an\n // editor is open (the editor owns focus).\n if (!target.editing) target.focus({ preventScroll: true });\n }\n }\n\n protected bodyKeydownHandler(event: KeyboardEvent) {\n // Navigation drives from the scroll container (the tab entry point) or\n // from a focused cell (the roving tab stop). Keys originating inside an\n // open editor or an embedded control (button, input) are left alone.\n const origin = event.composedPath()[0];\n const fromBody = this.scrollContainer.isSameNode(event.target as HTMLElement);\n const fromCell = origin instanceof ApexGridCell && !origin.editing;\n if (fromBody || fromCell) {\n this.stateController.navigation.navigate(event);\n }\n }\n\n /**\n * Tabbing into the grid body lands on the scroll container; forward focus to\n * the active cell (when one exists) so the roving tab stop is honored.\n */\n protected bodyFocusHandler(event: FocusEvent) {\n if (this.scrollContainer.isSameNode(event.target as HTMLElement)) {\n this.stateController.navigation.focusActiveCell();\n }\n }\n\n /**\n * Forwards body-cell pointer interactions (press / drag-over / release) to\n * feature modules via {@link StateController.handleCellInteraction}. Gated on\n * there being at least one registered module so the community grid does no\n * per-event work (it registers none). The seam a range-selection feature\n * builds on.\n */\n protected bodyPointerHandler(event: PointerEvent) {\n if (this.stateController.modules.size === 0) return;\n // `pointermove` drives the drag-extend (`over`): tracking the move (not just\n // cell-entry via `pointerover`) means a cell is flagged the instant the\n // cursor crosses into it, even while in-range cells re-render under the\n // pointer. Plain hover moves carry no held button, so skip them — a drag\n // always opens with a `pointerdown` that keeps the button down.\n if (event.type === 'pointermove' && event.buttons === 0) return;\n const target = event.composedPath().find((el) => el instanceof ApexGridCell) as\n | ApexGridCell<T>\n | undefined;\n if (!target?.row) return;\n const kind: CellInteractionKind =\n event.type === 'pointerdown' ? 'down' : event.type === 'pointerup' ? 'up' : 'over';\n this.stateController.handleCellInteraction({\n kind,\n row: target.row.data,\n rowIndex: target.row.index,\n column: target.column,\n shiftKey: event.shiftKey,\n ctrlKey: event.ctrlKey,\n metaKey: event.metaKey,\n originalEvent: event,\n });\n }\n\n protected renderGroupHeaderRow() {\n if (!this.hasColumnGroups) return nothing;\n return html`\n <apex-grid-group-header-row\n style=${styleMap(this.DOM.columnSizes)}\n .columns=${this.DOM.displayColumns}\n .pinOffsets=${this.DOM.pinOffsets}\n .groups=${this.columnGroups ?? []}\n ></apex-grid-group-header-row>\n `;\n }\n\n protected renderHeaderRow() {\n return html`\n <apex-grid-header-row\n style=${styleMap(this.DOM.columnSizes)}\n .columns=${this.DOM.displayColumns}\n .pinOffsets=${this.DOM.pinOffsets}\n .coordinateHints=${this.coordinateHints}\n ></apex-grid-header-row>\n `;\n }\n\n protected renderBody() {\n return html`\n <apex-virtualizer\n .items=${this.pageItems as T[]}\n .renderItem=${this.DOM.rowRenderer}\n @click=${this.bodyClickHandler}\n @keydown=${this.bodyKeydownHandler}\n @focusin=${this.bodyFocusHandler}\n @pointerdown=${this.bodyPointerHandler}\n @pointermove=${this.bodyPointerHandler}\n @pointerup=${this.bodyPointerHandler}\n ></apex-virtualizer>\n `;\n }\n\n /** Number of chrome rows above the body (group header + header + optional filter). */\n protected get headerRowCount(): number {\n return this.columnGroupDepth + 1 + (this.columns.some((column) => column.filter) ? 1 : 0);\n }\n\n protected renderPinnedTop() {\n const rowPin = this.stateController.rowPin;\n if (!rowPin.enabled) return nothing;\n const rows = rowPin.pinnedRows.top;\n if (rows.length === 0) return nothing;\n return html`<div part=\"pinned-rows pinned-top\">\n ${rows.map((data, i) => this.DOM.pinnedRowRenderer(data, i, this.headerRowCount))}\n </div>`;\n }\n\n protected renderPinnedBottom() {\n const rowPin = this.stateController.rowPin;\n if (!rowPin.enabled) return nothing;\n const rows = rowPin.pinnedRows.bottom;\n if (rows.length === 0) return nothing;\n // Pinned-bottom rows follow the chrome rows, the pinned-top band, and the\n // body in the aria-rowindex sequence.\n const offset = this.headerRowCount + rowPin.pinnedRows.top.length + this.pageItems.length;\n return html`<div part=\"pinned-rows pinned-bottom\">\n ${rows.map((data, i) => this.DOM.pinnedRowRenderer(data, i, offset))}\n </div>`;\n }\n\n protected renderFilterRow() {\n // The filter row is a floating panel overlay (position: fixed), not a grid\n // row. It must stay in the shadow root so the @query selector can find it,\n // but it takes up no layout space when inactive.\n return this.columns.some((column) => column.filter)\n ? html`<apex-filter-row></apex-filter-row>`\n : nothing;\n }\n\n protected renderToolbar() {\n // Toolbar is shared by all toolbar-housed features. Render it whenever\n // any one of them is enabled.\n if (!this.showQuickFilter && !this.showExport && this.toolbarActions.length === 0) {\n return nothing;\n }\n return html`<apex-grid-toolbar\n .value=${this.quickFilter}\n .showQuickFilter=${this.showQuickFilter}\n .showExport=${this.showExport}\n @apex-quick-filter=${(event: CustomEvent<string>) => {\n event.stopPropagation();\n this.setQuickFilter(event.detail);\n }}\n ></apex-grid-toolbar>`;\n }\n\n protected renderPaginator() {\n if (!this.stateController.pagination.enabled) return nothing;\n const options =\n this.pagination?.pageSizeOptions && this.pagination.pageSizeOptions.length > 0\n ? this.pagination.pageSizeOptions\n : [10, 25, 50, 100];\n return html`<apex-grid-paginator .pageSizeOptions=${options}></apex-grid-paginator>`;\n }\n\n /**\n * Renders a visually-hidden polite live region. Status messages set via\n * {@link announce} land here; screen readers will read them aloud without\n * stealing focus. We intentionally keep this in the shadow root so we\n * don't have to coordinate consumer DOM placement.\n */\n protected renderLiveRegion() {\n return html`<div\n part=\"live-region\"\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n style=\"position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;\"\n >\n ${this.stateController.announcement}\n </div>`;\n }\n\n /**\n * Floating \"ghost\" of the row being pointer-dragged for reorder. Rendered at\n * the top of the shadow tree (outside the virtualizer) so its `position: fixed`\n * tracks the viewport, and painted from the cell snapshot captured at grab\n * time so it mirrors the row's visible content and column widths.\n */\n protected renderRowDragGhost() {\n const ghost = this.stateController.rowReorder.ghost;\n if (!ghost) return nothing;\n return html`<div\n part=\"row-drag-ghost\"\n style=${styleMap({\n left: `${ghost.x}px`,\n top: `${ghost.y}px`,\n height: `${ghost.height}px`,\n })}\n >\n <span part=\"row-drag-ghost-grip\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\">\n <circle cx=\"6\" cy=\"3.5\" r=\"1.25\" />\n <circle cx=\"10\" cy=\"3.5\" r=\"1.25\" />\n <circle cx=\"6\" cy=\"8\" r=\"1.25\" />\n <circle cx=\"10\" cy=\"8\" r=\"1.25\" />\n <circle cx=\"6\" cy=\"12.5\" r=\"1.25\" />\n <circle cx=\"10\" cy=\"12.5\" r=\"1.25\" />\n </svg>\n </span>\n ${ghost.cells.map(\n (cell) =>\n html`<span\n part=\"row-drag-ghost-cell\"\n style=${styleMap({ width: `${cell.width}px`, textAlign: cell.align })}\n >${cell.text}</span\n >`\n )}\n </div>`;\n }\n\n protected override render() {\n return html`\n ${this.stateController.resizing.renderIndicator()}\n ${this.renderToolbar()}\n ${this.renderGroupHeaderRow()}\n ${this.renderHeaderRow()}\n ${this.renderFilterRow()}\n ${this.renderPinnedTop()}\n ${this.renderBody()}\n ${this.renderPinnedBottom()}\n ${this.renderPaginator()}\n ${this.renderLiveRegion()}\n ${this.renderRowDragGhost()}\n `;\n }\n\n /**\n * Sets the live region's announcement text. Screen readers configured to\n * read polite live updates will read the new value aloud.\n *\n * @remarks\n * Use this from custom UI affordances (e.g. an \"Apply filter\" button) so\n * the change is announced. Built-in operations (sort / filter / page /\n * select / expand) call this internally already.\n */\n public announce(message: string): void {\n this.stateController.setAnnouncement(message);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [ApexGrid.tagName]: ApexGrid<object>;\n }\n}\n"]}