apex-grid 3.5.0 → 4.0.0-beta.1

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 (215) hide show
  1. package/CHANGELOG.md +573 -0
  2. package/LICENSE.md +125 -0
  3. package/README.md +143 -23
  4. package/components/cell.d.ts +43 -5
  5. package/components/cell.js +225 -64
  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 +281 -49
  11. package/components/grid.js +600 -159
  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 +6 -10
  16. package/components/header-row.js +12 -28
  17. package/components/header-row.js.map +1 -1
  18. package/components/header.js +71 -22
  19. package/components/header.js.map +1 -1
  20. package/components/paginator.d.ts +20 -5
  21. package/components/paginator.js +54 -17
  22. package/components/paginator.js.map +1 -1
  23. package/components/row.d.ts +19 -3
  24. package/components/row.js +211 -56
  25. package/components/row.js.map +1 -1
  26. package/components/toolbar.d.ts +5 -1
  27. package/components/toolbar.js +6 -2
  28. package/components/toolbar.js.map +1 -1
  29. package/components/virtualize-rows.d.ts +38 -0
  30. package/components/virtualize-rows.js +286 -0
  31. package/components/virtualize-rows.js.map +1 -0
  32. package/components/virtualizer.d.ts +111 -1
  33. package/components/virtualizer.js +192 -5
  34. package/components/virtualizer.js.map +1 -1
  35. package/controllers/dom.d.ts +14 -7
  36. package/controllers/dom.js +45 -27
  37. package/controllers/dom.js.map +1 -1
  38. package/controllers/editing.d.ts +104 -37
  39. package/controllers/editing.js +230 -78
  40. package/controllers/editing.js.map +1 -1
  41. package/controllers/expansion.d.ts +14 -5
  42. package/controllers/expansion.js +24 -1
  43. package/controllers/expansion.js.map +1 -1
  44. package/controllers/filter.d.ts +10 -2
  45. package/controllers/filter.js +62 -17
  46. package/controllers/filter.js.map +1 -1
  47. package/controllers/history.d.ts +45 -8
  48. package/controllers/history.js +58 -20
  49. package/controllers/history.js.map +1 -1
  50. package/controllers/navigation.d.ts +130 -13
  51. package/controllers/navigation.js +474 -60
  52. package/controllers/navigation.js.map +1 -1
  53. package/controllers/pagination.d.ts +13 -6
  54. package/controllers/pagination.js +29 -22
  55. package/controllers/pagination.js.map +1 -1
  56. package/controllers/reorder.js +38 -22
  57. package/controllers/reorder.js.map +1 -1
  58. package/controllers/resize.d.ts +17 -2
  59. package/controllers/resize.js +16 -6
  60. package/controllers/resize.js.map +1 -1
  61. package/controllers/row-pin.d.ts +26 -2
  62. package/controllers/row-pin.js +24 -11
  63. package/controllers/row-pin.js.map +1 -1
  64. package/controllers/row-reorder.d.ts +40 -12
  65. package/controllers/row-reorder.js +137 -43
  66. package/controllers/row-reorder.js.map +1 -1
  67. package/controllers/selection.d.ts +33 -4
  68. package/controllers/selection.js +49 -11
  69. package/controllers/selection.js.map +1 -1
  70. package/controllers/sort.d.ts +22 -2
  71. package/controllers/sort.js +30 -25
  72. package/controllers/sort.js.map +1 -1
  73. package/controllers/state.d.ts +74 -7
  74. package/controllers/state.js +117 -36
  75. package/controllers/state.js.map +1 -1
  76. package/controllers/tree.d.ts +15 -10
  77. package/controllers/tree.js +0 -0
  78. package/controllers/tree.js.map +1 -1
  79. package/custom-elements.json +5091 -1023
  80. package/docs/assets/hierarchy.js +1 -1
  81. package/docs/assets/highlight.css +15 -8
  82. package/docs/assets/navigation.js +1 -1
  83. package/docs/assets/search.js +1 -1
  84. package/docs/classes/ApexGrid.html +233 -87
  85. package/docs/classes/ApexGridPaginator.html +39 -8
  86. package/docs/classes/ApexGridToolbar.html +11 -7
  87. package/docs/functions/localize.html +2 -2
  88. package/docs/hierarchy.html +1 -1
  89. package/docs/index.html +159 -26
  90. package/docs/interfaces/ApexCellValidationFailedEvent.html +3 -2
  91. package/docs/interfaces/ApexCellValueChangedEvent.html +4 -2
  92. package/docs/interfaces/ApexCellValueChangingEvent.html +3 -2
  93. package/docs/interfaces/ApexGridEventMap.html +5 -2
  94. package/docs/interfaces/ApexPageChangedEvent.html +3 -1
  95. package/docs/interfaces/ApexRowEditEndedEvent.html +2 -1
  96. package/docs/interfaces/ApexRowEditStartedEvent.html +2 -1
  97. package/docs/interfaces/ApexRowMovingEvent.html +9 -3
  98. package/docs/interfaces/ApexRowPinningEvent.html +1 -1
  99. package/docs/interfaces/ApexTreeRowExpandedEvent.html +4 -1
  100. package/docs/interfaces/ApexTreeRowExpandingEvent.html +4 -1
  101. package/docs/interfaces/BaseApexCellContext.html +18 -5
  102. package/docs/interfaces/BaseApexEditorContext.html +20 -5
  103. package/docs/interfaces/BaseFilterExpression.html +3 -3
  104. package/docs/interfaces/CSVExportOptions.html +12 -4
  105. package/docs/interfaces/DataPipelineConfiguration.html +4 -9
  106. package/docs/interfaces/ExportOptions.html +5 -3
  107. package/docs/interfaces/GridExpansionConfiguration.html +6 -2
  108. package/docs/interfaces/GridRowReorderingConfiguration.html +1 -1
  109. package/docs/interfaces/GridSelectionConfiguration.html +19 -4
  110. package/docs/interfaces/PaginationConfiguration.html +11 -4
  111. package/docs/interfaces/PaginationState.html +4 -2
  112. package/docs/interfaces/SetStateResult.html +3 -2
  113. package/docs/interfaces/ValidatorContext.html +7 -2
  114. package/docs/media/_token-values.scss +118 -0
  115. package/docs/media/package.json +9 -5
  116. package/docs/modules.html +1 -1
  117. package/docs/types/DataPipelineParams.html +2 -2
  118. package/docs/types/ExportSource.html +6 -4
  119. package/docs/types/OperandKeys.html +9 -0
  120. package/docs/types/PaginationMode.html +5 -4
  121. package/docs/variables/EN_LOCALE.html +2 -2
  122. package/i18n/en.d.ts +7 -0
  123. package/i18n/en.js +7 -0
  124. package/i18n/en.js.map +1 -1
  125. package/i18n/es.js +7 -0
  126. package/i18n/es.js.map +1 -1
  127. package/internal/column-types.d.ts +38 -2
  128. package/internal/column-types.js +83 -55
  129. package/internal/column-types.js.map +1 -1
  130. package/internal/constants.d.ts +1 -2
  131. package/internal/constants.js +0 -4
  132. package/internal/constants.js.map +1 -1
  133. package/internal/document-styles.d.ts +30 -0
  134. package/internal/document-styles.js +48 -0
  135. package/internal/document-styles.js.map +1 -0
  136. package/internal/export.d.ts +45 -7
  137. package/internal/export.js +39 -34
  138. package/internal/export.js.map +1 -1
  139. package/internal/feature-module.d.ts +67 -3
  140. package/internal/feature-module.js +6 -0
  141. package/internal/feature-module.js.map +1 -1
  142. package/internal/flip.d.ts +28 -16
  143. package/internal/flip.js +42 -10
  144. package/internal/flip.js.map +1 -1
  145. package/internal/index.d.ts +7 -5
  146. package/internal/index.js +6 -4
  147. package/internal/index.js.map +1 -1
  148. package/internal/normalize-case.d.ts +8 -1
  149. package/internal/normalize-case.js +3 -2
  150. package/internal/normalize-case.js.map +1 -1
  151. package/internal/state-snapshot.d.ts +60 -8
  152. package/internal/state-snapshot.js +87 -19
  153. package/internal/state-snapshot.js.map +1 -1
  154. package/internal/types.d.ts +92 -21
  155. package/internal/types.js.map +1 -1
  156. package/internal/utils.d.ts +34 -6
  157. package/internal/utils.js +30 -21
  158. package/internal/utils.js.map +1 -1
  159. package/internal/validators.js +1 -0
  160. package/internal/validators.js.map +1 -1
  161. package/operations/filter/operands/number.js +9 -6
  162. package/operations/filter/operands/number.js.map +1 -1
  163. package/operations/filter/operands/string.js +2 -3
  164. package/operations/filter/operands/string.js.map +1 -1
  165. package/operations/filter/types.d.ts +14 -2
  166. package/operations/filter/types.js.map +1 -1
  167. package/operations/filter.d.ts +6 -0
  168. package/operations/filter.js +23 -7
  169. package/operations/filter.js.map +1 -1
  170. package/operations/quick-filter.js +2 -5
  171. package/operations/quick-filter.js.map +1 -1
  172. package/operations/sort.d.ts +21 -2
  173. package/operations/sort.js +41 -14
  174. package/operations/sort.js.map +1 -1
  175. package/package.json +9 -4
  176. package/setup.d.ts +11 -0
  177. package/setup.js +9 -19
  178. package/setup.js.map +1 -1
  179. package/styles/_token-values.css.d.ts +1 -0
  180. package/styles/_token-values.css.js +3 -0
  181. package/styles/_token-values.css.js.map +1 -0
  182. package/styles/_tokens.css.js +1 -1
  183. package/styles/_tokens.css.js.map +1 -1
  184. package/styles/body-cell/body-cell.css.js +1 -1
  185. package/styles/body-cell/body-cell.css.js.map +1 -1
  186. package/styles/body-cell/cell-renderers.css.js +1 -1
  187. package/styles/body-cell/cell-renderers.css.js.map +1 -1
  188. package/styles/body-row/body-row.css.js +1 -1
  189. package/styles/body-row/body-row.css.js.map +1 -1
  190. package/styles/document-tokens.css.d.ts +1 -0
  191. package/styles/document-tokens.css.js +3 -0
  192. package/styles/document-tokens.css.js.map +1 -0
  193. package/styles/filter-row/filter-row.css.js +1 -1
  194. package/styles/filter-row/filter-row.css.js.map +1 -1
  195. package/styles/grid/_grid.base.css.js +1 -1
  196. package/styles/grid/_grid.base.css.js.map +1 -1
  197. package/styles/grid/grid.css.js +1 -1
  198. package/styles/grid/grid.css.js.map +1 -1
  199. package/styles/group-header-row/group-header-row.css.js +1 -1
  200. package/styles/group-header-row/group-header-row.css.js.map +1 -1
  201. package/styles/header-cell/header-cell.css.js +1 -1
  202. package/styles/header-cell/header-cell.css.js.map +1 -1
  203. package/styles/header-row/header-row.base.css.js +1 -1
  204. package/styles/header-row/header-row.base.css.js.map +1 -1
  205. package/styles/paginator/paginator.css.js +1 -1
  206. package/styles/paginator/paginator.css.js.map +1 -1
  207. package/styles/toolbar/toolbar.css.js +1 -1
  208. package/styles/toolbar/toolbar.css.js.map +1 -1
  209. package/tokens.css +78 -0
  210. package/LICENSE +0 -80
  211. package/docs/media/LICENSE +0 -80
  212. package/docs/media/_tokens.scss +0 -214
  213. package/operations/pagination.d.ts +0 -19
  214. package/operations/pagination.js +0 -12
  215. package/operations/pagination.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/controllers/navigation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC3E,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AAC,CAAC;YAEzC,IAAI,CAAC,eAAe,EAAE,CAAC;QACzB,CAAC;IACH,CAAC;CACF","sourcesContent":["import type { ReactiveController } from 'lit';\nimport type ApexGridRow from '../components/row.js';\nimport { NAVIGATION_STATE, SENTINEL_NODE } from '../internal/constants.js';\nimport { GRID_ROW_TAG } from '../internal/tags.js';\nimport type { ActiveNode, ColumnConfiguration, GridHost, Keys } from '../internal/types.js';\nimport { getDisplayColumns, isRTL } from '../internal/utils.js';\n\nexport class NavigationController<T extends object> implements ReactiveController {\n protected handlers = new Map(\n Object.entries({\n ArrowDown: this.arrowDown,\n ArrowUp: this.arrowUp,\n ArrowLeft: this.arrowLeft,\n ArrowRight: this.arrowRight,\n Home: this.home,\n End: this.end,\n PageUp: this.pageUp,\n PageDown: this.pageDown,\n ' ': this.toggleSelection,\n })\n );\n\n protected get virtualizer() {\n // @ts-expect-error - Protected member access\n return this.host.scrollContainer;\n }\n\n protected state = NAVIGATION_STATE;\n protected _active = SENTINEL_NODE;\n\n protected get nextNode() {\n const node = this.state.get('current')!;\n return node === SENTINEL_NODE\n ? { column: this.firstColumn, row: 0 }\n : ({ ...node } as ActiveNode<T>);\n }\n\n protected get columns(): Array<{ key: Keys<T>; hidden?: boolean }> {\n return getDisplayColumns(this.host.columns) as unknown as Array<{\n key: Keys<T>;\n hidden?: boolean;\n }>;\n }\n\n protected get visibleColumns() {\n return this.columns.filter((column) => !column.hidden);\n }\n\n protected get firstColumn(): Keys<T> {\n const first = this.visibleColumns.at(0);\n return (first?.key ?? (this.host.columns[0]?.key as Keys<T>)) as Keys<T>;\n }\n\n protected getPreviousColumn(key: Keys<T>): Keys<T> {\n const columns = this.visibleColumns;\n const idx = columns.findIndex((column) => column.key === key);\n return columns[Math.max(idx - 1, 0)].key;\n }\n\n protected getNextColumn(key: Keys<T>): Keys<T> {\n const columns = this.visibleColumns;\n const idx = columns.findIndex((column) => column.key === key);\n return columns[Math.min(idx + 1, columns.length - 1)].key;\n }\n\n protected scrollToCell(node: ActiveNode<T>) {\n const row = Array.from(this.virtualizer.querySelectorAll(GRID_ROW_TAG)).find(\n (row) => (row as unknown as ApexGridRow<T>).index === node.row\n ) as unknown as ApexGridRow<T>;\n\n if (row) {\n row.cells\n .find((cell) => cell.column.key === node.column)\n ?.scrollIntoView({ block: 'nearest' });\n }\n }\n\n protected findActiveCell() {\n const row = Array.from(this.virtualizer.querySelectorAll(GRID_ROW_TAG)).find(\n (el) => (el as unknown as ApexGridRow<T>).index === this.active.row\n ) as unknown as ApexGridRow<T> | undefined;\n return row?.cells.find((cell) => cell.column.key === this.active.column);\n }\n\n /**\n * Moves real DOM focus to the active cell (the grid body's roving tab stop),\n * so screen readers track keyboard navigation. Waits for the host render to\n * commit the cell's `active` state, then retries once on the next frame to\n * cover virtualizer re-materialization after a long jump. No-op while no\n * cell is active (the scroll container keeps focus as the entry point).\n */\n public focusActiveCell(): void {\n const node = this.state.get('current');\n if (!node || node === SENTINEL_NODE) return;\n void (async () => {\n await this.host.updateComplete;\n let cell = this.findActiveCell();\n if (!cell) {\n await new Promise(requestAnimationFrame);\n cell = this.findActiveCell();\n }\n cell?.focus({ preventScroll: true });\n })();\n }\n\n public get active() {\n return this._active as ActiveNode<T>;\n }\n\n public set active(node: ActiveNode<T>) {\n this._active = node;\n this.state.set('previous', this._active);\n this.state.set('current', node);\n this.host.requestUpdate();\n }\n\n constructor(protected host: GridHost<T>) {\n this.host.addController(this);\n }\n\n /** Home moves to the first cell in the row (ARIA grid pattern). */\n protected home() {\n this.active = Object.assign(this.nextNode, { column: this.firstColumn });\n this.scrollToCell(this.active);\n }\n\n /** End moves to the last cell in the row (ARIA grid pattern). */\n protected end() {\n const last = this.visibleColumns.at(-1)?.key ?? this.firstColumn;\n this.active = Object.assign(this.nextNode, { column: last });\n this.scrollToCell(this.active);\n }\n\n /** Ctrl/Cmd+Home moves to the first cell of the grid. */\n protected ctrlHome() {\n this.active = { column: this.firstColumn, row: 0 } as ActiveNode<T>;\n this.virtualizer.element(0)?.scrollIntoView({ block: 'nearest' });\n this.scrollToCell(this.active);\n }\n\n /** Ctrl/Cmd+End moves to the last cell of the grid. */\n protected ctrlEnd() {\n const row = Math.max(0, this.host.pageItems.length - 1);\n const last = this.visibleColumns.at(-1)?.key ?? this.firstColumn;\n this.active = { column: last, row } as ActiveNode<T>;\n this.virtualizer.element(row)?.scrollIntoView({ block: 'nearest' });\n this.scrollToCell(this.active);\n }\n\n /**\n * Rows per Page Up/Down step, derived from the host viewport and the height\n * of a rendered row (fallback: 10 rows when nothing is measurable yet).\n */\n protected pageStep(): number {\n const rowEl = this.virtualizer.element(this.nextNode.row) as HTMLElement | undefined;\n const rowHeight = rowEl?.offsetHeight || 0;\n const viewport = (this.host as unknown as HTMLElement).clientHeight || 0;\n if (!rowHeight || !viewport) return 10;\n const rows = Math.floor(viewport / rowHeight) - 1;\n return rows > 0 ? rows : 10;\n }\n\n protected pageUp() {\n const next = this.nextNode;\n this.active = Object.assign(next, { row: Math.max(0, next.row - this.pageStep()) });\n this.virtualizer.element(this.active.row)?.scrollIntoView({ block: 'nearest' });\n }\n\n protected pageDown() {\n const next = this.nextNode;\n this.active = Object.assign(next, {\n row: Math.min(this.host.pageItems.length - 1, next.row + this.pageStep()),\n });\n this.virtualizer.element(this.active.row)?.scrollIntoView({ block: 'nearest' });\n }\n\n protected arrowDown() {\n const next = this.nextNode;\n\n this.active = Object.assign(next, {\n row: Math.min(next.row + 1, this.host.pageItems.length - 1),\n });\n this.virtualizer.element(next.row)?.scrollIntoView({ block: 'nearest' });\n }\n\n protected arrowUp() {\n const next = this.nextNode;\n this.active = Object.assign(next, { row: Math.max(0, next.row - 1) });\n this.virtualizer.element(next.row)?.scrollIntoView({ block: 'nearest' });\n }\n\n protected arrowLeft() {\n this.#moveInline('left');\n }\n\n protected arrowRight() {\n this.#moveInline('right');\n }\n\n /**\n * Moves the active cell one column in a *physical* direction.\n *\n * ArrowLeft and ArrowRight name screen directions, not column order, so under\n * `dir=\"rtl\"` the column to the left is the *next* one and the mapping onto\n * previous/next inverts. Everything else about navigation is order-based and\n * needs no direction awareness.\n */\n #moveInline(direction: 'left' | 'right') {\n const towardsEnd = isRTL(this.host as unknown as Element) === (direction === 'left');\n const next = this.nextNode;\n const column = towardsEnd\n ? this.getNextColumn(next.column)\n : this.getPreviousColumn(next.column);\n this.active = Object.assign(next, { column });\n this.scrollToCell(this.active);\n }\n\n protected toggleSelection() {\n // Space on the focused grid toggles selection of the active row.\n // No-op when selection is disabled or there's no active row.\n const data = this.host.pageItems[this.active.row] as T | undefined;\n if (!data) return;\n void this.host.toggleRowSelection(data);\n }\n\n public hostConnected() {}\n\n public hostDisconnected() {\n this.active = SENTINEL_NODE as ActiveNode<T>;\n this.state = NAVIGATION_STATE;\n }\n\n protected get editing() {\n // @ts-expect-error - protected member access\n return this.host.stateController.editing as\n | {\n enabled: boolean;\n isEditable(column: ColumnConfiguration<T>): boolean;\n editCell(rowIndex: number, columnKey: Keys<T>): Promise<boolean>;\n }\n | undefined;\n }\n\n /**\n * Enter / F2 on the active cell opens its editor (the keyboard path into\n * edit mode). Returns `true` when the event was consumed.\n */\n protected handleEditKey(event: KeyboardEvent): boolean {\n if (event.key !== 'Enter' && event.key !== 'F2') return false;\n if (event.ctrlKey || event.metaKey || event.altKey) return false;\n const node = this.state.get('current');\n if (!node || node === SENTINEL_NODE) return false;\n const editing = this.editing;\n if (!editing?.enabled) return false;\n const column = this.host.getColumn(this.active.column);\n if (!column || !editing.isEditable(column)) return false;\n event.preventDefault();\n void editing.editCell(this.active.row, this.active.column);\n return true;\n }\n\n protected get rowReorder() {\n // @ts-expect-error - protected member access\n return this.host.stateController.rowReorder as\n | {\n enabled: boolean;\n isGrabbing: boolean;\n grab(rowIndex: number): boolean;\n moveGrabbed(direction: -1 | 1): number;\n drop(): void;\n cancelGrab(): void;\n }\n | undefined;\n }\n\n /**\n * Keyboard row reorder: Space grabs the active row, arrows move it, Space /\n * Enter drops, Escape cancels. Returns `true` when the event was consumed.\n * Only active when `rowReordering.enabled` (so it never shadows Space-to-select\n * on grids without reordering).\n */\n protected handleReorderKey(event: KeyboardEvent): boolean {\n const reorder = this.rowReorder;\n if (!reorder?.enabled) return false;\n\n if (reorder.isGrabbing) {\n switch (event.key) {\n case 'ArrowUp':\n case 'ArrowDown': {\n event.preventDefault();\n const next = reorder.moveGrabbed(event.key === 'ArrowDown' ? 1 : -1);\n if (next >= 0) {\n this.active = Object.assign(this.nextNode, { row: next });\n this.virtualizer.element(next)?.scrollIntoView({ block: 'nearest' });\n }\n return true;\n }\n case ' ':\n case 'Enter':\n event.preventDefault();\n reorder.drop();\n return true;\n case 'Escape':\n event.preventDefault();\n reorder.cancelGrab();\n return true;\n default:\n return false;\n }\n }\n\n if (event.key === ' ' && this.active.row >= 0) {\n event.preventDefault();\n return reorder.grab(this.active.row);\n }\n return false;\n }\n\n public navigate(event: KeyboardEvent) {\n if (this.handleReorderKey(event)) return;\n // Undo / redo: Ctrl/Cmd+Z, Ctrl/Cmd+Shift+Z, Ctrl/Cmd+Y. Only fires when the\n // grid body (not an open editor) has focus, so a text editor's native undo\n // is never hijacked.\n if ((event.ctrlKey || event.metaKey) && !event.altKey) {\n const key = event.key.toLowerCase();\n if (key === 'z' && !event.shiftKey) {\n event.preventDefault();\n this.host.undo();\n return;\n }\n if ((key === 'z' && event.shiftKey) || key === 'y') {\n event.preventDefault();\n this.host.redo();\n return;\n }\n // Ctrl/Cmd+Home / Ctrl/Cmd+End jump to the grid corners (ARIA grid pattern).\n if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault();\n if (event.key === 'Home') {\n this.ctrlHome();\n } else {\n this.ctrlEnd();\n }\n this.focusActiveCell();\n return;\n }\n }\n if (this.handleEditKey(event)) return;\n if (this.handlers.has(event.key)) {\n event.preventDefault();\n this.handlers.get(event.key)!.call(this);\n // Real focus follows the active cell so AT tracks the movement.\n this.focusActiveCell();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/controll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nimport type ApexGridRow from '../components/row.js';\nimport { revealWithin, type ScrollInsets } from '../components/virtualizer.js';\nimport { SENTINEL_NODE } from '../internal/constants.js';\nimport { GRID_BODY, GRID_CELL_TAG, GRID_ROW_TAG } from '../internal/tags.js';\nimport type { ActiveNode, ColumnConfiguration, GridHost, Keys } from '../internal/types.js';\nimport { getDisplayColumns, isRTL } from '../internal/utils.js';\n\n/** Keys that move the active cell relative to where it is. */\nconst RELATIVE_KEYS = new Set([\n 'ArrowDown',\n 'ArrowUp',\n 'ArrowLeft',\n 'ArrowRight',\n 'Home',\n 'End',\n 'PageUp',\n 'PageDown',\n]);\n\n/** The focused element, through every open shadow root on the way down. */\nfunction deepActiveElement(): Element | null {\n let el = document.activeElement;\n while (el?.shadowRoot?.activeElement) el = el.shadowRoot.activeElement;\n return el;\n}\n\nexport class NavigationController<T extends object> implements ReactiveController {\n protected handlers = new Map(\n Object.entries({\n ArrowDown: this.arrowDown,\n ArrowUp: this.arrowUp,\n ArrowLeft: this.arrowLeft,\n ArrowRight: this.arrowRight,\n Home: this.home,\n End: this.end,\n PageUp: this.pageUp,\n PageDown: this.pageDown,\n ' ': this.toggleSelection,\n })\n );\n\n protected get virtualizer() {\n // @ts-expect-error - Protected member access\n return this.host.scrollContainer;\n }\n\n /**\n * The active cell of this grid. Instance state on purpose: every grid on a\n * page, including one nested in another grid's detail panel, keeps its own.\n */\n protected _active = SENTINEL_NODE as ActiveNode<T>;\n\n protected get nextNode() {\n return this._active === SENTINEL_NODE\n ? ({ column: this.firstColumn, row: 0 } as ActiveNode<T>)\n : ({ ...this._active } as ActiveNode<T>);\n }\n\n protected get columns(): Array<{ key: Keys<T>; hidden?: boolean }> {\n return getDisplayColumns(this.host.columns) as unknown as Array<{\n key: Keys<T>;\n hidden?: boolean;\n }>;\n }\n\n protected get visibleColumns() {\n return this.columns.filter((column) => !column.hidden);\n }\n\n protected get firstColumn(): Keys<T> {\n const first = this.visibleColumns.at(0);\n return (first?.key ?? (this.host.columns[0]?.key as Keys<T>)) as Keys<T>;\n }\n\n /** Whether there is any cell to move to: a body row and a visible column. */\n protected get navigable(): boolean {\n return this.host.pageItems.length > 0 && this.visibleColumns.length > 0;\n }\n\n protected getPreviousColumn(key: Keys<T>): Keys<T> {\n const columns = this.visibleColumns;\n const idx = columns.findIndex((column) => column.key === key);\n return columns[Math.max(idx - 1, 0)]?.key ?? key;\n }\n\n protected getNextColumn(key: Keys<T>): Keys<T> {\n const columns = this.visibleColumns;\n const idx = columns.findIndex((column) => column.key === key);\n return columns[Math.min(idx + 1, columns.length - 1)]?.key ?? key;\n }\n\n /** The rendered body row at `index`, when the virtualizer has it in the DOM. */\n protected findRow(index: number) {\n return Array.from(this.virtualizer.querySelectorAll(GRID_ROW_TAG)).find(\n (row) => (row as unknown as ApexGridRow<T>).index === index\n ) as unknown as ApexGridRow<T> | undefined;\n }\n\n /**\n * The element that stands for `node` in the DOM: the cell, or for a row a\n * feature module renders full width (a group header, a total row) the\n * row's single focus target, whatever the column.\n */\n protected findCell(node: ActiveNode<T>): HTMLElement | undefined {\n const row = this.findRow(node.row);\n if (!row) return undefined;\n return (\n row.presentedCell ??\n (row.cells.find((cell) => cell.column.key === node.column) as HTMLElement | undefined)\n );\n }\n\n protected scrollToCell(node: ActiveNode<T>) {\n const cell = this.findCell(node);\n if (cell) {\n revealWithin(this.host as unknown as HTMLElement, cell, {\n block: 'nearest',\n inline: 'nearest',\n insets: this.scrollInsets(),\n });\n }\n }\n\n /** Scrolls body row `index` into view, rendered or not. */\n protected scrollToRow(index: number) {\n this.virtualizer\n .element(index)\n ?.scrollIntoView({ block: 'nearest', insets: this.scrollInsets() });\n }\n\n /** The cell {@link revealCell} last asked for, so a late reveal yields to a newer one. */\n #revealing: ActiveNode<T> | null = null;\n\n /**\n * Scrolls the cell at `node` into view clear of the sticky chrome without\n * moving the active cell: the cell itself when it is rendered, else its row\n * first and the cell once the virtualizer has rendered it. For a feature\n * that moves something other than the active cell with the keyboard (range\n * extension), so it scrolls the way arrow navigation does.\n */\n public revealCell(node: ActiveNode<T>): void {\n this.#revealing = node;\n if (this.findCell(node)) {\n this.scrollToCell(node);\n return;\n }\n this.scrollToRow(node.row);\n void this.virtualizer.settled().then(() => {\n if (this.#revealing === node) this.scrollToCell(node);\n });\n }\n\n /**\n * Whether ArrowLeft or ArrowRight steps towards the end of the column\n * order: ArrowRight in a left-to-right grid, ArrowLeft in a right-to-left\n * one. The rule every inline arrow key on this grid follows.\n */\n public towardsInlineEnd(key: string): boolean {\n return isRTL(this.host as unknown as Element) === (key === 'ArrowLeft');\n }\n\n /**\n * How much of the scroll container's scrollport the sticky chrome covers\n * (toolbar, headers and the pinned-top band above, the pinned-bottom band\n * and the paginator below, pinned columns on either side). Keyboard scrolls\n * use it as scroll-padding, so a row or cell the keyboard moves to is never\n * parked underneath that chrome. Measured right before each keyboard scroll\n * because any of those bands can change size between key presses. Public\n * so a feature scrolling the body itself (drag auto-scroll) measures the\n * same chrome.\n */\n public scrollInsets(): ScrollInsets {\n const host = this.host as unknown as HTMLElement;\n const root = host.shadowRoot;\n if (!root) return { top: 0, right: 0, bottom: 0, left: 0 };\n const box = host.getBoundingClientRect();\n const top = box.top + host.clientTop;\n const left = box.left + host.clientLeft;\n const bottom = top + host.clientHeight;\n const right = left + host.clientWidth;\n\n let insetTop = 0;\n for (const el of root.querySelectorAll('apex-grid-header-row, [part~=\"pinned-top\"]')) {\n insetTop = Math.max(insetTop, el.getBoundingClientRect().bottom - top);\n }\n let insetBottom = 0;\n for (const el of root.querySelectorAll('apex-grid-paginator, [part~=\"pinned-bottom\"]')) {\n insetBottom = Math.max(insetBottom, bottom - el.getBoundingClientRect().top);\n }\n\n let insetLeft = 0;\n let insetRight = 0;\n const headerRow = root.querySelector('apex-grid-header-row');\n const pinned = headerRow?.shadowRoot?.querySelectorAll(\n '[data-pinned=\"start\"], [data-pinned=\"end\"]'\n );\n if (pinned?.length) {\n const rtl = isRTL(host);\n for (const el of pinned) {\n const rect = el.getBoundingClientRect();\n const atLeft = (el.getAttribute('data-pinned') === 'start') !== rtl;\n if (atLeft) insetLeft = Math.max(insetLeft, rect.right - left);\n else insetRight = Math.max(insetRight, right - rect.left);\n }\n }\n\n const clamp = (inset: number) => Math.max(0, Math.round(inset));\n return {\n top: clamp(insetTop),\n right: clamp(insetRight),\n bottom: clamp(insetBottom),\n left: clamp(insetLeft),\n };\n }\n\n /**\n * Moves real DOM focus to the active cell (the grid body's roving tab stop),\n * so screen readers track keyboard navigation. Waits for the host render to\n * commit the cell's `active` state and, when the cell is not in the DOM yet\n * (a long jump), for the virtualizer to finish laying out the new range.\n * No-op while no cell is active (the scroll container keeps focus as the\n * entry point).\n *\n * @param reveal - also scroll the cell into view once it exists, for jumps\n * whose target row was not rendered when the scroll started.\n */\n public focusActiveCell(reveal = false): void {\n void this.#focusActive(reveal);\n }\n\n /** {@link focusActiveCell}, settling once the focus moved or was given up. */\n async #focusActive(reveal = false): Promise<void> {\n const node = this._active;\n if (node === SENTINEL_NODE) return;\n await this.host.updateComplete;\n let cell = this.findCell(node);\n if (!cell) {\n await this.virtualizer.settled();\n cell = this.findCell(node);\n }\n if (!cell) {\n await new Promise(requestAnimationFrame);\n cell = this.findCell(node);\n }\n // An estimated scroll missed the row (stale size estimates): wait for the\n // virtualizer's corrected scrolls to render it.\n if (!cell && this._active === node) {\n await this.virtualizer.revealed();\n cell = this.findCell(node);\n }\n // The user moved on while this was waiting: leave focus to the newer move.\n if (!cell || this._active !== node) return;\n if (reveal) this.scrollToCell(node);\n cell.focus({ preventScroll: true });\n }\n\n public get active() {\n return this._active;\n }\n\n public set active(node: ActiveNode<T>) {\n this._active = node;\n this.host.requestUpdate();\n }\n\n constructor(protected host: GridHost<T>) {\n this.host.addController(this);\n }\n\n /**\n * Whether this grid's body holds focus: the body itself, one of its cells\n * or an editor in one, not a grid nested in a detail panel. Tracked from\n * the body's focus events ({@link focusEntered}, {@link focusLeft}). A\n * focus loss a re-bind caused (it removed the focused editor while a\n * reconcile is running) keeps it until that reconcile has run, so it can\n * put focus back under row recycling. Any other loss clears it: a click\n * elsewhere, the window losing focus, a template removing its own focused\n * element, the grid leaving the document. Focus is never taken back once\n * it left the grid.\n */\n public get ownsFocus(): boolean {\n this.#settleLoss();\n return this.#ownsFocus;\n }\n\n #ownsFocus = false;\n\n /**\n * Clears {@link ownsFocus} when focus went nowhere with nothing pending to\n * repair it. Chromium reports a focused element removed or moved in the\n * DOM with a `focusout` ({@link focusLeft} decides then); Firefox and\n * WebKit drop focus silently, so the loss is noticed here, the next time\n * anything asks.\n */\n #settleLoss(): void {\n if (!this.#ownsFocus || this.#reconciling || this.#parked || this.#detached) return;\n if (this.#lost()) this.#ownsFocus = false;\n }\n\n /** The record the focused row showed when focus arrived, for the reconcile. */\n #focusedRecord: T | null = null;\n\n /** The element focus arrived on and the row it stood in, for the reconcile. */\n #focusTarget: { el: Element; row: ApexGridRow<T> | undefined } | null = null;\n\n /**\n * The element that lost focus to nowhere in this task, until a microtask\n * tells a removal (no longer in the document) from a blur (still there).\n */\n #blurred: Element | null = null;\n\n /**\n * An element that lost focus by moving into another row with its record\n * while a reconcile was running, for the reconcile to focus again.\n */\n #moved: Element | null = null;\n\n /** Bumped by every {@link reconcileFocus}, so only the latest one acts. */\n #reconcile = 0;\n\n /** The token of the reconcile still to run, or 0 when none is. */\n #reconciling = 0;\n\n /** Set while a page change holds focus in the body (see {@link parkFocus}). */\n #parked: { record: T | null } | null = null;\n\n /** Set while this controller focuses the body itself, which must not forward. */\n #focusingBody = false;\n\n /** A focused grid's active cell when it was detached, until it is re-attached. */\n #detached: { node: ActiveNode<T> } | null = null;\n\n /**\n * Whether focus arriving on the body itself should move on to the active\n * cell (the roving tab stop). Not while a page change holds focus in the\n * body, or while this controller puts it there.\n */\n public get forwardsBodyFocus(): boolean {\n return !this.#parked && !this.#focusingBody;\n }\n\n /**\n * Focus arrived in the body. `owned` is whether the event is this grid's\n * rather than a nested grid's (the grid's `ownsEvent`).\n */\n public focusEntered(event: FocusEvent, owned: boolean): void {\n this.#blurred = null;\n this.#moved = null;\n this.#ownsFocus = owned;\n const el = event.composedPath()[0] as Element;\n const row = owned ? this.#locate(el)?.row : undefined;\n this.#focusedRecord = row?.data ?? null;\n this.#focusTarget = owned ? { el, row } : null;\n }\n\n /**\n * Focus left something in the body. Focus moving to another element is\n * followed by its `focusin`, which sets {@link ownsFocus} again when that\n * element is this body's. Focus going nowhere is a blur when the element\n * is still in the document a microtask later, and a removal otherwise. A\n * removal keeps {@link ownsFocus} only while a reconcile is running, which\n * then decides; with none, nothing would repair it, so a later reconcile\n * must not either.\n */\n public focusLeft(event: FocusEvent, owned: boolean): void {\n if (!owned) return;\n if (event.relatedTarget) {\n this.#ownsFocus = false;\n return;\n }\n const target = event.composedPath()[0] as Element;\n const from = this.#locate(target)?.row;\n this.#blurred = target;\n queueMicrotask(() => {\n if (this.#blurred !== target) return;\n this.#blurred = null;\n if (!this.#reconciling) {\n this.#ownsFocus = false;\n return;\n }\n if (!target.isConnected) return;\n // Still in the document but in another row: a detail panel's content\n // followed its record there (see DetailRoots in row.ts), which the\n // browser treats as a blur. The reconcile puts focus back on it.\n const to = this.#locate(target)?.row;\n if (to && to !== from) this.#moved = target;\n else this.#ownsFocus = false;\n });\n }\n\n /**\n * Row recycling: after the rows re-render, puts focus back in the body when\n * the render took it away. A re-bind keeps every row element in place, so\n * focus usually stays where it was, on the cell at the active position; it\n * is lost only when the focused element left the document (an editor whose\n * slot now shows another record) or stands on a row that now shows another\n * record without being active. Then focus goes to the edited record's\n * editor when it is rendered, else the active cell when its row is, else\n * the body. Acts only while the body owns focus, so it never takes focus\n * back from outside the grid or off a nested grid. A loss it leaves\n * unrepaired clears {@link ownsFocus}.\n */\n public reconcileFocus(): void {\n this.#settleLoss();\n if (!this.#ownsFocus || !this.host.rowRecycling) return;\n const token = ++this.#reconcile;\n this.#reconciling = token;\n void (async () => {\n try {\n // A range change commits its rows right after its listeners return.\n await Promise.resolve();\n await this.virtualizer.rendered();\n if (token !== this.#reconcile || this.#parked) return;\n if (!this.#ownsFocus || !this.host.isConnected) return;\n const focused = deepActiveElement();\n if (focused && focused !== document.body) {\n const at = this.#locate(focused);\n if (!at?.row) return;\n const active = this._active;\n const onActive =\n at.row.index === active.row && (!at.cell || at.cell.column.key === active.column);\n if (onActive || at.row.data === this.#focusedRecord) return;\n }\n await this.#restoreFocus();\n } finally {\n if (token === this.#reconcile) {\n this.#reconciling = 0;\n this.#moved = null;\n // A page change decides once its pipeline has run (parkFocus).\n if (!this.#parked && this.#lost()) this.#ownsFocus = false;\n }\n }\n })();\n }\n\n /**\n * Focus on what moved with the focused record (a detail panel's input),\n * else the edited record's editor, else the active cell, else the body.\n */\n async #restoreFocus(): Promise<void> {\n const moved = this.#moved ?? this.#silentlyMoved();\n this.#moved = null;\n if (moved?.isConnected && moved instanceof HTMLElement) {\n const at = this.#locate(moved);\n if (at?.row && at.row.data === this.#focusedRecord) {\n moved.focus({ preventScroll: true });\n return;\n }\n }\n const edit = this.editing?.activeCell;\n const row = edit && this.#renderedRows().find((each) => each.data === edit.data);\n const cell = row?.cells.find((each) => each.column.key === edit?.columnKey);\n if (cell) {\n await cell.updateComplete;\n const editor = cell.shadowRoot?.querySelector<HTMLElement>('input, [data-apex-editor]');\n if (this.#lost()) (editor ?? cell).focus({ preventScroll: true });\n return;\n }\n if (this._active !== SENTINEL_NODE && this.virtualizer.isRendered(this._active.row)) {\n await this.#focusActive();\n return;\n }\n this.#focusBody();\n }\n\n /**\n * The focused element when it moved into another row without a `focusout`\n * (Firefox, WebKit), which {@link focusLeft} records as {@link #moved} in\n * Chromium: focus went nowhere and the element is back in the document in\n * another row.\n */\n #silentlyMoved(): Element | null {\n const target = this.#focusTarget;\n if (!target?.el.isConnected || !this.#lost()) return null;\n const to = this.#locate(target.el)?.row;\n return to && to !== target.row ? target.el : null;\n }\n\n /**\n * Row recycling: a page change re-binds every row to the new page's\n * records, so a focused cell would stay focused on another record. Holds\n * focus in the body across the change: the body does not forward focus to\n * the active cell, and the post-render reconcile waits. Returns what to\n * call once the change has run its pipeline: focus then moves to the body\n * unless it rests on an editor or on a cell still showing the record it\n * showed before. Returns `null`, holding nothing, without row recycling or\n * while the body does not own focus.\n */\n public parkFocus(): (() => Promise<void>) | null {\n this.#settleLoss();\n if (!this.host.rowRecycling || !this.#ownsFocus) return null;\n const at = this.#locate(deepActiveElement());\n const park = { record: at?.row?.data ?? null };\n this.#parked = park;\n return async () => {\n await this.virtualizer.rendered();\n if (this.#parked !== park) return;\n this.#parked = null;\n if (!this.#ownsFocus || !this.host.isConnected) return;\n const focused = deepActiveElement();\n if (focused && focused !== document.body) {\n const now = this.#locate(focused);\n if (!now?.row) return;\n if (now.cell && (now.cell as HTMLElement & { editing?: boolean }).editing) return;\n if (now.row.data === park.record) return;\n }\n this.#focusBody();\n };\n }\n\n /** Focuses the body itself, without its forward to the active cell. */\n #focusBody(): void {\n this.#focusingBody = true;\n try {\n (this.virtualizer as HTMLElement).focus({ preventScroll: true });\n } finally {\n this.#focusingBody = false;\n }\n }\n\n /** Whether focus has gone nowhere. */\n #lost(): boolean {\n const focused = deepActiveElement();\n return !focused || focused === document.body;\n }\n\n #renderedRows(): ApexGridRow<T>[] {\n return Array.from(\n this.virtualizer.querySelectorAll(GRID_ROW_TAG)\n ) as unknown as ApexGridRow<T>[];\n }\n\n /**\n * Where `el` stands in this grid's body: the row and cell holding it, or\n * neither for the body itself. `null` when it is not in this body, which\n * includes a grid nested in one of its rows (its own body comes first on\n * the way up).\n */\n #locate(\n el: EventTarget | null\n ): { row?: ApexGridRow<T>; cell?: ApexGridRow<T>['cells'][number] } | null {\n const body = this.virtualizer as Element | null;\n if (!body) return null;\n let row: ApexGridRow<T> | undefined;\n let cell: ApexGridRow<T>['cells'][number] | undefined;\n let node = el instanceof Node ? el : null;\n while (node) {\n if (node === body) return { row, cell };\n if (node instanceof Element) {\n const name = node.localName;\n if (name === GRID_BODY) return null;\n if (!cell && name === GRID_CELL_TAG) cell = node as unknown as typeof cell;\n if (!row && name === GRID_ROW_TAG) row = node as unknown as ApexGridRow<T>;\n }\n node = node instanceof ShadowRoot ? node.host : node.parentNode;\n }\n return null;\n }\n\n /**\n * Keeps the active cell pointing at something that exists. Runs before\n * every grid render, so after a data swap, sort, filter, page change or a\n * column hide or reorder the active node is clamped to the last row and the\n * nearest visible column, or cleared when there is nothing left to point\n * at (no rows, no visible columns). Without it a stale node names a cell\n * that is never rendered, which leaves the body with no tab stop.\n */\n public hostUpdate() {\n const node = this._active;\n if (node === SENTINEL_NODE) return;\n const count = this.host.pageItems.length;\n if (!count || !this.visibleColumns.length) {\n this._active = SENTINEL_NODE as ActiveNode<T>;\n return;\n }\n // An open edit follows its record when a sort, filter or data change\n // moves it (the editing controller updates its index after this render).\n // The active cell on it goes along when the record stays in the rendered\n // rows, so the keyboard carries on from the edited cell once the edit\n // closes. A record moved out of view leaves the active cell in place,\n // where the user is looking.\n const edit = this.editing?.activeCell;\n if (edit && node.row === edit.rowIndex && node.column === edit.columnKey) {\n const index = this.host.pageItems.indexOf(edit.data);\n if (index >= 0 && index !== edit.rowIndex && this.virtualizer.isRendered(index)) {\n this._active = { column: node.column, row: index } as ActiveNode<T>;\n return;\n }\n }\n const row = Math.min(node.row, count - 1);\n const column = this.#nearestVisibleColumn(node.column);\n if (row !== node.row || column !== node.column) {\n this._active = { column, row } as ActiveNode<T>;\n }\n }\n\n /** `key` when it is visible, else the closest visible column in display order. */\n #nearestVisibleColumn(key: Keys<T>): Keys<T> {\n const columns = this.columns;\n const index = columns.findIndex((column) => column.key === key);\n if (index < 0) return this.firstColumn;\n for (let distance = 0; distance < columns.length; distance++) {\n for (const at of [index + distance, index - distance]) {\n const column = columns[at];\n if (column && !column.hidden) return column.key;\n }\n }\n return this.firstColumn;\n }\n\n /** The active row is one a feature module renders full width (no cells). */\n protected isPresentedRow(index: number): boolean {\n const data = this.host.pageItems[index];\n if (!data) return false;\n // @ts-expect-error - protected member access\n const state = this.host.stateController as {\n presentRow(row: T, ctx: { columns: ColumnConfiguration<T>[]; rowIndex: number }): unknown;\n };\n return state.presentRow(data, { columns: this.host.columns, rowIndex: index }) !== null;\n }\n\n /** Home moves to the first cell in the row (ARIA grid pattern). */\n protected home() {\n this.active = Object.assign(this.nextNode, { column: this.firstColumn });\n this.scrollToCell(this.active);\n }\n\n /** End moves to the last cell in the row (ARIA grid pattern). */\n protected end() {\n const last = this.visibleColumns.at(-1)?.key ?? this.firstColumn;\n this.active = Object.assign(this.nextNode, { column: last });\n this.scrollToCell(this.active);\n }\n\n /** Ctrl/Cmd+Home moves to the first cell of the grid. */\n protected ctrlHome() {\n this.active = { column: this.firstColumn, row: 0 } as ActiveNode<T>;\n this.scrollToRow(0);\n }\n\n /** Ctrl/Cmd+End moves to the last cell of the grid. */\n protected ctrlEnd() {\n const row = this.host.pageItems.length - 1;\n const last = this.visibleColumns.at(-1)?.key ?? this.firstColumn;\n this.active = { column: last, row } as ActiveNode<T>;\n this.scrollToRow(row);\n }\n\n /**\n * Rows per Page Up/Down step: the rows that fit in the part of the\n * scrollport the sticky chrome leaves visible, minus one so the row the\n * user was on stays in view. Falls back to 10 when nothing is measurable.\n */\n protected pageStep(): number {\n const host = this.host as unknown as HTMLElement;\n let rowHeight = 0;\n for (const row of this.virtualizer.querySelectorAll(GRID_ROW_TAG)) {\n const height = (row as HTMLElement).offsetHeight;\n // The shortest rendered row: an expanded detail panel is not a row height.\n if (height > 0 && (!rowHeight || height < rowHeight)) rowHeight = height;\n }\n const { top, bottom } = this.scrollInsets();\n const viewport = host.clientHeight - top - bottom;\n if (!rowHeight || viewport <= 0) return 10;\n return Math.max(1, Math.floor(viewport / rowHeight) - 1);\n }\n\n protected pageUp() {\n const next = this.nextNode;\n this.active = Object.assign(next, { row: Math.max(0, next.row - this.pageStep()) });\n this.scrollToRow(this.active.row);\n }\n\n protected pageDown() {\n const next = this.nextNode;\n this.active = Object.assign(next, {\n row: Math.min(this.host.pageItems.length - 1, next.row + this.pageStep()),\n });\n this.scrollToRow(this.active.row);\n }\n\n protected arrowDown() {\n const next = this.nextNode;\n this.active = Object.assign(next, {\n row: Math.min(next.row + 1, this.host.pageItems.length - 1),\n });\n this.scrollToRow(next.row);\n }\n\n protected arrowUp() {\n const next = this.nextNode;\n this.active = Object.assign(next, { row: Math.max(0, next.row - 1) });\n this.scrollToRow(next.row);\n }\n\n protected arrowLeft() {\n this.#moveInline('ArrowLeft');\n }\n\n protected arrowRight() {\n this.#moveInline('ArrowRight');\n }\n\n /**\n * Moves the active cell one column in a *physical* direction.\n *\n * ArrowLeft and ArrowRight name screen directions, not column order, so under\n * `dir=\"rtl\"` the column to the left is the *next* one and the mapping onto\n * previous/next inverts ({@link towardsInlineEnd}). Everything else about\n * navigation is order-based and needs no direction awareness.\n */\n #moveInline(key: 'ArrowLeft' | 'ArrowRight') {\n const next = this.nextNode;\n const column = this.towardsInlineEnd(key)\n ? this.getNextColumn(next.column)\n : this.getPreviousColumn(next.column);\n this.active = Object.assign(next, { column });\n this.scrollToCell(this.active);\n }\n\n protected toggleSelection() {\n // Space on the focused grid toggles selection of the active row.\n // No-op when selection is disabled, there's no active row, or the row is\n // module-rendered (a group header or total row is not a data row).\n const data = this.host.pageItems[this._active.row] as T | undefined;\n if (!data || this.isPresentedRow(this._active.row)) return;\n void this.host.toggleRowSelection(data);\n }\n\n public hostConnected() {\n const detached = this.#detached;\n this.#detached = null;\n if (detached) this.#refocusAfterMove(detached.node);\n }\n\n public hostDisconnected() {\n // A grid moved while its body held focus: under row recycling the master\n // row showing this grid's record changes on a master sort, and the\n // detail node follows its record into another row. The browser dropped\n // focus just before (`#blurred`, or silently in Firefox and WebKit, which\n // fire no `focusout` for it); a re-attach within this task restores the\n // active cell and focus. Anything later is a removal, as before.\n const dropped = this.#blurred !== null || (this.#ownsFocus && this.#lost());\n const moved = dropped && this.host.rowRecycling;\n const detached = moved ? { node: this._active } : null;\n this.active = SENTINEL_NODE as ActiveNode<T>;\n this.#detached = detached;\n // A grid out of the document holds no focus: a re-attach later (a kept\n // alive tab or route) must not take focus on its next sort or scroll.\n if (!detached) this.#ownsFocus = false;\n if (detached) {\n setTimeout(() => {\n if (this.#detached !== detached) return;\n this.#detached = null;\n this.#ownsFocus = false;\n });\n }\n }\n\n /**\n * Restores the active cell a moved grid had and focuses it (the body when\n * no cell was active, or its row is not rendered), unless something else\n * took focus in the meantime.\n */\n #refocusAfterMove(node: ActiveNode<T>): void {\n if (node !== SENTINEL_NODE) this.active = node;\n void (async () => {\n await this.host.updateComplete;\n if (!this.#lost() || this._active !== node || !this.host.isConnected) return;\n const cell = node === SENTINEL_NODE ? undefined : this.findCell(node);\n // The body forwards to the active cell once the rows have rendered.\n (cell ?? (this.virtualizer as HTMLElement)).focus({ preventScroll: true });\n })();\n }\n\n protected get editing() {\n // @ts-expect-error - protected member access\n return this.host.stateController.editing as\n | {\n activeCell: { data: T; columnKey: Keys<T>; rowIndex: number } | null;\n enabled: boolean;\n isEditable(column: ColumnConfiguration<T>): boolean;\n editCell(rowIndex: number, columnKey: Keys<T>): Promise<boolean>;\n }\n | undefined;\n }\n\n /**\n * Enter / F2 on the active cell opens its editor (the keyboard path into\n * edit mode). Returns `true` when the event was consumed.\n */\n protected handleEditKey(event: KeyboardEvent): boolean {\n if (event.key !== 'Enter' && event.key !== 'F2') return false;\n if (event.ctrlKey || event.metaKey || event.altKey) return false;\n if (this._active === SENTINEL_NODE || this.isPresentedRow(this._active.row)) return false;\n const editing = this.editing;\n if (!editing?.enabled) return false;\n const column = this.host.getColumn(this.active.column);\n if (!column || !editing.isEditable(column)) return false;\n event.preventDefault();\n void editing.editCell(this.active.row, this.active.column);\n return true;\n }\n\n protected get rowReorder() {\n // @ts-expect-error - protected member access\n return this.host.stateController.rowReorder as\n | {\n enabled: boolean;\n isGrabbing: boolean;\n grabbed: T | null;\n grab(rowIndex: number): boolean;\n moveGrabbed(direction: -1 | 1): number;\n drop(): void;\n cancelGrab(): void;\n }\n | undefined;\n }\n\n /**\n * Keyboard row reorder: Space grabs the active row, arrows move it, Space /\n * Enter drops, Escape cancels. Returns `true` when the event was consumed.\n * Only active when `rowReordering.enabled` (so it never shadows Space-to-select\n * on grids without reordering).\n */\n protected handleReorderKey(event: KeyboardEvent): boolean {\n const reorder = this.rowReorder;\n if (!reorder?.enabled) return false;\n\n if (reorder.isGrabbing) {\n switch (event.key) {\n case 'ArrowUp':\n case 'ArrowDown': {\n event.preventDefault();\n const row = reorder.grabbed;\n const next = reorder.moveGrabbed(event.key === 'ArrowDown' ? 1 : -1);\n if (next >= 0 && row) {\n this.active = Object.assign(this.nextNode, { row: next });\n this.scrollToRow(next);\n this.#followRecord(row);\n }\n return true;\n }\n case ' ':\n case 'Enter':\n event.preventDefault();\n reorder.drop();\n return true;\n case 'Escape': {\n event.preventDefault();\n const row = reorder.grabbed;\n reorder.cancelGrab();\n if (row) this.#followRecord(row);\n return true;\n }\n default:\n return false;\n }\n }\n\n if (event.key === ' ' && this.active.row >= 0 && !this.isPresentedRow(this.active.row)) {\n event.preventDefault();\n return reorder.grab(this.active.row);\n }\n return false;\n }\n\n /**\n * After a keyboard grab moves `record` (or Escape puts it back), puts the\n * active row on the record's view index and real focus on its cell, once\n * the re-run pipeline has rendered. The move re-renders the rows, which\n * can drop focus or leave it on an element now showing another record.\n * Yields when the active cell changed in the meantime (a newer key).\n */\n #followRecord(record: T): void {\n const node = this._active;\n // @ts-expect-error - protected member access\n void (this.host.pipelineSettled() as Promise<void>).then(() => {\n if (this._active !== node || node === SENTINEL_NODE) return;\n const row = this.host.pageItems.indexOf(record);\n if (row < 0) return;\n if (row !== node.row) {\n this.active = { ...node, row };\n this.scrollToRow(row);\n }\n this.focusActiveCell();\n });\n }\n\n public navigate(event: KeyboardEvent) {\n if (this.handleReorderKey(event)) return;\n // Undo / redo: Ctrl/Cmd+Z, Ctrl/Cmd+Shift+Z, Ctrl/Cmd+Y. Only fires when the\n // grid body (not an open editor) has focus, so a text editor's native undo\n // is never hijacked.\n if ((event.ctrlKey || event.metaKey) && !event.altKey) {\n const key = event.key.toLowerCase();\n if (key === 'z' && !event.shiftKey) {\n event.preventDefault();\n this.host.undo();\n return;\n }\n if ((key === 'z' && event.shiftKey) || key === 'y') {\n event.preventDefault();\n this.host.redo();\n return;\n }\n // Ctrl/Cmd+Home / Ctrl/Cmd+End jump to the grid corners (ARIA grid pattern).\n if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault();\n if (!this.navigable) return;\n if (event.key === 'Home') {\n this.ctrlHome();\n } else {\n this.ctrlEnd();\n }\n // The target row is often outside the rendered window, so the cell is\n // revealed (horizontally too) once the virtualizer has rendered it.\n this.focusActiveCell(true);\n return;\n }\n }\n if (this.handleEditKey(event)) return;\n if (RELATIVE_KEYS.has(event.key)) {\n event.preventDefault();\n if (!this.navigable) return;\n // Entering the body with the keyboard (Tab lands on the scroll\n // container, no cell active yet): an arrow, Home or Page Up activates\n // the first cell instead of moving past it. End and Page Down still\n // move, starting from that first cell.\n if (this._active === SENTINEL_NODE) {\n // Through the setter: the render it requests moves the tab stop\n // from the body to the cell.\n this.active = { column: this.firstColumn, row: 0 } as ActiveNode<T>;\n if (event.key !== 'End' && event.key !== 'PageDown') {\n this.scrollToRow(0);\n this.focusActiveCell(true);\n return;\n }\n }\n }\n if (this.handlers.has(event.key)) {\n event.preventDefault();\n this.handlers.get(event.key)!.call(this);\n // Real focus follows the active cell so AT tracks the movement.\n this.focusActiveCell();\n }\n }\n}\n"]}
@@ -15,8 +15,8 @@ export declare const DEFAULT_PAGINATION: Readonly<{
15
15
  * @remarks
16
16
  * Exposes a state machine for the current `page` and `pageSize`, derives `pageCount`
17
17
  * from the host's data, and emits the cancellable `pageChanging` + `pageChanged`
18
- * events on the grid host. Page slicing itself is performed by
19
- * {@link PaginationDataOperation} so the controller does not mutate `dataView`.
18
+ * events on the grid host. The page slice itself is read from
19
+ * {@link ApexGrid.pageItems}, so the controller never mutates `dataView`.
20
20
  */
21
21
  export declare class PaginationController<T extends object> implements ReactiveController {
22
22
  #private;
@@ -36,11 +36,12 @@ export declare class PaginationController<T extends object> implements ReactiveC
36
36
  */
37
37
  get enabled(): boolean;
38
38
  /**
39
- * The total number of records before pagination is applied.
39
+ * The number of rows paged through (see {@link ApexGrid.totalItems}).
40
40
  *
41
41
  * @remarks
42
- * For `'local'` mode this is the post-filter, post-sort dataset length. For `'remote'`
43
- * mode the consumer must supply the value via `pagination.totalItems`.
42
+ * For `'local'` mode this is the post-filter, post-sort row count; with pagination
43
+ * enabled it leaves out the pinned rows, so it counts the rows {@link ApexGrid.pageItems}
44
+ * slices. For `'remote'` mode the consumer supplies the value via `pagination.totalItems`.
44
45
  */
45
46
  get totalItems(): number;
46
47
  /**
@@ -70,12 +71,18 @@ export declare class PaginationController<T extends object> implements ReactiveC
70
71
  reclamp(): void;
71
72
  /**
72
73
  * Navigates to `page`, emitting the cancellable `pageChanging` event first and
73
- * the `pageChanged` event after the pipeline has applied.
74
+ * the `pageChanged` event after the change rendered.
74
75
  *
75
76
  * @param page - The target zero-based page index. Out-of-range values are clamped.
76
77
  * @returns `true` if the change was applied, `false` if it was cancelled or a no-op.
77
78
  */
78
79
  gotoPage(page: number): Promise<boolean>;
80
+ /**
81
+ * Moves to the first page as part of a change already confirmed (a new
82
+ * quick filter), so without `pageChanging`; fires `pageChanged` once the
83
+ * pipeline settled when the page actually moved.
84
+ */
85
+ resetPage(): Promise<void>;
79
86
  /**
80
87
  * Sets the current page size and resets to the first page.
81
88
  *
@@ -21,20 +21,18 @@ export class PaginationController {
21
21
  if (cfg?.mode === 'remote') {
22
22
  return Math.max(0, cfg?.totalItems ?? 0);
23
23
  }
24
- return this.host.dataState?.length ?? 0;
24
+ return (this.enabled ? this.host.bodyRows : this.host.dataState)?.length ?? 0;
25
25
  }
26
26
  get pageCount() {
27
- if (!this.pageSize)
28
- return 1;
29
- return Math.max(1, Math.ceil(this.totalItems / this.pageSize));
27
+ return this.state.pageCount;
30
28
  }
31
29
  get state() {
32
- return {
33
- page: this.page,
34
- pageSize: this.pageSize,
35
- pageCount: this.pageCount,
36
- totalItems: this.totalItems,
37
- };
30
+ return this.#stateFor(this.page, this.pageSize);
31
+ }
32
+ #stateFor(page, pageSize) {
33
+ const totalItems = this.totalItems;
34
+ const pageCount = pageSize ? Math.max(1, Math.ceil(totalItems / pageSize)) : 1;
35
+ return { page, pageSize, pageCount, totalItems };
38
36
  }
39
37
  clamp(page) {
40
38
  if (!Number.isFinite(page))
@@ -59,9 +57,21 @@ export class PaginationController {
59
57
  cancelable: true,
60
58
  });
61
59
  }
62
- #emitChanged() {
63
- this.host.announce(this.host.localize('announce.page', { page: this.page + 1, total: this.pageCount }));
64
- return this.host.emitEvent('pageChanged', { detail: this.state });
60
+ async #apply(page, pageSize) {
61
+ this.page = page;
62
+ this.pageSize = pageSize;
63
+ const parked = this.host.stateController.navigation.parkFocus();
64
+ this.host.requestUpdate(this.host.pagination?.mode === 'remote' ? PIPELINE : undefined);
65
+ try {
66
+ await this.host.pipelineSettled();
67
+ }
68
+ finally {
69
+ if (parked)
70
+ void parked();
71
+ }
72
+ const detail = this.#stateFor(page, pageSize);
73
+ this.host.announce(this.host.localize('announce.page', { page: page + 1, total: detail.pageCount }));
74
+ this.host.emitEvent('pageChanged', { detail });
65
75
  }
66
76
  async gotoPage(page) {
67
77
  const next = this.clamp(page);
@@ -70,12 +80,13 @@ export class PaginationController {
70
80
  if (!this.#emitChanging(next, this.pageSize)) {
71
81
  return false;
72
82
  }
73
- this.page = next;
74
- this.host.requestUpdate(PIPELINE);
75
- await this.host.updateComplete;
76
- this.#emitChanged();
83
+ await this.#apply(next, this.pageSize);
77
84
  return true;
78
85
  }
86
+ async resetPage() {
87
+ if (this.page !== 0)
88
+ await this.#apply(0, this.pageSize);
89
+ }
79
90
  async setPageSize(size) {
80
91
  const next = Math.max(1, Math.trunc(size));
81
92
  if (next === this.pageSize)
@@ -83,11 +94,7 @@ export class PaginationController {
83
94
  if (!this.#emitChanging(0, next)) {
84
95
  return false;
85
96
  }
86
- this.pageSize = next;
87
- this.page = 0;
88
- this.host.requestUpdate(PIPELINE);
89
- await this.host.updateComplete;
90
- this.#emitChanged();
97
+ await this.#apply(0, next);
91
98
  return true;
92
99
  }
93
100
  nextPage() {
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/controllers/pagination.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAMpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9C,IAAI,EAAE,OAAgB;IACtB,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,EAAE;IACZ,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAsB;CACvE,CAAC,CAAC;AAWH,MAAM,OAAO,oBAAoB;IAW/B,YAAsB,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;QAPhC,SAAI,GAAW,kBAAkB,CAAC,IAAI,CAAC;QAKvC,aAAQ,GAAW,kBAAkB,CAAC,QAAQ,CAAC;QAGpD,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAEM,aAAa,KAAI,CAAC;IAKzB,IAAW,OAAO;QAChB,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IASD,IAAW,UAAU;QACnB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;QACjC,IAAI,GAAG,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,IAAI,CAAC,CAAC,CAAC;QAC3C,CAAC;QAED,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC,CAAC;IAC1C,CAAC;IAQD,IAAW,SA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Q,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAClC,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC;QAC/B,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAKM,QAAQ;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IACtC,CAAC;IAKM,YAAY;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IACtC,CAAC;IAKM,SAAS;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAKM,QAAQ;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["import type { ReactiveController } from 'lit';\nimport { PIPELINE } from '../internal/constants.js';\nimport type { GridHost, PaginationState } from '../internal/types.js';\n\n/**\n * Default pagination state used when no `pagination` configuration is provided.\n */\nexport const DEFAULT_PAGINATION = Object.freeze({\n mode: 'local' as const,\n page: 0,\n pageSize: 25,\n pageSizeOptions: Object.freeze([10, 25, 50, 100]) as readonly number[],\n});\n\n/**\n * Reactive controller that owns the grid's pagination state.\n *\n * @remarks\n * Exposes a state machine for the current `page` and `pageSize`, derives `pageCount`\n * from the host's data, and emits the cancellable `pageChanging` + `pageChanged`\n * events on the grid host. Page slicing itself is performed by\n * {@link PaginationDataOperation} so the controller does not mutate `dataView`.\n */\nexport class PaginationController<T extends object> implements ReactiveController {\n /**\n * The current zero-based page index.\n */\n public page: number = DEFAULT_PAGINATION.page;\n\n /**\n * The current page size.\n */\n public pageSize: number = DEFAULT_PAGINATION.pageSize;\n\n constructor(protected host: GridHost<T>) {\n this.host.addController(this);\n }\n\n public hostConnected() {}\n\n /**\n * Whether pagination is enabled on the host grid.\n */\n public get enabled(): boolean {\n return Boolean(this.host.pagination?.enabled);\n }\n\n /**\n * The total number of records before pagination is applied.\n *\n * @remarks\n * For `'local'` mode this is the post-filter, post-sort dataset length. For `'remote'`\n * mode the consumer must supply the value via `pagination.totalItems`.\n */\n public get totalItems(): number {\n const cfg = this.host.pagination;\n if (cfg?.mode === 'remote') {\n return Math.max(0, cfg?.totalItems ?? 0);\n }\n // @ts-expect-error - protected member access\n return this.host.dataState?.length ?? 0;\n }\n\n /**\n * The total number of pages for the current data view and `pageSize`.\n *\n * @remarks\n * Always at least `1` so a paginator can render a sensible \"1 / 1\" label for empty data.\n */\n public get pageCount(): number {\n if (!this.pageSize) return 1;\n return Math.max(1, Math.ceil(this.totalItems / this.pageSize));\n }\n\n /**\n * Returns the resolved {@link PaginationState} for the current host.\n */\n public get state(): PaginationState {\n return {\n page: this.page,\n pageSize: this.pageSize,\n pageCount: this.pageCount,\n totalItems: this.totalItems,\n };\n }\n\n /**\n * Clamps a candidate `page` index into the valid `[0, pageCount - 1]` range.\n *\n * @param page - The candidate page index.\n */\n public clamp(page: number): number {\n if (!Number.isFinite(page)) return 0;\n return Math.min(Math.max(0, Math.trunc(page)), Math.max(0, this.pageCount - 1));\n }\n\n /**\n * Re-clamps the current page after the dataset size (or `pageSize`) changes.\n *\n * @remarks\n * Called from the grid pipeline so paging never points past the last valid page.\n * Mutates `page` in place and requests a re-render when the value changes.\n */\n public reclamp(): void {\n const next = this.clamp(this.page);\n if (next !== this.page) {\n this.page = next;\n this.host.requestUpdate();\n }\n }\n\n #emitChanging(nextPage: number, nextPageSize: number) {\n return this.host.emitEvent('pageChanging', {\n detail: {\n page: this.page,\n pageSize: this.pageSize,\n nextPage,\n nextPageSize,\n },\n cancelable: true,\n });\n }\n\n #emitChanged() {\n this.host.announce(\n this.host.localize('announce.page', { page: this.page + 1, total: this.pageCount })\n );\n return this.host.emitEvent('pageChanged', { detail: this.state });\n }\n\n /**\n * Navigates to `page`, emitting the cancellable `pageChanging` event first and\n * the `pageChanged` event after the pipeline has applied.\n *\n * @param page - The target zero-based page index. Out-of-range values are clamped.\n * @returns `true` if the change was applied, `false` if it was cancelled or a no-op.\n */\n public async gotoPage(page: number): Promise<boolean> {\n const next = this.clamp(page);\n if (next === this.page) return false;\n\n if (!this.#emitChanging(next, this.pageSize)) {\n return false;\n }\n\n this.page = next;\n this.host.requestUpdate(PIPELINE);\n await this.host.updateComplete;\n this.#emitChanged();\n return true;\n }\n\n /**\n * Sets the current page size and resets to the first page.\n *\n * @param size - The new page size. Must be a positive integer.\n * @returns `true` if the change was applied, `false` if it was cancelled or a no-op.\n */\n public async setPageSize(size: number): Promise<boolean> {\n const next = Math.max(1, Math.trunc(size));\n if (next === this.pageSize) return false;\n\n if (!this.#emitChanging(0, next)) {\n return false;\n }\n\n this.pageSize = next;\n this.page = 0;\n this.host.requestUpdate(PIPELINE);\n await this.host.updateComplete;\n this.#emitChanged();\n return true;\n }\n\n /**\n * Navigates to the next page if not already on the last one.\n */\n public nextPage() {\n return this.gotoPage(this.page + 1);\n }\n\n /**\n * Navigates to the previous page if not already on the first one.\n */\n public previousPage() {\n return this.gotoPage(this.page - 1);\n }\n\n /**\n * Navigates to the first page.\n */\n public firstPage() {\n return this.gotoPage(0);\n }\n\n /**\n * Navigates to the last page.\n */\n public lastPage() {\n return this.gotoPage(this.pageCount - 1);\n }\n}\n"]}
1
+ {"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/controllers/pagination.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAMpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9C,IAAI,EAAE,OAAgB;IACtB,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,EAAE;IACZ,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE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IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3D,CAAC;IAQM,KAAK,CAAC,WAAW,CAAC,IAAY;QACnC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3C,IAAI,IAAI,KAAK,IAAI,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAC;QAEzC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;YACjC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAKM,QAAQ;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IACtC,CAAC;IAKM,YAAY;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IACtC,CAAC;IAKM,SAAS;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAKM,QAAQ;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["import type { ReactiveController } from 'lit';\nimport { PIPELINE } from '../internal/constants.js';\nimport type { GridHost, PaginationState } from '../internal/types.js';\n\n/**\n * Default pagination state used when no `pagination` configuration is provided.\n */\nexport const DEFAULT_PAGINATION = Object.freeze({\n mode: 'local' as const,\n page: 0,\n pageSize: 25,\n pageSizeOptions: Object.freeze([10, 25, 50, 100]) as readonly number[],\n});\n\n/**\n * Reactive controller that owns the grid's pagination state.\n *\n * @remarks\n * Exposes a state machine for the current `page` and `pageSize`, derives `pageCount`\n * from the host's data, and emits the cancellable `pageChanging` + `pageChanged`\n * events on the grid host. The page slice itself is read from\n * {@link ApexGrid.pageItems}, so the controller never mutates `dataView`.\n */\nexport class PaginationController<T extends object> implements ReactiveController {\n /**\n * The current zero-based page index.\n */\n public page: number = DEFAULT_PAGINATION.page;\n\n /**\n * The current page size.\n */\n public pageSize: number = DEFAULT_PAGINATION.pageSize;\n\n constructor(protected host: GridHost<T>) {\n this.host.addController(this);\n }\n\n public hostConnected() {}\n\n /**\n * Whether pagination is enabled on the host grid.\n */\n public get enabled(): boolean {\n return Boolean(this.host.pagination?.enabled);\n }\n\n /**\n * The number of rows paged through (see {@link ApexGrid.totalItems}).\n *\n * @remarks\n * For `'local'` mode this is the post-filter, post-sort row count; with pagination\n * enabled it leaves out the pinned rows, so it counts the rows {@link ApexGrid.pageItems}\n * slices. For `'remote'` mode the consumer supplies the value via `pagination.totalItems`.\n */\n public get totalItems(): number {\n const cfg = this.host.pagination;\n if (cfg?.mode === 'remote') {\n return Math.max(0, cfg?.totalItems ?? 0);\n }\n // @ts-expect-error - protected member access\n return (this.enabled ? this.host.bodyRows : this.host.dataState)?.length ?? 0;\n }\n\n /**\n * The total number of pages for the current data view and `pageSize`.\n *\n * @remarks\n * Always at least `1` so a paginator can render a sensible \"1 / 1\" label for empty data.\n */\n public get pageCount(): number {\n return this.state.pageCount;\n }\n\n /**\n * Returns the resolved {@link PaginationState} for the current host.\n */\n public get state(): PaginationState {\n return this.#stateFor(this.page, this.pageSize);\n }\n\n /** The state for `page` and `pageSize` over the rows the grid holds now. */\n #stateFor(page: number, pageSize: number): PaginationState {\n const totalItems = this.totalItems;\n const pageCount = pageSize ? Math.max(1, Math.ceil(totalItems / pageSize)) : 1;\n return { page, pageSize, pageCount, totalItems };\n }\n\n /**\n * Clamps a candidate `page` index into the valid `[0, pageCount - 1]` range.\n *\n * @param page - The candidate page index.\n */\n public clamp(page: number): number {\n if (!Number.isFinite(page)) return 0;\n return Math.min(Math.max(0, Math.trunc(page)), Math.max(0, this.pageCount - 1));\n }\n\n /**\n * Re-clamps the current page after the dataset size (or `pageSize`) changes.\n *\n * @remarks\n * Called from the grid pipeline so paging never points past the last valid page.\n * Mutates `page` in place and requests a re-render when the value changes.\n */\n public reclamp(): void {\n const next = this.clamp(this.page);\n if (next !== this.page) {\n this.page = next;\n this.host.requestUpdate();\n }\n }\n\n #emitChanging(nextPage: number, nextPageSize: number) {\n return this.host.emitEvent('pageChanging', {\n detail: {\n page: this.page,\n pageSize: this.pageSize,\n nextPage,\n nextPageSize,\n },\n cancelable: true,\n });\n }\n\n /**\n * Applies `page` and `pageSize`, then fires `pageChanged` for that change\n * once it rendered. The detail is this change, not whatever page a later\n * call moved to meanwhile, so two unawaited calls report two pages. In\n * local mode the body slice is read from {@link ApexGrid.pageItems} on\n * render, so the data pipeline does not rerun; in remote mode it does, so\n * a pipeline hook that fetches the page by `grid.page` sees the new page.\n */\n async #apply(page: number, pageSize: number): Promise<void> {\n this.page = page;\n this.pageSize = pageSize;\n // Row recycling re-binds the focused row to the new page's record, so\n // focus moves to the body rather than stay on the same slot.\n // @ts-expect-error - protected member access\n const parked = this.host.stateController.navigation.parkFocus() as (() => Promise<void>) | null;\n this.host.requestUpdate(this.host.pagination?.mode === 'remote' ? PIPELINE : undefined);\n try {\n // @ts-expect-error - protected member access\n await this.host.pipelineSettled();\n } finally {\n if (parked) void parked();\n }\n const detail = this.#stateFor(page, pageSize);\n this.host.announce(\n this.host.localize('announce.page', { page: page + 1, total: detail.pageCount })\n );\n this.host.emitEvent('pageChanged', { detail });\n }\n\n /**\n * Navigates to `page`, emitting the cancellable `pageChanging` event first and\n * the `pageChanged` event after the change rendered.\n *\n * @param page - The target zero-based page index. Out-of-range values are clamped.\n * @returns `true` if the change was applied, `false` if it was cancelled or a no-op.\n */\n public async gotoPage(page: number): Promise<boolean> {\n const next = this.clamp(page);\n if (next === this.page) return false;\n\n if (!this.#emitChanging(next, this.pageSize)) {\n return false;\n }\n\n await this.#apply(next, this.pageSize);\n return true;\n }\n\n /**\n * Moves to the first page as part of a change already confirmed (a new\n * quick filter), so without `pageChanging`; fires `pageChanged` once the\n * pipeline settled when the page actually moved.\n */\n public async resetPage(): Promise<void> {\n if (this.page !== 0) await this.#apply(0, this.pageSize);\n }\n\n /**\n * Sets the current page size and resets to the first page.\n *\n * @param size - The new page size. Must be a positive integer.\n * @returns `true` if the change was applied, `false` if it was cancelled or a no-op.\n */\n public async setPageSize(size: number): Promise<boolean> {\n const next = Math.max(1, Math.trunc(size));\n if (next === this.pageSize) return false;\n\n if (!this.#emitChanging(0, next)) {\n return false;\n }\n\n await this.#apply(0, next);\n return true;\n }\n\n /**\n * Navigates to the next page if not already on the last one.\n */\n public nextPage() {\n return this.gotoPage(this.page + 1);\n }\n\n /**\n * Navigates to the previous page if not already on the first one.\n */\n public previousPage() {\n return this.gotoPage(this.page - 1);\n }\n\n /**\n * Navigates to the first page.\n */\n public firstPage() {\n return this.gotoPage(0);\n }\n\n /**\n * Navigates to the last page.\n */\n public lastPage() {\n return this.gotoPage(this.pageCount - 1);\n }\n}\n"]}
@@ -2,10 +2,12 @@ import { awaitChildUpdates, captureRect, playFlip } from '../internal/flip.js';
2
2
  import { isRTL } from '../internal/utils.js';
3
3
  export class ReorderController {
4
4
  #swapping;
5
+ #vetoed;
5
6
  constructor(host) {
6
7
  this.host = host;
7
8
  this.state = null;
8
9
  this.#swapping = false;
10
+ this.#vetoed = '';
9
11
  this.host.addController(this);
10
12
  }
11
13
  hostConnected() { }
@@ -56,58 +58,72 @@ export class ReorderController {
56
58
  if (!this.state)
57
59
  return;
58
60
  this.state = null;
61
+ this.#vetoed = '';
59
62
  this.host.requestUpdate();
60
63
  }
61
64
  async #checkSwap(clientX) {
62
65
  if (!this.state || this.#swapping)
63
66
  return;
64
- const source = this.host.getColumn(this.state.sourceKey);
65
- if (!source)
67
+ const swap = this.#swapAt(clientX);
68
+ const key = swap ? `${String(swap.target.key)}:${swap.position}` : '';
69
+ if (key && key === this.#vetoed)
70
+ return;
71
+ this.#vetoed = '';
72
+ if (!swap)
66
73
  return;
74
+ this.#swapping = true;
75
+ try {
76
+ const before = this.#captureCellRects();
77
+ if (!(await this.host.moveColumn(swap.source.key, swap.target.key, swap.position))) {
78
+ this.#vetoed = key;
79
+ return;
80
+ }
81
+ await this.host.updateComplete;
82
+ await awaitChildUpdates([
83
+ this.headerRow,
84
+ ...this.host.rows,
85
+ ]);
86
+ playFlip(before, 'x');
87
+ }
88
+ finally {
89
+ this.#swapping = false;
90
+ }
91
+ }
92
+ #swapAt(clientX) {
93
+ const source = this.state && this.host.getColumn(this.state.sourceKey);
94
+ if (!source)
95
+ return null;
67
96
  const headerRow = this.headerRow;
68
97
  if (!headerRow?.headers)
69
- return;
98
+ return null;
70
99
  const target = headerRow.headers.find((h) => {
71
100
  const rect = h.getBoundingClientRect();
72
101
  return clientX >= rect.left && clientX < rect.right;
73
102
  });
74
103
  if (!target || target.column.key === source.key)
75
- return;
104
+ return null;
76
105
  if (!this.canDrop(source, target.column))
77
- return;
106
+ return null;
78
107
  const rect = target.getBoundingClientRect();
79
108
  const midpoint = rect.left + rect.width / 2;
80
109
  const visibleColumns = this.host.columns.filter((c) => !c.hidden);
81
110
  const sourceIdx = visibleColumns.findIndex((c) => c.key === source.key);
82
111
  const targetIdx = visibleColumns.findIndex((c) => c.key === target.column.key);
83
112
  if (sourceIdx === -1 || targetIdx === -1)
84
- return;
113
+ return null;
85
114
  const rtl = isRTL(this.host);
86
115
  let position;
87
116
  if (sourceIdx < targetIdx) {
88
117
  if (rtl ? clientX > midpoint : clientX < midpoint)
89
- return;
118
+ return null;
90
119
  position = 'after';
91
120
  }
92
121
  else {
93
122
  if (rtl ? clientX < midpoint : clientX > midpoint)
94
- return;
123
+ return null;
95
124
  position = 'before';
96
125
  }
97
- this.#swapping = true;
98
- try {
99
- const before = this.#captureCellRects();
100
- await this.host.moveColumn(source.key, target.column.key, position);
101
- await this.host.updateComplete;
102
- await awaitChildUpdates([
103
- this.headerRow,
104
- ...this.host.rows,
105
- ]);
106
- playFlip(before, 'x');
107
- }
108
- finally {
109
- this.#swapping = false;
110
- }
126
+ return { source, target: target.column, position };
111
127
  }
112
128
  #captureCellRects() {
113
129
  const entries = [];
@@ -1 +1 @@
1
- {"version":3,"file":"reorder.js","sourceRoot":"","sources":["../../src/controllers/reorder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAkB,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/F,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAyC7C,MAAM,OAAO,iBAAiB;IAI5B,SAAS,CAAS;IAElB,YAAsB,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;QALhC,UAAK,GAA2B,IAAI,CAAC;QAG5C,cAAS,GAAG,KAAK,CAAC;QAGhB,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAEM,aAAa,KAAI,CAAC;IAEzB,IAAc,SAAS;QAErB,OAAO,IAAI,CAAC,IAAI,CAAC,SAEJ,CAAC;IAChB,CAAC;IAKM,WAAW,CAAC,MAA8B;QAC/C,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB;YAAE,OAAO,KAAK,CAAC;QAC9C,IAAI,MAAM,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QAChC,OAAO,MAAM,CAAC,WAAW,KAAK,KAAK,CAAC;IACtC,CAAC;IAMM,OAAO,CAAC,MAA8B,EAAE,MAA8B;QAC3E,IAAI,MAAM,CAAC,GAAG,KAAK,MAAM,CAAC,GAAG;YAAE,OAAO,KAAK,CAAC;QAC5C,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;YAAE,OAAO,KAAK,CAAC;QACzE,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC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CAAC;YACvB,KAAK,MAAM,MAAM,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;gBACvC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;QACD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACjC,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;gBAC7B,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,IAA8B,CAAC,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["import type { ReactiveController } from 'lit';\nimport { awaitChildUpdates, captureRect, type FlipEntry, playFlip } from '../internal/flip.js';\nimport type { ColumnConfiguration, GridHost, Keys } from '../internal/types.js';\nimport { isRTL } from '../internal/utils.js';\n\n/**\n * Live drag state surfaced to the header row so it can render the floating\n * \"ghost\" element that follows the cursor.\n *\n * @remarks\n * The dragged column itself stays in the columns array — we live-swap it\n * with neighbours as the cursor crosses their midpoints, so the rendered\n * order updates while the user is still dragging. The ghost is purely a\n * visual indicator of what the user is grabbing.\n */\ninterface ReorderState<T> {\n /** The column currently being dragged. */\n sourceKey: Keys<T>;\n /** Ghost position (viewport-relative top-left, in CSS pixels). */\n ghostX: number;\n ghostY: number;\n /** Ghost size — fixed at the source header's initial bounding rect. */\n ghostWidth: number;\n ghostHeight: number;\n /** Cursor offset within the ghost so the grab point stays under the cursor. */\n pointerOffsetX: number;\n pointerOffsetY: number;\n /** Display label for the ghost (header text or column key). */\n label: string;\n}\n\n/**\n * Reactive controller backing pointer-driven column reordering with a\n * floating ghost and live mid-drag swaps.\n *\n * @remarks\n * Headers feed `pointerdown` / `pointermove` / `pointerup` events into the\n * controller. While dragging, the controller updates the ghost position and\n * decides whether the cursor has crossed an adjacent column's midpoint —\n * if so it calls {@link ApexGrid.moveColumn} immediately, so the swap\n * happens during the drag instead of waiting for drop. The same cancellable\n * `columnMoving` / follow-up `columnMoved` event pipeline applies for\n * every swap.\n */\nexport class ReorderController<T extends object> implements ReactiveController {\n public state: ReorderState<T> | null = null;\n\n /** Re-entrancy guard so a slow `moveColumn` can't trigger a second swap. */\n #swapping = false;\n\n constructor(protected host: GridHost<T>) {\n this.host.addController(this);\n }\n\n public hostConnected() {}\n\n protected get headerRow() {\n // @ts-expect-error - protected member access\n return this.host.headerRow as\n | (HTMLElement & { headers?: Array<HTMLElement & { column: ColumnConfiguration<T> }> })\n | undefined;\n }\n\n /**\n * Whether reordering is enabled for the given column.\n */\n public isDraggable(column: ColumnConfiguration<T>): boolean {\n if (!this.host.columnReordering) return false;\n if (column.hidden) return false;\n return column.reorderable !== false;\n }\n\n /**\n * Whether `source` may be dropped onto `target`. Cross-pinning-group moves\n * are blocked so the drag can't escape its pin region.\n */\n public canDrop(source: ColumnConfiguration<T>, target: ColumnConfiguration<T>): boolean {\n if (source.key === target.key) return false;\n if (!this.isDraggable(source) || !this.isDraggable(target)) return false;\n if ((source.pinned ?? null) !== (target.pinned ?? null)) return false;\n // Grouped columns reorder only within their own group; ungrouped only among\n // ungrouped. Keeps a group's members contiguous (v1 has no group-level move).\n return (source.group ?? null) === (target.group ?? null);\n }\n\n /**\n * Begins a drag from `sourceKey`. Captures the source's bounding rect and\n * the cursor offset within it so the ghost stays anchored to the grab\n * point as the cursor moves.\n */\n public start(\n sourceKey: Keys<T>,\n sourceRect: DOMRect,\n initialClientX: number,\n initialClientY: number,\n label: string\n ): void {\n this.state = {\n sourceKey,\n ghostX: sourceRect.left,\n ghostY: sourceRect.top,\n ghostWidth: sourceRect.width,\n ghostHeight: sourceRect.height,\n pointerOffsetX: initialClientX - sourceRect.left,\n pointerOffsetY: initialClientY - sourceRect.top,\n label,\n };\n this.host.requestUpdate();\n }\n\n /**\n * Updates the ghost position and decides whether to swap with an adjacent\n * column.\n */\n public move(clientX: number, clientY: number): void {\n if (!this.state) return;\n this.state = {\n ...this.state,\n ghostX: clientX - this.state.pointerOffsetX,\n ghostY: clientY - this.state.pointerOffsetY,\n };\n this.host.requestUpdate();\n void this.#checkSwap(clientX);\n }\n\n /**\n * Ends the drag session. The columns are already in their final order\n * because we live-swapped during the drag, so there's nothing to commit.\n */\n public end(): void {\n if (!this.state) return;\n this.state = null;\n this.host.requestUpdate();\n }\n\n async #checkSwap(clientX: number): Promise<void> {\n if (!this.state || this.#swapping) return;\n const source = this.host.getColumn(this.state.sourceKey);\n if (!source) return;\n const headerRow = this.headerRow;\n if (!headerRow?.headers) return;\n\n // Find the visible header whose box currently contains the cursor X.\n const target = headerRow.headers.find((h) => {\n const rect = h.getBoundingClientRect();\n return clientX >= rect.left && clientX < rect.right;\n });\n if (!target || target.column.key === source.key) return;\n if (!this.canDrop(source, target.column)) return;\n\n // Only swap once the cursor crosses the target's midpoint, so we don't\n // bounce back and forth as soon as the ghost touches the edge.\n const rect = target.getBoundingClientRect();\n const midpoint = rect.left + rect.width / 2;\n const visibleColumns = this.host.columns.filter((c) => !c.hidden);\n const sourceIdx = visibleColumns.findIndex((c) => c.key === source.key);\n const targetIdx = visibleColumns.findIndex((c) => c.key === target.column.key);\n if (sourceIdx === -1 || targetIdx === -1) return;\n\n // `position` is order-based, so it needs no direction awareness. The\n // midpoint test does: moving toward a *later* column means moving right in\n // LTR and left under `dir=\"rtl\"`, so the comparison flips.\n const rtl = isRTL(this.host as unknown as Element);\n let position: 'before' | 'after';\n if (sourceIdx < targetIdx) {\n // Toward a later column — swap once the cursor crosses the target's centre.\n if (rtl ? clientX > midpoint : clientX < midpoint) return;\n position = 'after';\n } else {\n // Toward an earlier column — swap once the cursor crosses back over it.\n if (rtl ? clientX < midpoint : clientX > midpoint) return;\n position = 'before';\n }\n\n this.#swapping = true;\n try {\n const before = this.#captureCellRects();\n await this.host.moveColumn(source.key, target.column.key, position);\n await this.host.updateComplete;\n // Child rows + header row schedule their own updates one microtask\n // after the grid — wait for them so the cells have actually moved\n // before measuring the \"Last\" rect.\n await awaitChildUpdates([\n this.headerRow as unknown as { updateComplete: Promise<unknown> } | undefined,\n ...this.host.rows,\n ]);\n playFlip(before, 'x');\n } finally {\n this.#swapping = false;\n }\n }\n\n /**\n * Snapshots the bounding rect of every header + body cell before a\n * swap. Used as the \"First\" step of a FLIP — after `moveColumn` resolves,\n * `playFlip` computes the delta against the new rect and animates each\n * element from its old position back to identity.\n */\n #captureCellRects(): FlipEntry[] {\n const entries: FlipEntry[] = [];\n const headerRow = this.headerRow;\n if (headerRow?.headers) {\n for (const header of headerRow.headers) {\n entries.push(captureRect(header));\n }\n }\n for (const row of this.host.rows) {\n for (const cell of row.cells) {\n entries.push(captureRect(cell as unknown as HTMLElement));\n }\n }\n return entries;\n }\n}\n"]}
1
+ {"version":3,"file":"reorder.js","sourceRoot":"","sources":["../../src/controllers/reorder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAkB,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/F,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAyC7C,MAAM,OAAO,iBAAiB;IAI5B,SAAS,CAAS;IAOlB,OAAO,CAAM;IAEb,YAAsB,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;QAZhC,UAAK,GAA2B,IAAI,CAAC;QAG5C,cAAS,GAAG,KAAK,CAAC;QAOlB,YAAO,GAAG,EAAE,CAAC;QAGX,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAEM,aAAa,KAAI,CAAC;IAEzB,IAAc,SAAS;QAErB,OAAO,IAAI,CAAC,IAAI,CAAC,SAEJ,CAAC;IAChB,CAAC;IAKM,WAAW,CAAC,MAA8B;QAC/C,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB;YAAE,OAAO,KAAK,CAAC;QAC9C,IAAI,MAAM,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QAChC,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C;gBACvC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;QACD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACjC,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;gBAC7B,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,IAA8B,CAAC,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["import type { ReactiveController } from 'lit';\nimport { awaitChildUpdates, captureRect, type FlipEntry, playFlip } from '../internal/flip.js';\nimport type { ColumnConfiguration, GridHost, Keys } from '../internal/types.js';\nimport { isRTL } from '../internal/utils.js';\n\n/**\n * Live drag state surfaced to the header row so it can render the floating\n * \"ghost\" element that follows the cursor.\n *\n * @remarks\n * The dragged column itself stays in the columns array — we live-swap it\n * with neighbours as the cursor crosses their midpoints, so the rendered\n * order updates while the user is still dragging. The ghost is purely a\n * visual indicator of what the user is grabbing.\n */\ninterface ReorderState<T> {\n /** The column currently being dragged. */\n sourceKey: Keys<T>;\n /** Ghost position (viewport-relative top-left, in CSS pixels). */\n ghostX: number;\n ghostY: number;\n /** Ghost size — fixed at the source header's initial bounding rect. */\n ghostWidth: number;\n ghostHeight: number;\n /** Cursor offset within the ghost so the grab point stays under the cursor. */\n pointerOffsetX: number;\n pointerOffsetY: number;\n /** Display label for the ghost (header text or column key). */\n label: string;\n}\n\n/**\n * Reactive controller backing pointer-driven column reordering with a\n * floating ghost and live mid-drag swaps.\n *\n * @remarks\n * Headers feed `pointerdown` / `pointermove` / `pointerup` events into the\n * controller. While dragging, the controller updates the ghost position and\n * decides whether the cursor has crossed an adjacent column's midpoint —\n * if so it calls {@link ApexGrid.moveColumn} immediately, so the swap\n * happens during the drag instead of waiting for drop. The same cancellable\n * `columnMoving` / follow-up `columnMoved` event pipeline applies for\n * every swap.\n */\nexport class ReorderController<T extends object> implements ReactiveController {\n public state: ReorderState<T> | null = null;\n\n /** Re-entrancy guard so a slow `moveColumn` can't trigger a second swap. */\n #swapping = false;\n\n /**\n * The swap (`targetKey:position`) a `columnMoving` listener last vetoed. It\n * is not asked again while the cursor stays past that target's midpoint,\n * only once the cursor leaves and crosses it afresh.\n */\n #vetoed = '';\n\n constructor(protected host: GridHost<T>) {\n this.host.addController(this);\n }\n\n public hostConnected() {}\n\n protected get headerRow() {\n // @ts-expect-error - protected member access\n return this.host.headerRow as\n | (HTMLElement & { headers?: Array<HTMLElement & { column: ColumnConfiguration<T> }> })\n | undefined;\n }\n\n /**\n * Whether reordering is enabled for the given column.\n */\n public isDraggable(column: ColumnConfiguration<T>): boolean {\n if (!this.host.columnReordering) return false;\n if (column.hidden) return false;\n return column.reorderable !== false;\n }\n\n /**\n * Whether `source` may be dropped onto `target`. Cross-pinning-group moves\n * are blocked so the drag can't escape its pin region.\n */\n public canDrop(source: ColumnConfiguration<T>, target: ColumnConfiguration<T>): boolean {\n if (source.key === target.key) return false;\n if (!this.isDraggable(source) || !this.isDraggable(target)) return false;\n if ((source.pinned ?? null) !== (target.pinned ?? null)) return false;\n // Grouped columns reorder only within their own group; ungrouped only among\n // ungrouped. Keeps a group's members contiguous (v1 has no group-level move).\n return (source.group ?? null) === (target.group ?? null);\n }\n\n /**\n * Begins a drag from `sourceKey`. Captures the source's bounding rect and\n * the cursor offset within it so the ghost stays anchored to the grab\n * point as the cursor moves.\n */\n public start(\n sourceKey: Keys<T>,\n sourceRect: DOMRect,\n initialClientX: number,\n initialClientY: number,\n label: string\n ): void {\n this.state = {\n sourceKey,\n ghostX: sourceRect.left,\n ghostY: sourceRect.top,\n ghostWidth: sourceRect.width,\n ghostHeight: sourceRect.height,\n pointerOffsetX: initialClientX - sourceRect.left,\n pointerOffsetY: initialClientY - sourceRect.top,\n label,\n };\n this.host.requestUpdate();\n }\n\n /**\n * Updates the ghost position and decides whether to swap with an adjacent\n * column.\n */\n public move(clientX: number, clientY: number): void {\n if (!this.state) return;\n this.state = {\n ...this.state,\n ghostX: clientX - this.state.pointerOffsetX,\n ghostY: clientY - this.state.pointerOffsetY,\n };\n this.host.requestUpdate();\n void this.#checkSwap(clientX);\n }\n\n /**\n * Ends the drag session. The columns are already in their final order\n * because we live-swapped during the drag, so there's nothing to commit.\n */\n public end(): void {\n if (!this.state) return;\n this.state = null;\n this.#vetoed = '';\n this.host.requestUpdate();\n }\n\n async #checkSwap(clientX: number): Promise<void> {\n if (!this.state || this.#swapping) return;\n const swap = this.#swapAt(clientX);\n const key = swap ? `${String(swap.target.key)}:${swap.position}` : '';\n if (key && key === this.#vetoed) return;\n this.#vetoed = '';\n if (!swap) return;\n\n this.#swapping = true;\n try {\n const before = this.#captureCellRects();\n if (!(await this.host.moveColumn(swap.source.key, swap.target.key, swap.position))) {\n this.#vetoed = key;\n return;\n }\n await this.host.updateComplete;\n // Child rows + header row schedule their own updates one microtask\n // after the grid, so wait for them until the cells have actually moved\n // before measuring the \"Last\" rect.\n await awaitChildUpdates([\n this.headerRow as unknown as { updateComplete: Promise<unknown> } | undefined,\n ...this.host.rows,\n ]);\n playFlip(before, 'x');\n } finally {\n this.#swapping = false;\n }\n }\n\n /**\n * The swap the cursor at `clientX` asks for: the droppable header under it,\n * once the cursor is past that header's midpoint, or `null`.\n */\n #swapAt(clientX: number) {\n const source = this.state && this.host.getColumn(this.state.sourceKey);\n if (!source) return null;\n const headerRow = this.headerRow;\n if (!headerRow?.headers) return null;\n\n // Find the visible header whose box currently contains the cursor X.\n const target = headerRow.headers.find((h) => {\n const rect = h.getBoundingClientRect();\n return clientX >= rect.left && clientX < rect.right;\n });\n if (!target || target.column.key === source.key) return null;\n if (!this.canDrop(source, target.column)) return null;\n\n // Only swap once the cursor crosses the target's midpoint, so we don't\n // bounce back and forth as soon as the ghost touches the edge.\n const rect = target.getBoundingClientRect();\n const midpoint = rect.left + rect.width / 2;\n const visibleColumns = this.host.columns.filter((c) => !c.hidden);\n const sourceIdx = visibleColumns.findIndex((c) => c.key === source.key);\n const targetIdx = visibleColumns.findIndex((c) => c.key === target.column.key);\n if (sourceIdx === -1 || targetIdx === -1) return null;\n\n // `position` is order-based, so it needs no direction awareness. The\n // midpoint test does: moving toward a *later* column means moving right in\n // LTR and left under `dir=\"rtl\"`, so the comparison flips.\n const rtl = isRTL(this.host as unknown as Element);\n let position: 'before' | 'after';\n if (sourceIdx < targetIdx) {\n // Toward a later column — swap once the cursor crosses the target's centre.\n if (rtl ? clientX > midpoint : clientX < midpoint) return null;\n position = 'after';\n } else {\n // Toward an earlier column — swap once the cursor crosses back over it.\n if (rtl ? clientX < midpoint : clientX > midpoint) return null;\n position = 'before';\n }\n return { source, target: target.column, position } as const;\n }\n\n /**\n * Snapshots the bounding rect of every header + body cell before a\n * swap. Used as the \"First\" step of a FLIP — after `moveColumn` resolves,\n * `playFlip` computes the delta against the new rect and animates each\n * element from its old position back to identity.\n */\n #captureCellRects(): FlipEntry[] {\n const entries: FlipEntry[] = [];\n const headerRow = this.headerRow;\n if (headerRow?.headers) {\n for (const header of headerRow.headers) {\n entries.push(captureRect(header));\n }\n }\n for (const row of this.host.rows) {\n for (const cell of row.cells) {\n entries.push(captureRect(cell as unknown as HTMLElement));\n }\n }\n return entries;\n }\n}\n"]}
@@ -8,9 +8,24 @@ export declare class ResizeController<T extends object> implements ReactiveContr
8
8
  indicatorActive: boolean;
9
9
  indicatorOffset: number;
10
10
  /**
11
- * Begins resizing a column by showing and positioning the resize indicator in relation to the column.
11
+ * Indicator offset for the edge being dragged when `header` is `width`
12
+ * pixels wide. That is the inline-end edge: the right one in LTR, the left
13
+ * one under `dir="rtl"`, where the fixed inline-start edge is the right one.
12
14
  *
13
- * @param header the
15
+ * Measured in client coordinates against the indicator's origin, the grid's
16
+ * padding box at scroll 0 (`left: 0`, moved with a physical `translateX`).
17
+ * A header offset would count from the far left of the header row, which
18
+ * under RTL with horizontal overflow lies outside the grid.
19
+ *
20
+ * @param header the header being resized
21
+ * @param width the column width to place the edge for, its current width by default
22
+ * @param rtl whether the header lays out right to left
23
+ */
24
+ edge(header: ApexGridHeader<T>, width?: number, rtl?: boolean): number;
25
+ /**
26
+ * Begins resizing a column by showing the resize indicator on the dragged edge of its header.
27
+ *
28
+ * @param header the header being resized
14
29
  */
15
30
  start(header: ApexGridHeader<T>): void;
16
31
  /**