apex-grid 3.5.0 → 3.6.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 (197) hide show
  1. package/CHANGELOG.md +338 -0
  2. package/LICENSE.md +125 -0
  3. package/README.md +64 -10
  4. package/components/cell.d.ts +30 -4
  5. package/components/cell.js +199 -53
  6. package/components/cell.js.map +1 -1
  7. package/components/filter-row.d.ts +2 -0
  8. package/components/filter-row.js +82 -28
  9. package/components/filter-row.js.map +1 -1
  10. package/components/grid.d.ts +146 -36
  11. package/components/grid.js +442 -103
  12. package/components/grid.js.map +1 -1
  13. package/components/group-header-row.js +28 -25
  14. package/components/group-header-row.js.map +1 -1
  15. package/components/header-row.d.ts +7 -5
  16. package/components/header-row.js +11 -9
  17. package/components/header-row.js.map +1 -1
  18. package/components/header.js +32 -20
  19. package/components/header.js.map +1 -1
  20. package/components/row.d.ts +19 -3
  21. package/components/row.js +69 -23
  22. package/components/row.js.map +1 -1
  23. package/components/toolbar.js +2 -1
  24. package/components/toolbar.js.map +1 -1
  25. package/components/virtualizer.d.ts +40 -0
  26. package/components/virtualizer.js +116 -5
  27. package/components/virtualizer.js.map +1 -1
  28. package/controllers/dom.d.ts +4 -4
  29. package/controllers/dom.js +40 -22
  30. package/controllers/dom.js.map +1 -1
  31. package/controllers/editing.d.ts +104 -37
  32. package/controllers/editing.js +230 -78
  33. package/controllers/editing.js.map +1 -1
  34. package/controllers/expansion.d.ts +14 -5
  35. package/controllers/expansion.js +24 -1
  36. package/controllers/expansion.js.map +1 -1
  37. package/controllers/filter.d.ts +10 -2
  38. package/controllers/filter.js +62 -17
  39. package/controllers/filter.js.map +1 -1
  40. package/controllers/history.d.ts +45 -8
  41. package/controllers/history.js +58 -20
  42. package/controllers/history.js.map +1 -1
  43. package/controllers/navigation.d.ts +67 -13
  44. package/controllers/navigation.js +191 -51
  45. package/controllers/navigation.js.map +1 -1
  46. package/controllers/pagination.d.ts +6 -0
  47. package/controllers/pagination.js +10 -2
  48. package/controllers/pagination.js.map +1 -1
  49. package/controllers/reorder.js +38 -22
  50. package/controllers/reorder.js.map +1 -1
  51. package/controllers/resize.d.ts +17 -2
  52. package/controllers/resize.js +16 -6
  53. package/controllers/resize.js.map +1 -1
  54. package/controllers/row-pin.d.ts +20 -2
  55. package/controllers/row-pin.js +16 -9
  56. package/controllers/row-pin.js.map +1 -1
  57. package/controllers/row-reorder.d.ts +31 -11
  58. package/controllers/row-reorder.js +117 -37
  59. package/controllers/row-reorder.js.map +1 -1
  60. package/controllers/selection.d.ts +11 -4
  61. package/controllers/selection.js +26 -11
  62. package/controllers/selection.js.map +1 -1
  63. package/controllers/sort.d.ts +22 -2
  64. package/controllers/sort.js +29 -23
  65. package/controllers/sort.js.map +1 -1
  66. package/controllers/state.d.ts +56 -7
  67. package/controllers/state.js +76 -6
  68. package/controllers/state.js.map +1 -1
  69. package/controllers/tree.d.ts +15 -10
  70. package/controllers/tree.js +0 -0
  71. package/controllers/tree.js.map +1 -1
  72. package/custom-elements.json +3156 -277
  73. package/docs/assets/hierarchy.js +1 -1
  74. package/docs/assets/highlight.css +15 -8
  75. package/docs/assets/navigation.js +1 -1
  76. package/docs/assets/search.js +1 -1
  77. package/docs/classes/ApexGrid.html +155 -81
  78. package/docs/classes/ApexGridPaginator.html +1 -1
  79. package/docs/classes/ApexGridToolbar.html +3 -3
  80. package/docs/functions/localize.html +2 -2
  81. package/docs/hierarchy.html +1 -1
  82. package/docs/index.html +74 -11
  83. package/docs/interfaces/ApexCellValidationFailedEvent.html +3 -2
  84. package/docs/interfaces/ApexCellValueChangedEvent.html +4 -2
  85. package/docs/interfaces/ApexCellValueChangingEvent.html +3 -2
  86. package/docs/interfaces/ApexGridEventMap.html +5 -2
  87. package/docs/interfaces/ApexRowEditEndedEvent.html +2 -1
  88. package/docs/interfaces/ApexRowEditStartedEvent.html +2 -1
  89. package/docs/interfaces/ApexRowMovingEvent.html +9 -3
  90. package/docs/interfaces/ApexRowPinningEvent.html +1 -1
  91. package/docs/interfaces/ApexTreeRowExpandedEvent.html +4 -1
  92. package/docs/interfaces/ApexTreeRowExpandingEvent.html +4 -1
  93. package/docs/interfaces/BaseApexCellContext.html +1 -1
  94. package/docs/interfaces/BaseApexEditorContext.html +1 -1
  95. package/docs/interfaces/BaseFilterExpression.html +2 -2
  96. package/docs/interfaces/CSVExportOptions.html +12 -4
  97. package/docs/interfaces/DataPipelineConfiguration.html +1 -1
  98. package/docs/interfaces/ExportOptions.html +5 -3
  99. package/docs/interfaces/GridExpansionConfiguration.html +6 -2
  100. package/docs/interfaces/GridRowReorderingConfiguration.html +1 -1
  101. package/docs/interfaces/PaginationState.html +1 -1
  102. package/docs/interfaces/SetStateResult.html +3 -2
  103. package/docs/interfaces/ValidatorContext.html +7 -2
  104. package/docs/media/_token-values.scss +118 -0
  105. package/docs/media/package.json +3 -2
  106. package/docs/modules.html +1 -1
  107. package/docs/types/ExportSource.html +6 -4
  108. package/docs/types/OperandKeys.html +9 -0
  109. package/docs/variables/EN_LOCALE.html +2 -2
  110. package/i18n/en.d.ts +5 -0
  111. package/i18n/en.js +5 -0
  112. package/i18n/en.js.map +1 -1
  113. package/i18n/es.js +5 -0
  114. package/i18n/es.js.map +1 -1
  115. package/internal/column-types.d.ts +27 -1
  116. package/internal/column-types.js +75 -49
  117. package/internal/column-types.js.map +1 -1
  118. package/internal/constants.d.ts +1 -2
  119. package/internal/constants.js +0 -4
  120. package/internal/constants.js.map +1 -1
  121. package/internal/document-styles.d.ts +30 -0
  122. package/internal/document-styles.js +48 -0
  123. package/internal/document-styles.js.map +1 -0
  124. package/internal/export.d.ts +39 -7
  125. package/internal/export.js +35 -34
  126. package/internal/export.js.map +1 -1
  127. package/internal/feature-module.d.ts +60 -3
  128. package/internal/feature-module.js +6 -0
  129. package/internal/feature-module.js.map +1 -1
  130. package/internal/index.d.ts +6 -4
  131. package/internal/index.js +5 -3
  132. package/internal/index.js.map +1 -1
  133. package/internal/normalize-case.d.ts +8 -1
  134. package/internal/normalize-case.js +3 -2
  135. package/internal/normalize-case.js.map +1 -1
  136. package/internal/state-snapshot.d.ts +60 -8
  137. package/internal/state-snapshot.js +87 -19
  138. package/internal/state-snapshot.js.map +1 -1
  139. package/internal/types.d.ts +17 -2
  140. package/internal/types.js.map +1 -1
  141. package/internal/utils.d.ts +34 -6
  142. package/internal/utils.js +30 -21
  143. package/internal/utils.js.map +1 -1
  144. package/internal/validators.js +1 -0
  145. package/internal/validators.js.map +1 -1
  146. package/operations/filter/operands/number.js +9 -6
  147. package/operations/filter/operands/number.js.map +1 -1
  148. package/operations/filter/operands/string.js +2 -3
  149. package/operations/filter/operands/string.js.map +1 -1
  150. package/operations/filter/types.d.ts +13 -1
  151. package/operations/filter/types.js.map +1 -1
  152. package/operations/filter.d.ts +6 -0
  153. package/operations/filter.js +23 -7
  154. package/operations/filter.js.map +1 -1
  155. package/operations/quick-filter.js +2 -5
  156. package/operations/quick-filter.js.map +1 -1
  157. package/operations/sort.d.ts +21 -2
  158. package/operations/sort.js +41 -14
  159. package/operations/sort.js.map +1 -1
  160. package/package.json +8 -3
  161. package/setup.d.ts +11 -0
  162. package/setup.js +9 -19
  163. package/setup.js.map +1 -1
  164. package/styles/_token-values.css.d.ts +1 -0
  165. package/styles/_token-values.css.js +3 -0
  166. package/styles/_token-values.css.js.map +1 -0
  167. package/styles/_tokens.css.js +1 -1
  168. package/styles/_tokens.css.js.map +1 -1
  169. package/styles/body-cell/body-cell.css.js +1 -1
  170. package/styles/body-cell/body-cell.css.js.map +1 -1
  171. package/styles/body-cell/cell-renderers.css.js +1 -1
  172. package/styles/body-cell/cell-renderers.css.js.map +1 -1
  173. package/styles/body-row/body-row.css.js +1 -1
  174. package/styles/body-row/body-row.css.js.map +1 -1
  175. package/styles/document-tokens.css.d.ts +1 -0
  176. package/styles/document-tokens.css.js +3 -0
  177. package/styles/document-tokens.css.js.map +1 -0
  178. package/styles/filter-row/filter-row.css.js +1 -1
  179. package/styles/filter-row/filter-row.css.js.map +1 -1
  180. package/styles/grid/_grid.base.css.js +1 -1
  181. package/styles/grid/_grid.base.css.js.map +1 -1
  182. package/styles/grid/grid.css.js +1 -1
  183. package/styles/grid/grid.css.js.map +1 -1
  184. package/styles/group-header-row/group-header-row.css.js +1 -1
  185. package/styles/group-header-row/group-header-row.css.js.map +1 -1
  186. package/styles/header-cell/header-cell.css.js +1 -1
  187. package/styles/header-cell/header-cell.css.js.map +1 -1
  188. package/styles/header-row/header-row.base.css.js +1 -1
  189. package/styles/header-row/header-row.base.css.js.map +1 -1
  190. package/styles/paginator/paginator.css.js +1 -1
  191. package/styles/paginator/paginator.css.js.map +1 -1
  192. package/styles/toolbar/toolbar.css.js +1 -1
  193. package/styles/toolbar/toolbar.css.js.map +1 -1
  194. package/tokens.css +78 -0
  195. package/LICENSE +0 -80
  196. package/docs/media/LICENSE +0 -80
  197. package/docs/media/_tokens.scss +0 -214
@@ -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,aAAa,EAAE,MAAM,0BAA0B,CA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N,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CACiB;AAiBzC;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+CACuB;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;AAk9BS;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/** 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\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; where an Ignite UI palette is\n * present, the brand tokens auto-tint from it. 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` where an Ignite UI palette 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 * @fires cellValidationFailed - Emitted when a candidate cell value is rejected by a column validator; the value is not written.\n * @fires historyChanged - Emitted after the undo / redo stacks change; carries the current `canUndo` / `canRedo`.\n * @fires stateChanged - Emitted (debounced) whenever the grid's restorable state changes; carries the new `getState` snapshot.\n * @fires rowPinning - Cancellable. Emitted before a row is pinned, moved between bands, or unpinned.\n * @fires rowPinned - Emitted after a row's pin state has changed.\n * @fires rowMoving - Cancellable. Emitted before a row is moved via drag, keyboard, or `moveRow`.\n * @fires rowMoved - Emitted after a row has been moved.\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 * Applies many cell edits as a **single** operation.\n *\n * Every write goes through the same choke point interactive editing uses, so\n * each one emits the cancellable `cellValueChanging` and then\n * `cellValueChanged`, and runs the column's validators. What differs from\n * calling {@link editCell} + {@link commitEdit} in a loop is that the whole\n * set lands as one undo step and triggers one pipeline run, which is the\n * point: a thousand `editCell` round-trips would be a thousand entries in the\n * undo stack and a thousand re-renders.\n *\n * `rowIndex` is view-relative and matches {@link ApexGrid.pageItems}, the same\n * as {@link editCell}. Edits naming an unknown column, a row index out of\n * range, or a column the user could not edit either (editing off, not\n * `editable`, or hidden — the same gate interactive editing uses) are skipped\n * rather than throwing, so a partially-stale batch still applies what it can.\n *\n * @param edits Cells to write. Order is preserved, so later edits to the same\n * cell win.\n * @returns A per-outcome tally. `applied` counts cells whose value actually\n * changed; `unchanged`, `invalid` and `cancelled` explain the rest, so a caller\n * can tell a rejected batch from a no-op one.\n *\n * @example Bulk-clear a column for the rows the user selected\n * ```ts\n * grid.applyEdits(\n * grid.selectedRows.map((row) => ({\n * rowIndex: grid.pageItems.indexOf(row),\n * column: 'discount',\n * value: 0,\n * }))\n * );\n * ```\n */\n public applyEdits(edits: ReadonlyArray<{ rowIndex: number; column: Keys<T>; value: unknown }>): {\n applied: number;\n unchanged: number;\n invalid: number;\n cancelled: number;\n skipped: number;\n } {\n const tally = { applied: 0, unchanged: 0, invalid: 0, cancelled: 0, skipped: 0 };\n if (!edits.length) return tally;\n\n const editing = this.stateController.editing;\n const items = this.pageItems;\n // One history entry for the batch, so undo reverses the whole thing.\n this.stateController.history.beginBatch();\n try {\n for (const { rowIndex, column, value } of edits) {\n const record = items.at(rowIndex);\n const config = this.getColumn(column);\n if (!record || rowIndex < 0 || !config || !editing.isEditable(config)) {\n tally.skipped += 1;\n continue;\n }\n tally[editing.applyCellEdit(rowIndex, column, record as T, value)] += 1;\n }\n } finally {\n this.stateController.history.endBatch();\n }\n\n if (tally.applied > 0) this.requestUpdate(PIPELINE);\n return tally;\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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AAK,EAAE,CAAC;sCACQ;AAgEvC;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+CAI9B;AAkBD;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDAgB9B;AAwGD;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;oCAG9B;AA4DD;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;wCAG9B;AAcS;IADT,KAAK,CAAC,SAAS,CAAC;4CAGhB;AAgBS;IADT,KAAK,CAAC,MAAM,CAAC;2CA8Bb;AAgBS;IADT,KAAK,CAAC,YAAY,CAAC;iDAYnB;AAGS;IADT,KAAK,CAAC,aAAa,CAAC;kDAKpB;AAIS;IADT,KAAK,CAAC,MAAM,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;2CAK7C;AAeS;IADT,KAAK,CAAC,QAAQ,CAAC;wCAQf;AAywCS;IADT,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAyB/B","sourcesContent":["import { ContextProvider } from '@lit/context';\nimport { html, nothing, type PropertyDeclaration } 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 { viewIndexer } from '../controllers/history.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 { adoptGridDocumentStyles } from '../internal/document-styles.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 resolveFilterOperand,\n resolveRowRefs,\n SET_STATE_SLICES,\n type SetStateOptions,\n type SetStateResult,\n type SetStateSlice,\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 { asArray, autoGenerateColumns, getDisplayColumns } from '../internal/utils.js';\nimport { watch } from '../internal/watch.js';\nimport type { FilterExpression } from '../operations/filter/types.js';\nimport type { SortExpression, SortingDirection } 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}), or\n * -1 when the record is pinned or on another page.\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 (matches\n * {@link ApexGrid.pageItems}), or -1 when the record is pinned or on\n * another page. Use `data` to identify the row.\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, or -1 when the record\n * is pinned or on another page.\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 /** Whether the row lands before or after the target row. */\n position: RowDropPosition;\n /**\n * The view index the row lands at, resolved from `to` and `position`\n * (`moveRow(0, 3)` lands the row at 2). Splice the row out of `from` and in\n * at `toIndex` to mirror the move.\n */\n toIndex: 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, or -1 when the record is\n * pinned or on another page.\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, or -1 when the record is\n * pinned or on another page.\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 *\n * @remarks\n * A parent that exists only as a path segment (no row of its own in\n * {@link ApexGrid.data}) appears in these arrays as a synthesized placeholder\n * row, not as one of your records.\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 *\n * @remarks\n * A parent that exists only as a path segment (no row of its own in\n * {@link ApexGrid.data}) appears in these arrays as a synthesized placeholder\n * row, not as one of your records.\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 * Attach the listener to the grid element itself: the snapshot is computed\n * only for listeners registered on the grid, so a listener on an ancestor\n * (event delegation) receives nothing while none is attached to the grid.\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/** Sort directions a restored sort may carry (getSchema advertises the first two). */\nconst SORT_DIRECTIONS: ReadonlyArray<SortingDirection> = ['ascending', 'descending', 'none'];\n\n/** Slices that can change the row count, so a page cannot be clamped before they render. */\nconst VIEW_SHAPING_SLICES: ReadonlySet<SetStateSlice> = new Set([\n 'columns',\n 'filter',\n 'quickFilter',\n 'modules',\n 'tree',\n]);\n\n/**\n * Properties whose change can alter the row or page count before the pipeline\n * reruns, each with the fields that matter for a configuration object (`null`:\n * compared by identity). A framework re-binding an equal inline object does\n * not count as a change.\n */\nconst VIEW_SHAPING_PROPERTIES: ReadonlyMap<PropertyKey, readonly string[] | null> = new Map([\n ['data', null],\n ['quickFilter', null],\n ['pagination', ['enabled', 'mode', 'pageSize', 'totalItems']],\n ['tree', ['enabled', 'getDataPath', 'defaultExpanded']],\n ['dataPipelineConfiguration', ['sort', 'filter', 'pagination', 'quickFilter']],\n]);\n\n/** Whether a view-shaping property changed in a way that can alter the row count. */\nfunction viewShapeChanged(fields: readonly string[] | null, before: unknown, after: unknown) {\n if (Object.is(before, after)) return false;\n if (!fields) return true;\n const a = (before ?? {}) as Record<string, unknown>;\n const b = (after ?? {}) as Record<string, unknown>;\n return fields.some((field) => !Object.is(a[field], b[field]));\n}\n\n/** Report a dropped entry from a property setter (no result object to carry it). */\nfunction warnDropped(message: string): void {\n // biome-ignore lint/suspicious/noConsole: the setter has no other channel for a dropped entry\n console.warn(`[apex-grid] ${message}`);\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; where an Ignite UI palette is\n * present, the brand tokens auto-tint from it. 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` where an Ignite UI palette 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)` (`var(--ag-dark-shadow-card)` on a dark grid) 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-dark-grid-bg] - Host card background on `theme=\"dark\"` grids. Dark grids read the `--ag-dark-*` colours instead of the light ones.\n * @cssprop [--ag-dark-surface] - Grid card background on dark grids (must be opaque).\n * @cssprop [--ag-dark-surface-alt] - Alternating row tint on dark grids.\n * @cssprop [--ag-dark-surface-elevated] - Header background on dark grids.\n * @cssprop [--ag-dark-hairline] - Header / structural gridline color on dark grids.\n * @cssprop [--ag-dark-border] - Row separator color on dark grids.\n * @cssprop [--ag-dark-text] - Primary text color on dark grids.\n * @cssprop [--ag-dark-text-body] - Row text color on dark grids.\n * @cssprop [--ag-dark-text-muted] - Muted text (roles, labels) on dark grids.\n * @cssprop [--ag-dark-row-hover] - Row hover wash on dark grids.\n * @cssprop [--ag-dark-shadow-card] - Elevated card shadow for dark grids (see `--ag-grid-shadow`).\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 * @fires cellValidationFailed - Emitted when a candidate cell value is rejected by a column validator; the value is not written.\n * @fires historyChanged - Emitted after the undo / redo stacks change; carries the current `canUndo` / `canRedo`.\n * @fires stateChanged - Emitted (debounced) whenever the grid's restorable state changes; carries the new `getState` snapshot.\n * @fires rowPinning - Cancellable. Emitted before a row is pinned, moved between bands, or unpinned.\n * @fires rowPinned - Emitted after a row's pin state has changed.\n * @fires rowMoving - Cancellable. Emitted before a row is moved via drag, keyboard, or `moveRow`.\n * @fires rowMoved - Emitted after a row has been moved.\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 #data: Array<T> = [];\n\n /**\n * The data source for the grid. `null` or `undefined` (a framework prop that\n * is still loading) is stored as an empty array.\n *\n * @default []\n */\n @property({ attribute: false })\n public get data(): Array<T> {\n return this.#data;\n }\n\n public set data(value: Array<T>) {\n // Keep the current empty array, so a repeated nullish value is no change.\n if (value == null && !this.#data.length) return;\n this.#data = value ?? [];\n }\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 * @default ''\n */\n @property({ type: String, attribute: 'quick-filter' })\n public get quickFilter(): string {\n return this.#quickFilter;\n }\n\n public set quickFilter(value: string) {\n this.#quickFilter = value;\n this.#quickFilterWrites++;\n }\n\n #quickFilter = '';\n /** Counts quickFilter writes, so setQuickFilter sees a listener's own write. */\n #quickFilterWrites = 0;\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 * Expressions assigned through the setters, applied at the next update once\n * the columns settle (they may be bound after the sort or filter, in the same\n * render, or be auto-generated).\n */\n #pendingSort?: SortExpression<T>[];\n #pendingFilter?: FilterExpression<T>[];\n\n /**\n * Set the sort state for the grid.\n *\n * @remarks\n * Replaces the current sort; `[]`, `null` or `undefined` clears it. Applied\n * at the next update, against the columns as they are then.\n */\n public set sortExpressions(expressions: SortExpression<T>[] | null | undefined) {\n this.#pendingSort = [...(expressions ?? [])];\n this.requestUpdate(PIPELINE);\n }\n\n /**\n * Get the sort state for the grid.\n */\n @property({ attribute: false })\n public get sortExpressions(): SortExpression<T>[] {\n if (this.#pendingSort) return [...this.#pendingSort];\n return Array.from(this.stateController.sorting.state.values());\n }\n\n /**\n * Set the filter state for the grid.\n *\n * @remarks\n * Replaces the current filter; `[]`, `null` or `undefined` clears it. Applied\n * at the next update, against the columns as they are then.\n */\n public set filterExpressions(expressions: FilterExpression<T>[] | null | undefined) {\n this.#pendingFilter = [...(expressions ?? [])];\n this.#markViewChange();\n }\n\n /**\n * Get the filter state for the grid.\n */\n @property({ attribute: false })\n public get filterExpressions(): FilterExpression<T>[] {\n if (this.#pendingFilter) {\n // Shaped like the applied state where the column already exists.\n return this.#pendingFilter.map((each) => {\n const resolved = this.#resolveFilter(each);\n return typeof resolved === 'string' ? each : resolved;\n });\n }\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 * `each` resolved against its column on a new object (the caller's may be\n * frozen): the column's defaults under it and an operand name replaced by\n * the live operation. Returns the reason instead when it cannot resolve.\n */\n #resolveFilter(each: FilterExpression<T>): FilterExpression<T> | string {\n const column = each ? this.getColumn(each.key) : undefined;\n if (!column) return `filter: unknown column \"${String(each?.key)}\"; dropped`;\n const defaults = this.stateController.filtering.getDefaultExpression(column);\n const named = each.condition ?? defaults.condition;\n const condition = typeof named === 'string' ? resolveFilterOperand(column, named) : named;\n if (!condition) return `filter: unknown operand \"${named}\" for \"${String(each.key)}\"; dropped`;\n return {\n ...defaults,\n ...each,\n condition,\n criteria: each.criteria ?? 'and',\n } as unknown as FilterExpression<T>;\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 = 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 * @remarks\n * Navigates like {@link ApexGrid.gotoPage}, with the cancellable\n * `pageChanging` and the `pageChanged` events. Assigned before the first\n * render, or while a data, filter or quick filter change has yet to render,\n * the page is kept as given and clamped once the view settles, without those\n * events.\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 if (this.#viewStale) {\n // The row count is about to change: keep the page and let the reclamp\n // after the pipeline clamp it against the settled view.\n this.stateController.pagination.page = Number.isFinite(value)\n ? Math.max(0, Math.trunc(value))\n : 0;\n this.requestUpdate(PIPELINE);\n } else {\n this.stateController.pagination.gotoPage(value);\n }\n }\n\n /**\n * A row count changing input (see VIEW_SHAPING_PROPERTIES) has not rendered\n * yet. Only set alongside a requested update, which clears it.\n */\n #viewChangePending = false;\n /** A run carrying such a change started and the latest run has not settled. */\n #shapingPending = false;\n\n /** Whether the row count may still change, so a page cannot be clamped yet. */\n get #viewStale(): boolean {\n return !this.hasUpdated || this.#viewChangePending || this.#shapingPending;\n }\n\n /** Mark the row count as about to change and request the pipeline that settles it. */\n #markViewChange(): void {\n this.#viewChangePending = true;\n this.requestUpdate(PIPELINE);\n }\n\n public override requestUpdate(\n name?: PropertyKey,\n oldValue?: unknown,\n options?: PropertyDeclaration,\n useNewValue?: boolean,\n newValue?: unknown\n ): void {\n // Before the first render the view is stale anyway (and this runs while\n // the class fields, these flags included, are still being initialised).\n // A shaping change is also a Lit change (a stricter test than identity),\n // so the update requested below clears the flag.\n const fields = name === undefined ? undefined : VIEW_SHAPING_PROPERTIES.get(name);\n if (\n this.hasUpdated &&\n fields !== undefined &&\n viewShapeChanged(fields, oldValue, useNewValue ? newValue : this[name as keyof this])\n ) {\n this.#viewChangePending = true;\n }\n super.requestUpdate(name, oldValue, options, useNewValue, newValue);\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 /**\n * The records undo history, the manual row order and row pins may still\n * name after {@link ApexGrid.data} changes; anything naming another record is\n * dropped. Defaults to `data`. A row model that writes only part of a larger\n * record set into `data` (rows under a collapsed group leave `data` but stay\n * cached and come back as the same objects) overrides this to also yield the\n * records it keeps, so a collapse does not wipe them. Read only while there\n * is history, a manual order or a pin to reconcile.\n */\n protected historyRecords(): Iterable<T> {\n return this.data;\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 // Undo must not replay onto records the grid no longer holds.\n this.stateController?.history?.reconcile(() => this.historyRecords());\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 // The manual order and the pins hold row references: carry them onto the\n // new records so they never point at objects the grid no longer shows.\n const carry = (rows: T[]) => this.#carryRows(rows);\n this.stateController?.rowReorder.resetForDataChange(carry);\n this.stateController?.rowPin.resetForDataChange(carry);\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 // Requested, not called, so every watcher of this update shares one run.\n if (this.hasUpdated) this.requestUpdate(PIPELINE);\n }\n\n /**\n * `rows` matched in the records the grid still holds ({@link historyRecords},\n * so rows a row model keeps cached survive): by `rowId` when set, else by\n * identity.\n */\n #carryRows(rows: T[]): T[] {\n const rowId = this.rowId;\n const records = [...this.historyRecords()];\n if (rowId) return resolveRowRefs(serializeRowRefs(rows, [], rowId), records, rowId);\n const present = new Set(records);\n return rows.filter((row) => present.has(row));\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) this.requestUpdate(PIPELINE);\n }\n\n @watch('quickFilter')\n protected quickFilterChanged() {\n // Also before the first render, so a term set at mount (the attribute or\n // a bound property) filters the first view.\n if (this.hasUpdated || this.quickFilter) this.requestUpdate(PIPELINE);\n }\n\n /** The first render shapes the tree in dataChanged; later changes rebuild it. */\n @watch('tree', { waitUntilFirstUpdate: true })\n protected treeChanged(previous?: GridTreeConfiguration<T>) {\n if (!viewShapeChanged(VIEW_SHAPING_PROPERTIES.get('tree')!, previous, this.tree)) return;\n this.stateController.tree.resetForDataChange();\n this.requestUpdate(PIPELINE);\n }\n\n /** The latest pipeline run; an older one that settles later is dropped. */\n #pipelineRun = 0;\n /**\n * Settles (never rejects) once the latest pipeline run settles. Overlapping\n * runs share it and only the latest one settles it, so a superseded run\n * that is slow, or never settles, does not hold back its waiters.\n */\n #pipelineSettled: Promise<void> = Promise.resolve();\n #settlePipeline: (() => void) | null = null;\n\n // Declared after every watcher that requests it, so each request made while\n // this update's watchers run is seen here and the pipeline runs once.\n @watch(PIPELINE)\n protected pipeline(): Promise<void> {\n if (!this.#settlePipeline) {\n this.#pipelineSettled = new Promise((settle) => {\n this.#settlePipeline = settle;\n });\n }\n return this.#runPipeline(++this.#pipelineRun);\n }\n\n async #runPipeline(run: number): Promise<void> {\n try {\n this.#flushPendingExpressions();\n // The first run, or one carrying a row count change, leaves the page\n // unsettled until the latest run reclamps it, so a run that supersedes\n // an unsettled one carries its change too.\n if (this.#viewChangePending || !this.hasUpdated) this.#shapingPending = true;\n this.#viewChangePending = false;\n const next = await this.dataController.apply([...this.data], this.stateController);\n if (run !== this.#pipelineRun) return;\n this.dataState = next;\n this.stateController.dataVersion++;\n this.stateController.pagination.reclamp();\n } finally {\n // Only the latest run settles; a superseded one leaves the state alone.\n if (run === this.#pipelineRun) {\n this.#settlePipeline?.();\n this.#settlePipeline = null;\n if (this.#shapingPending) {\n this.#shapingPending = false;\n this.#baselineStateIfUnset();\n }\n }\n }\n }\n\n /**\n * Resolves once the pending update, the pipeline runs it started and the\n * render of their result have settled. Events that report the new view\n * (`sorted`, `filtered`, `pageChanged`, `quickFilterChanged`) await this,\n * so with an async pipeline hook they fire after the rows changed.\n */\n protected async pipelineSettled(): Promise<void> {\n await this.updateComplete;\n let settled: Promise<void>;\n do {\n settled = this.#pipelineSettled;\n await settled;\n await this.updateComplete;\n } while (settled !== this.#pipelineSettled);\n }\n\n /** Apply the expressions assigned through the setters, now that columns settled. */\n #flushPendingExpressions(): void {\n const sort = this.#pendingSort;\n const filter = this.#pendingFilter;\n this.#pendingSort = undefined;\n this.#pendingFilter = undefined;\n if (sort) this.#replaceSort(sort, warnDropped);\n if (filter) this.#replaceFilter(filter);\n }\n\n /**\n * Replace the sort with `entries`, dropping (and reporting) any that is not\n * an object, names an unknown column, or carries an unknown direction (an\n * omitted one takes the column default). The one path for the\n * `sortExpressions` setter and the `setState` sort slice.\n */\n #replaceSort(entries: ReadonlyArray<unknown>, warn: (message: string) => void): void {\n this.stateController.sorting.reset();\n const valid: SortExpression<T>[] = [];\n for (const entry of entries) {\n const { direction, ...rest } = (entry ?? {}) as SortExpression<T>;\n if (typeof entry !== 'object' || entry === null || !this.getColumn(rest.key)) {\n warn(`sort: unknown column \"${String(rest.key)}\"; dropped`);\n } else if (direction === undefined) {\n valid.push(rest as SortExpression<T>);\n } else if (SORT_DIRECTIONS.includes(direction)) {\n valid.push(entry as SortExpression<T>);\n } else {\n warn(`sort: invalid direction \"${String(direction)}\"; dropped`);\n }\n }\n if (valid.length) this.sort(valid);\n this.requestUpdate(PIPELINE);\n }\n\n /** Replace the filter with `entries` (unresolvable ones are dropped by `filter`). */\n #replaceFilter(entries: ReadonlyArray<FilterExpression<T>>): void {\n this.#markViewChange();\n this.stateController.filtering.reset();\n if (entries.length) this.filter([...entries]);\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 update's watchers consumed every change requested before it; a\n // pipeline still running is tracked by #shapingPending.\n this.#viewChangePending = false;\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 this.#syncBodyTabStop();\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 * The `stateChanged` listeners registered on the grid, keyed by listener and\n * capture flag the way the DOM dedupes them, so the (potentially\n * non-trivial) snapshot is only computed while something is listening. A\n * `once` listener or one with an aborted `signal` leaves the set when the\n * DOM drops it.\n */\n #stateChangedListeners = new Map<EventListenerOrEventListenerObject, Map<boolean, object>>();\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' && listener) this.#trackStateChangedListener(listener, options);\n (\n super.addEventListener as (\n t: string,\n l: EventListenerOrEventListenerObject,\n o?: boolean | AddEventListenerOptions\n ) => void\n )(type, listener, options);\n }\n\n #trackStateChangedListener(\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions\n ): void {\n const capture = typeof options === 'boolean' ? options : Boolean(options?.capture);\n const captures = this.#stateChangedListeners.get(listener) ?? new Map<boolean, object>();\n // The DOM ignores a duplicate (listener, capture) and an already aborted\n // signal, so neither is tracked.\n if (!captures.has(capture) && !(options as AddEventListenerOptions)?.signal?.aborted) {\n if (!this.#stateChangedListeners.size) {\n // Baseline when the first listener arrives so its first emit is the\n // next real change; later subscribers share it (no re-baseline).\n this.#lastStateJson = this.hasUpdated ? JSON.stringify(this.getState()) : null;\n }\n // A token per registration, so a hook left over from an earlier one\n // cannot untrack the same listener after it is added again.\n const token = {};\n captures.set(capture, token);\n this.#stateChangedListeners.set(listener, captures);\n const forget = () => this.#forgetStateChangedListener(listener, capture, token);\n if (typeof options === 'object') {\n // Registered before the caller's listener, so it fires first, when\n // the DOM has already dropped that listener; one that subscribes\n // itself again from its callback is then tracked anew.\n if (options.once) {\n HTMLElement.prototype.addEventListener.call(this, 'stateChanged', forget, {\n capture,\n once: true,\n });\n }\n options.signal?.addEventListener('abort', forget, { once: true });\n }\n }\n }\n\n #forgetStateChangedListener(\n listener: EventListenerOrEventListenerObject,\n capture: boolean,\n token?: object\n ) {\n const captures = this.#stateChangedListeners.get(listener);\n if (!captures || (token && captures.get(capture) !== token)) return;\n captures.delete(capture);\n if (!captures.size) this.#stateChangedListeners.delete(listener);\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' && listener) {\n const capture = typeof options === 'boolean' ? options : Boolean(options?.capture);\n this.#forgetStateChangedListener(listener, capture);\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.size) return;\n // No baseline yet (subscribed before the first render): the first settled\n // state is the initial one, not a change, so it is recorded, not emitted.\n if (this.#lastStateJson === null) {\n this.#baselineStateIfUnset();\n return;\n }\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 /**\n * Record the initial state for listeners attached before the first render,\n * once the first view settles (its reclamp may still move the page).\n */\n #baselineStateIfUnset(): void {\n if (this.#lastStateJson === null && this.#stateChangedListeners.size && !this.#shapingPending) {\n this.#lastStateJson = JSON.stringify(this.getState());\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n // The `--ag-*` root defaults (and the `setup()` host sizing) live outside\n // the shadow root; see internal/document-styles.ts.\n adoptGridDocumentStyles(this);\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 if (this.#pendingFilter) {\n // Adds onto the assigned filter, which applies at the next update.\n const added = asArray(config);\n this.#pendingFilter.push(...added);\n if (added.length) this.#markViewChange();\n return;\n }\n const expressions: FilterExpression<T>[] = [];\n for (const each of asArray(config)) {\n const resolved = this.#resolveFilter(each);\n if (typeof resolved === 'string') warnDropped(resolved);\n else expressions.push(resolved);\n }\n // Nothing to apply leaves the view, and the page events, as they were.\n if (!expressions.length) return;\n this.#markViewChange();\n this.stateController.filtering.filter(expressions);\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 if (this.#pendingSort) {\n // Adds onto the assigned sort, which applies at the next update.\n this.#pendingSort.push(...asArray(expressions));\n this.requestUpdate(PIPELINE);\n return;\n }\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.pins;\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 // Removing the `quick-filter` attribute sets the property to null.\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: SORT_DIRECTIONS.filter((direction) => direction !== 'none'),\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: SetStateSlice[] = [];\n const warnings: string[] = [];\n // The view is current only when no row count change is waiting to render;\n // a page can be clamped against it now only if no slice below changes it.\n const viewSettled = !this.#viewStale;\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 const unkeyed = columns.filter((entry) => typeof entry?.key !== 'string').length;\n if (unkeyed)\n warn(`columns: ${unkeyed} entr${unkeyed === 1 ? 'y' : 'ies'} without a key; dropped`);\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.#pendingSort = undefined;\n this.#replaceSort(sort, warn);\n applied.push('sort');\n }\n\n const filter = asArray<GridState['filter'][number]>(state.filter, 'filter');\n if (filter) {\n this.#pendingFilter = undefined;\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 this.#replaceFilter(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 this.#markViewChange();\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(\n resolveCounted(refs, 'treeExpanded'),\n keys.filter((key) => typeof key === 'string')\n );\n this.#markViewChange();\n applied.push('tree');\n }\n\n const expansion = asArray<RowRef>(state.expansion, 'expansion');\n if (expansion) {\n const ctrl = this.stateController.expansion;\n const predicate = this.expansion?.isExpandable;\n const rows = resolveCounted(expansion, 'expansion');\n const expected = predicate ? rows.filter((row) => predicate(row)) : rows;\n if (\n this.#replaceRows('expansion', ctrl.enabled, expected, warn, () => {\n void ctrl.replaceExpansion(expected);\n return ctrl.expandedRows();\n })\n ) {\n applied.push('expansion');\n }\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 const ctrl = this.stateController.selection;\n const rows = resolveCounted(selection, 'selection');\n const expected = ctrl.mode === 'single' ? rows.slice(0, 1) : rows;\n if (\n this.#replaceRows('selection', ctrl.enabled, expected, warn, () => {\n void ctrl.replaceSelection(expected);\n return ctrl.selectedRows();\n })\n ) {\n applied.push('selection');\n }\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 const reshaped = applied.some((slice) => VIEW_SHAPING_SLICES.has(slice));\n const ctrl = this.stateController.pagination;\n // Against a stale view (before the first render, or with filters\n // or row structure restored above) keep the page as requested and\n // let the reclamp after the pipeline clamp it to the restored view.\n const next = viewSettled && !reshaped ? ctrl.clamp(requested) : Math.max(0, requested);\n if (next !== requested) {\n warn(`pagination: page ${requested} out of range; clamped to ${next}`);\n }\n ctrl.page = next;\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 * Restore a row slice (selection or expansion) through its controller and\n * report whether it took: a disabled feature or a vetoing `rowSelecting` /\n * `rowExpanding` listener leaves the rows unchanged, which is a warning, not\n * an applied slice. `replace` runs synchronously up to the veto decision.\n */\n #replaceRows(\n label: SetStateSlice,\n enabled: boolean,\n expected: ReadonlyArray<T>,\n warn: (message: string) => void,\n replace: () => ReadonlyArray<T>\n ): boolean {\n if (!enabled) {\n if (expected.length) warn(`${label}: the feature is disabled on this grid; skipped`);\n return !expected.length;\n }\n const actual = new Set(replace());\n const took = actual.size === new Set(expected).size && expected.every((row) => actual.has(row));\n if (!took) warn(`${label}: the change was cancelled by a listener; skipped`);\n return took;\n }\n\n /**\n * Resets the current sort state of the control.\n */\n public clearSort(key?: Keys<T>) {\n if (this.#pendingSort && key !== undefined) {\n this.#pendingSort = this.#pendingSort.filter((each) => each.key !== key);\n } else {\n this.#pendingSort = undefined;\n }\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 if (this.#pendingFilter && key !== undefined) {\n this.#pendingFilter = this.#pendingFilter.filter((each) => each.key !== key);\n } else {\n this.#pendingFilter = undefined;\n }\n this.#markViewChange();\n this.stateController.filtering.reset(key);\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. Moving back to the first page fires `pageChanged` too.\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 previous = this.quickFilter;\n const writes = this.#quickFilterWrites;\n const proceed = this.emitEvent('quickFilterChanging', {\n detail: { value: previous, nextValue: next },\n cancelable: true,\n });\n if (!proceed) return false;\n\n // A listener that assigned quickFilter substituted its own value. A\n // substitute equal to the previous value changes nothing.\n if (this.#quickFilterWrites === writes) this.quickFilter = next;\n if (this.quickFilter === previous) return false;\n const pageReset = this.stateController.pagination.resetPage();\n await this.pipelineSettled();\n await pageReset;\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`. `rowIndex` is view-relative\n * (matches {@link ApexGrid.pageItems}), or -1 when the edited record is\n * pinned or on another page.\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`. It is -1 when the edited record is pinned or on another\n * page.\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 * Applies many cell edits as a **single** operation.\n *\n * Every write goes through the same choke point interactive editing uses, so\n * each one emits the cancellable `cellValueChanging` and then\n * `cellValueChanged`, and runs the column's validators. What differs from\n * calling {@link editCell} + {@link commitEdit} in a loop is that the whole\n * set lands as one undo step and triggers one pipeline run, which is the\n * point: a thousand `editCell` round-trips would be a thousand entries in the\n * undo stack and a thousand re-renders.\n *\n * Name each target cell's row in one of two ways. `rowIndex` is\n * view-relative and matches {@link ApexGrid.pageItems}, the same as\n * {@link editCell}, so it reaches the current page only. `row` is the record\n * itself (a live reference into {@link ApexGrid.data}), which also reaches\n * rows on other pages, pinned rows and rows under a collapsed tree parent;\n * their events and validators see `rowIndex` -1. A `rowIndex` must be a\n * whole number from 0 to `pageItems.length - 1`. Edits naming an unknown\n * column, any other row index (negative, fractional or past the end of the\n * page), a row a feature synthesized (a group header, a total, a row a\n * server has not sent yet), or a column the user could not edit\n * either (editing off, not `editable`, or hidden: the same gate interactive\n * editing uses) are skipped rather than throwing, so a partially-stale batch\n * still applies what it can.\n *\n * @param edits Cells to write. Order is preserved, so later edits to the same\n * cell win.\n * @returns A per-outcome tally. `applied` counts cells whose value actually\n * changed; `unchanged`, `invalid` and `cancelled` explain the rest, so a caller\n * can tell a rejected batch from a no-op one.\n *\n * @example Bulk-clear a column for the rows the user selected, on any page\n * ```ts\n * grid.applyEdits(grid.selectedRows.map((row) => ({ row, column: 'discount', value: 0 })));\n * ```\n */\n public applyEdits(\n edits: ReadonlyArray<\n { column: Keys<T>; value: unknown } & (\n | { rowIndex: number; row?: never }\n | { row: T; rowIndex?: never }\n )\n >\n ): {\n applied: number;\n unchanged: number;\n invalid: number;\n cancelled: number;\n skipped: number;\n } {\n const tally = { applied: 0, unchanged: 0, invalid: 0, cancelled: 0, skipped: 0 };\n if (!edits.length) return tally;\n\n const editing = this.stateController.editing;\n const items = this.pageItems;\n const indexOf = viewIndexer(items, edits.length);\n const version = editing.validationVersion;\n // One history entry for the batch, so undo reverses the whole thing.\n this.stateController.history.beginBatch();\n try {\n for (const { row, rowIndex, column, value } of edits) {\n const record = row ?? items[rowIndex as number];\n const config = this.getColumn(column);\n if (\n !record ||\n !config ||\n !editing.isEditable(config) ||\n !this.stateController.isDataRow(record)\n ) {\n tally.skipped += 1;\n continue;\n }\n const index = row ? indexOf(row) : (rowIndex as number);\n tally[editing.applyCellEdit(index, column, record, value)] += 1;\n }\n } finally {\n this.stateController.history.endBatch();\n }\n\n if (tally.applied > 0) this.requestUpdate(PIPELINE);\n // Rejected or reverted values change only the cells' invalid markers.\n else if (editing.validationVersion !== version) this.requestUpdate();\n return tally;\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 and clears\n * any column sort (the two are mutually exclusive), goes through the\n * cancellable `rowMoving` event, emits `rowMoved`, and animates the affected\n * rows. Rows hidden by a filter keep their place in the order.\n *\n * @returns `true` when applied, `false` when disabled, out of range, a no-op\n * (the row would land where it already is), or 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 next = this.columns.slice();\n const [moved] = next.splice(fromIndex, 1);\n let insertIndex = next.findIndex((column) => column.key === toKey);\n if (position === 'after') insertIndex += 1;\n next.splice(insertIndex, 0, moved);\n // A move that changes nothing is a no-op, with no columnMoving.\n if (next.every((column, index) => column === this.columns[index])) 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 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 /**\n * Whether `event` belongs to this grid, rather than to a grid nested inside\n * it (the grid in a master-detail panel renders inside one of this grid's\n * rows, so its events cross this grid's body on their way out). The first\n * grid, or grid body, on the composed path from the event origin outward is\n * the one that owns it.\n *\n * @param event - an event that reached this grid.\n */\n public ownsEvent(event: Event): boolean {\n for (const node of event.composedPath()) {\n if (node === this || node === this.scrollContainer) return true;\n if (node instanceof ApexGrid || node instanceof ApexVirtualizer) return false;\n }\n return false;\n }\n\n /**\n * Roving tabindex: once a rendered cell is active it is the body's single\n * tab stop, so the scroll container leaves the tab order. Keeping both\n * focusable would make Shift+Tab bounce off the container back into the\n * grid (a keyboard trap). With no active cell, or with the active row\n * scrolled out of the rendered window, the container is the tab stop.\n */\n #syncBodyTabStop(): void {\n const body = this.scrollContainer;\n if (!body) return;\n const active = this.stateController.active;\n body.tabIndex = active !== SENTINEL_NODE && body.isRendered(active.row) ? -1 : 0;\n }\n\n /**\n * The virtualizer is about to re-render a new range of rows. When the row\n * holding focus leaves it, its cell is removed and focus would fall to the\n * document, so the scroll container takes focus first and the keyboard\n * keeps working from the active cell.\n */\n protected bodyRangeChanged(event: Event) {\n const { first, last } = event as Event & { first: number; last: number };\n this.#syncBodyTabStop();\n const focused = this.renderRoot instanceof ShadowRoot ? this.renderRoot.activeElement : null;\n if (\n focused instanceof ApexGridRow &&\n focused.parentElement === this.scrollContainer &&\n (focused.index < first || focused.index > last)\n ) {\n this.scrollContainer.focus({ preventScroll: true });\n }\n }\n\n /** The body cell an event started on, when that cell is one of this grid's. */\n #ownCell(event: Event): ApexGridCell<T> | undefined {\n if (!this.ownsEvent(event)) return undefined;\n return event.composedPath().find((el) => el instanceof ApexGridCell) as\n | ApexGridCell<T>\n | undefined;\n }\n\n @eventOptions({ capture: true })\n protected bodyClickHandler(event: MouseEvent) {\n if (!this.ownsEvent(event)) return;\n const path = event.composedPath();\n const target = path.find((el) => el instanceof ApexGridCell) as ApexGridCell<T> | undefined;\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 } else {\n // A row a feature module renders full width (a group header, a total\n // row) has no cells; a click on its focus target makes it the active\n // row, keeping the column (the clamp settles it when nothing was active).\n const row = path.find((el) => el instanceof ApexGridRow) as ApexGridRow<T> | undefined;\n const cell = row?.presentedCell;\n if (row && cell && path.includes(cell)) {\n const { column } = this.stateController.active;\n this.stateController.active = { column, row: row.index };\n }\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 if (!this.ownsEvent(event)) return;\n const origin = event.composedPath()[0];\n const fromBody = this.scrollContainer.isSameNode(event.target as HTMLElement);\n const fromCell =\n (origin instanceof ApexGridCell && !origin.editing) ||\n (event.target instanceof ApexGridRow && event.target.presentedCell === origin);\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 = this.#ownCell(event);\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 @rangeChanged=${this.bodyRangeChanged}\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 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 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"]}