@toolbox-web/grid 1.24.1 → 1.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (422) hide show
  1. package/all.d.ts +0 -1
  2. package/all.js +2 -2
  3. package/all.js.map +1 -1
  4. package/index.d.ts +0 -1
  5. package/index.js +1 -1
  6. package/index.js.map +1 -1
  7. package/lib/core/constants.d.ts +0 -1
  8. package/lib/core/grid.d.ts +145 -33
  9. package/lib/core/internal/aggregators.d.ts +0 -1
  10. package/lib/core/internal/aria.d.ts +8 -1
  11. package/lib/core/internal/columns.d.ts +3 -4
  12. package/lib/core/internal/config-manager.d.ts +2 -54
  13. package/lib/core/internal/dom-builder.d.ts +0 -1
  14. package/lib/core/internal/event-delegation.d.ts +3 -4
  15. package/lib/core/internal/feature-hook.d.ts +0 -1
  16. package/lib/core/internal/focus-manager.d.ts +49 -0
  17. package/lib/core/internal/header.d.ts +2 -3
  18. package/lib/core/internal/idle-scheduler.d.ts +0 -1
  19. package/lib/core/internal/inference.d.ts +0 -1
  20. package/lib/core/internal/keyboard.d.ts +3 -4
  21. package/lib/core/internal/loading.d.ts +0 -1
  22. package/lib/core/internal/render-scheduler.d.ts +3 -66
  23. package/lib/core/internal/resize.d.ts +2 -3
  24. package/lib/core/internal/row-animation.d.ts +0 -1
  25. package/lib/core/internal/row-manager.d.ts +31 -0
  26. package/lib/core/internal/rows.d.ts +4 -5
  27. package/lib/core/internal/sanitize.d.ts +0 -1
  28. package/lib/core/internal/shell.d.ts +7 -25
  29. package/lib/core/internal/sorting.d.ts +3 -4
  30. package/lib/core/internal/style-injector.d.ts +0 -1
  31. package/lib/core/internal/touch-scroll.d.ts +31 -12
  32. package/lib/core/internal/utils.d.ts +8 -1
  33. package/lib/core/internal/validate-config.d.ts +4 -5
  34. package/lib/core/internal/virtualization-manager.d.ts +48 -0
  35. package/lib/core/internal/virtualization.d.ts +0 -1
  36. package/lib/core/plugin/base-plugin.d.ts +2 -3
  37. package/lib/core/plugin/expander-column.d.ts +0 -1
  38. package/lib/core/plugin/index.d.ts +0 -1
  39. package/lib/core/plugin/plugin-manager.d.ts +2 -1
  40. package/lib/core/plugin/types.d.ts +7 -2
  41. package/lib/core/styles/index.d.ts +0 -1
  42. package/lib/core/types.d.ts +364 -54
  43. package/lib/features/clipboard.d.ts +0 -1
  44. package/lib/features/column-virtualization.d.ts +0 -1
  45. package/lib/features/context-menu.d.ts +0 -1
  46. package/lib/features/editing.d.ts +0 -1
  47. package/lib/features/export.d.ts +0 -1
  48. package/lib/features/filtering.d.ts +0 -1
  49. package/lib/features/grouping-columns.d.ts +0 -1
  50. package/lib/features/grouping-rows.d.ts +0 -1
  51. package/lib/features/master-detail.d.ts +0 -1
  52. package/lib/features/multi-sort.d.ts +1 -2
  53. package/lib/features/multi-sort.js.map +1 -1
  54. package/lib/features/pinned-columns.d.ts +0 -1
  55. package/lib/features/pinned-rows.d.ts +0 -1
  56. package/lib/features/pivot.d.ts +0 -1
  57. package/lib/features/print.d.ts +0 -1
  58. package/lib/features/registry.d.ts +0 -1
  59. package/lib/features/reorder-columns.d.ts +1 -2
  60. package/lib/features/reorder-columns.js.map +1 -1
  61. package/lib/features/reorder-rows.d.ts +1 -2
  62. package/lib/features/reorder-rows.js.map +1 -1
  63. package/lib/features/responsive.d.ts +0 -1
  64. package/lib/features/selection.d.ts +0 -1
  65. package/lib/features/server-side.d.ts +0 -1
  66. package/lib/features/tree.d.ts +0 -1
  67. package/lib/features/undo-redo.d.ts +0 -1
  68. package/lib/features/visibility.d.ts +0 -1
  69. package/lib/plugins/clipboard/ClipboardPlugin.d.ts +0 -1
  70. package/lib/plugins/clipboard/copy.d.ts +0 -1
  71. package/lib/plugins/clipboard/index.d.ts +0 -1
  72. package/lib/plugins/clipboard/index.js +1 -1
  73. package/lib/plugins/clipboard/index.js.map +1 -1
  74. package/lib/plugins/clipboard/paste.d.ts +0 -1
  75. package/lib/plugins/clipboard/types.d.ts +6 -1
  76. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +0 -1
  77. package/lib/plugins/column-virtualization/column-virtualization.d.ts +0 -1
  78. package/lib/plugins/column-virtualization/index.d.ts +0 -1
  79. package/lib/plugins/column-virtualization/index.js +1 -1
  80. package/lib/plugins/column-virtualization/index.js.map +1 -1
  81. package/lib/plugins/column-virtualization/types.d.ts +0 -1
  82. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +16 -1
  83. package/lib/plugins/context-menu/index.d.ts +1 -2
  84. package/lib/plugins/context-menu/index.js +1 -1
  85. package/lib/plugins/context-menu/index.js.map +1 -1
  86. package/lib/plugins/context-menu/menu.d.ts +14 -1
  87. package/lib/plugins/context-menu/types.d.ts +13 -3
  88. package/lib/plugins/editing/EditingPlugin.d.ts +4 -6
  89. package/lib/plugins/editing/editors.d.ts +0 -1
  90. package/lib/plugins/editing/index.d.ts +0 -1
  91. package/lib/plugins/editing/index.js +1 -1
  92. package/lib/plugins/editing/index.js.map +1 -1
  93. package/lib/plugins/editing/internal/cell-validation.d.ts +0 -1
  94. package/lib/plugins/editing/internal/dirty-tracking-manager.d.ts +0 -1
  95. package/lib/plugins/editing/internal/dirty-tracking.d.ts +2 -2
  96. package/lib/plugins/editing/internal/editor-injection.d.ts +3 -4
  97. package/lib/plugins/editing/internal/helpers.d.ts +0 -1
  98. package/lib/plugins/editing/types.d.ts +15 -14
  99. package/lib/plugins/export/ExportPlugin.d.ts +0 -1
  100. package/lib/plugins/export/csv.d.ts +0 -1
  101. package/lib/plugins/export/excel.d.ts +0 -1
  102. package/lib/plugins/export/index.d.ts +0 -1
  103. package/lib/plugins/export/index.js +1 -1
  104. package/lib/plugins/export/index.js.map +1 -1
  105. package/lib/plugins/export/types.d.ts +4 -1
  106. package/lib/plugins/filtering/FilteringPlugin.d.ts +0 -1
  107. package/lib/plugins/filtering/filter-model.d.ts +0 -1
  108. package/lib/plugins/filtering/filter-panel-date.d.ts +0 -1
  109. package/lib/plugins/filtering/filter-panel-default.d.ts +0 -1
  110. package/lib/plugins/filtering/filter-panel-number.d.ts +0 -1
  111. package/lib/plugins/filtering/index.d.ts +0 -1
  112. package/lib/plugins/filtering/index.js +1 -1
  113. package/lib/plugins/filtering/index.js.map +1 -1
  114. package/lib/plugins/filtering/types.d.ts +4 -1
  115. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +0 -1
  116. package/lib/plugins/grouping-columns/grouping-columns.d.ts +2 -3
  117. package/lib/plugins/grouping-columns/index.d.ts +1 -2
  118. package/lib/plugins/grouping-columns/index.js +1 -1
  119. package/lib/plugins/grouping-columns/index.js.map +1 -1
  120. package/lib/plugins/grouping-columns/types.d.ts +33 -7
  121. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +0 -1
  122. package/lib/plugins/grouping-rows/grouping-rows.d.ts +0 -1
  123. package/lib/plugins/grouping-rows/index.d.ts +0 -1
  124. package/lib/plugins/grouping-rows/index.js +1 -1
  125. package/lib/plugins/grouping-rows/index.js.map +1 -1
  126. package/lib/plugins/grouping-rows/types.d.ts +4 -1
  127. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +0 -1
  128. package/lib/plugins/master-detail/index.d.ts +0 -1
  129. package/lib/plugins/master-detail/index.js +1 -1
  130. package/lib/plugins/master-detail/index.js.map +1 -1
  131. package/lib/plugins/master-detail/master-detail.d.ts +0 -1
  132. package/lib/plugins/master-detail/types.d.ts +4 -1
  133. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts +3 -3
  134. package/lib/plugins/multi-sort/index.d.ts +1 -2
  135. package/lib/plugins/multi-sort/index.js +1 -1
  136. package/lib/plugins/multi-sort/index.js.map +1 -1
  137. package/lib/plugins/multi-sort/multi-sort.d.ts +0 -1
  138. package/lib/plugins/multi-sort/types.d.ts +5 -1
  139. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +0 -1
  140. package/lib/plugins/pinned-columns/index.d.ts +0 -1
  141. package/lib/plugins/pinned-columns/index.js +1 -1
  142. package/lib/plugins/pinned-columns/index.js.map +1 -1
  143. package/lib/plugins/pinned-columns/pinned-columns.d.ts +0 -1
  144. package/lib/plugins/pinned-columns/types.d.ts +0 -1
  145. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +0 -1
  146. package/lib/plugins/pinned-rows/index.d.ts +0 -1
  147. package/lib/plugins/pinned-rows/index.js +1 -1
  148. package/lib/plugins/pinned-rows/index.js.map +1 -1
  149. package/lib/plugins/pinned-rows/pinned-rows.d.ts +0 -1
  150. package/lib/plugins/pinned-rows/types.d.ts +0 -1
  151. package/lib/plugins/pivot/PivotPlugin.d.ts +0 -1
  152. package/lib/plugins/pivot/index.d.ts +0 -1
  153. package/lib/plugins/pivot/index.js +1 -1
  154. package/lib/plugins/pivot/index.js.map +1 -1
  155. package/lib/plugins/pivot/pivot-engine.d.ts +0 -1
  156. package/lib/plugins/pivot/pivot-model.d.ts +0 -1
  157. package/lib/plugins/pivot/pivot-panel.d.ts +0 -1
  158. package/lib/plugins/pivot/pivot-rows.d.ts +0 -1
  159. package/lib/plugins/pivot/types.d.ts +0 -1
  160. package/lib/plugins/print/PrintPlugin.d.ts +0 -1
  161. package/lib/plugins/print/index.d.ts +0 -1
  162. package/lib/plugins/print/index.js +1 -1
  163. package/lib/plugins/print/index.js.map +1 -1
  164. package/lib/plugins/print/print-isolated.d.ts +0 -1
  165. package/lib/plugins/print/types.d.ts +6 -1
  166. package/lib/plugins/reorder-columns/ReorderPlugin.d.ts +5 -5
  167. package/lib/plugins/reorder-columns/column-drag.d.ts +3 -2
  168. package/lib/plugins/reorder-columns/index.d.ts +0 -1
  169. package/lib/plugins/reorder-columns/index.js +1 -1
  170. package/lib/plugins/reorder-columns/index.js.map +1 -1
  171. package/lib/plugins/reorder-columns/types.d.ts +4 -1
  172. package/lib/plugins/reorder-rows/RowReorderPlugin.d.ts +3 -3
  173. package/lib/plugins/reorder-rows/index.d.ts +0 -1
  174. package/lib/plugins/reorder-rows/index.js +1 -1
  175. package/lib/plugins/reorder-rows/index.js.map +1 -1
  176. package/lib/plugins/reorder-rows/types.d.ts +4 -1
  177. package/lib/plugins/responsive/ResponsivePlugin.d.ts +0 -1
  178. package/lib/plugins/responsive/index.d.ts +0 -1
  179. package/lib/plugins/responsive/index.js +1 -1
  180. package/lib/plugins/responsive/index.js.map +1 -1
  181. package/lib/plugins/responsive/types.d.ts +4 -1
  182. package/lib/plugins/selection/SelectionPlugin.d.ts +1 -3
  183. package/lib/plugins/selection/index.d.ts +0 -1
  184. package/lib/plugins/selection/index.js +1 -1
  185. package/lib/plugins/selection/index.js.map +1 -1
  186. package/lib/plugins/selection/range-selection.d.ts +0 -1
  187. package/lib/plugins/selection/row-selection.d.ts +0 -1
  188. package/lib/plugins/selection/types.d.ts +4 -1
  189. package/lib/plugins/server-side/ServerSidePlugin.d.ts +0 -1
  190. package/lib/plugins/server-side/cache.d.ts +0 -1
  191. package/lib/plugins/server-side/datasource.d.ts +0 -1
  192. package/lib/plugins/server-side/index.d.ts +0 -1
  193. package/lib/plugins/server-side/index.js +1 -1
  194. package/lib/plugins/server-side/index.js.map +1 -1
  195. package/lib/plugins/server-side/types.d.ts +0 -1
  196. package/lib/plugins/shared/data-collection.d.ts +0 -1
  197. package/lib/plugins/tree/TreePlugin.d.ts +0 -1
  198. package/lib/plugins/tree/index.d.ts +0 -1
  199. package/lib/plugins/tree/index.js +1 -1
  200. package/lib/plugins/tree/index.js.map +1 -1
  201. package/lib/plugins/tree/tree-data.d.ts +0 -1
  202. package/lib/plugins/tree/tree-detect.d.ts +0 -1
  203. package/lib/plugins/tree/types.d.ts +4 -1
  204. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +1 -2
  205. package/lib/plugins/undo-redo/history.d.ts +0 -1
  206. package/lib/plugins/undo-redo/index.d.ts +0 -1
  207. package/lib/plugins/undo-redo/index.js +1 -1
  208. package/lib/plugins/undo-redo/index.js.map +1 -1
  209. package/lib/plugins/undo-redo/types.d.ts +6 -1
  210. package/lib/plugins/visibility/VisibilityPlugin.d.ts +0 -1
  211. package/lib/plugins/visibility/index.d.ts +0 -1
  212. package/lib/plugins/visibility/index.js +1 -1
  213. package/lib/plugins/visibility/index.js.map +1 -1
  214. package/lib/plugins/visibility/types.d.ts +0 -1
  215. package/lib/plugins/visibility/visibility.d.ts +0 -1
  216. package/package.json +1 -1
  217. package/public.d.ts +31 -12
  218. package/umd/grid.all.umd.js +1 -1
  219. package/umd/grid.all.umd.js.map +1 -1
  220. package/umd/grid.umd.js +1 -1
  221. package/umd/grid.umd.js.map +1 -1
  222. package/umd/plugins/clipboard.umd.js +1 -1
  223. package/umd/plugins/clipboard.umd.js.map +1 -1
  224. package/umd/plugins/column-virtualization.umd.js +1 -1
  225. package/umd/plugins/column-virtualization.umd.js.map +1 -1
  226. package/umd/plugins/context-menu.umd.js +1 -1
  227. package/umd/plugins/context-menu.umd.js.map +1 -1
  228. package/umd/plugins/editing.umd.js +1 -1
  229. package/umd/plugins/editing.umd.js.map +1 -1
  230. package/umd/plugins/filtering.umd.js +1 -1
  231. package/umd/plugins/filtering.umd.js.map +1 -1
  232. package/umd/plugins/grouping-columns.umd.js +1 -1
  233. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  234. package/umd/plugins/master-detail.umd.js +1 -1
  235. package/umd/plugins/master-detail.umd.js.map +1 -1
  236. package/umd/plugins/multi-sort.umd.js +1 -1
  237. package/umd/plugins/multi-sort.umd.js.map +1 -1
  238. package/umd/plugins/pinned-columns.umd.js +1 -1
  239. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  240. package/umd/plugins/pinned-rows.umd.js +1 -1
  241. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  242. package/umd/plugins/print.umd.js +1 -1
  243. package/umd/plugins/print.umd.js.map +1 -1
  244. package/umd/plugins/reorder-columns.umd.js +1 -1
  245. package/umd/plugins/reorder-columns.umd.js.map +1 -1
  246. package/umd/plugins/reorder-rows.umd.js +1 -1
  247. package/umd/plugins/reorder-rows.umd.js.map +1 -1
  248. package/umd/plugins/responsive.umd.js +1 -1
  249. package/umd/plugins/responsive.umd.js.map +1 -1
  250. package/umd/plugins/selection.umd.js +1 -1
  251. package/umd/plugins/selection.umd.js.map +1 -1
  252. package/umd/plugins/server-side.umd.js.map +1 -1
  253. package/umd/plugins/tree.umd.js +1 -1
  254. package/umd/plugins/tree.umd.js.map +1 -1
  255. package/umd/plugins/undo-redo.umd.js.map +1 -1
  256. package/umd/plugins/visibility.umd.js +1 -1
  257. package/umd/plugins/visibility.umd.js.map +1 -1
  258. package/all.d.ts.map +0 -1
  259. package/index.d.ts.map +0 -1
  260. package/lib/core/constants.d.ts.map +0 -1
  261. package/lib/core/grid.d.ts.map +0 -1
  262. package/lib/core/internal/aggregators.d.ts.map +0 -1
  263. package/lib/core/internal/aria.d.ts.map +0 -1
  264. package/lib/core/internal/columns.d.ts.map +0 -1
  265. package/lib/core/internal/config-manager.d.ts.map +0 -1
  266. package/lib/core/internal/dom-builder.d.ts.map +0 -1
  267. package/lib/core/internal/event-delegation.d.ts.map +0 -1
  268. package/lib/core/internal/feature-hook.d.ts.map +0 -1
  269. package/lib/core/internal/header.d.ts.map +0 -1
  270. package/lib/core/internal/idle-scheduler.d.ts.map +0 -1
  271. package/lib/core/internal/inference.d.ts.map +0 -1
  272. package/lib/core/internal/keyboard.d.ts.map +0 -1
  273. package/lib/core/internal/loading.d.ts.map +0 -1
  274. package/lib/core/internal/render-scheduler.d.ts.map +0 -1
  275. package/lib/core/internal/resize.d.ts.map +0 -1
  276. package/lib/core/internal/row-animation.d.ts.map +0 -1
  277. package/lib/core/internal/rows.d.ts.map +0 -1
  278. package/lib/core/internal/sanitize.d.ts.map +0 -1
  279. package/lib/core/internal/shell.d.ts.map +0 -1
  280. package/lib/core/internal/sorting.d.ts.map +0 -1
  281. package/lib/core/internal/style-injector.d.ts.map +0 -1
  282. package/lib/core/internal/touch-scroll.d.ts.map +0 -1
  283. package/lib/core/internal/utils.d.ts.map +0 -1
  284. package/lib/core/internal/validate-config.d.ts.map +0 -1
  285. package/lib/core/internal/virtualization.d.ts.map +0 -1
  286. package/lib/core/plugin/base-plugin.d.ts.map +0 -1
  287. package/lib/core/plugin/expander-column.d.ts.map +0 -1
  288. package/lib/core/plugin/index.d.ts.map +0 -1
  289. package/lib/core/plugin/plugin-manager.d.ts.map +0 -1
  290. package/lib/core/plugin/types.d.ts.map +0 -1
  291. package/lib/core/styles/index.d.ts.map +0 -1
  292. package/lib/core/types.d.ts.map +0 -1
  293. package/lib/features/clipboard.d.ts.map +0 -1
  294. package/lib/features/column-virtualization.d.ts.map +0 -1
  295. package/lib/features/context-menu.d.ts.map +0 -1
  296. package/lib/features/editing.d.ts.map +0 -1
  297. package/lib/features/export.d.ts.map +0 -1
  298. package/lib/features/filtering.d.ts.map +0 -1
  299. package/lib/features/grouping-columns.d.ts.map +0 -1
  300. package/lib/features/grouping-rows.d.ts.map +0 -1
  301. package/lib/features/magic-string.es-CkyDP9Ir.mjs.map +0 -1
  302. package/lib/features/master-detail.d.ts.map +0 -1
  303. package/lib/features/multi-sort.d.ts.map +0 -1
  304. package/lib/features/pinned-columns.d.ts.map +0 -1
  305. package/lib/features/pinned-rows.d.ts.map +0 -1
  306. package/lib/features/pivot.d.ts.map +0 -1
  307. package/lib/features/print.d.ts.map +0 -1
  308. package/lib/features/registry.d.ts.map +0 -1
  309. package/lib/features/registry.spec.js +0 -5
  310. package/lib/features/registry.spec.js.map +0 -1
  311. package/lib/features/reorder-columns.d.ts.map +0 -1
  312. package/lib/features/reorder-rows.d.ts.map +0 -1
  313. package/lib/features/responsive.d.ts.map +0 -1
  314. package/lib/features/selection.d.ts.map +0 -1
  315. package/lib/features/server-side.d.ts.map +0 -1
  316. package/lib/features/tree.d.ts.map +0 -1
  317. package/lib/features/undo-redo.d.ts.map +0 -1
  318. package/lib/features/visibility.d.ts.map +0 -1
  319. package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +0 -1
  320. package/lib/plugins/clipboard/copy.d.ts.map +0 -1
  321. package/lib/plugins/clipboard/index.d.ts.map +0 -1
  322. package/lib/plugins/clipboard/paste.d.ts.map +0 -1
  323. package/lib/plugins/clipboard/types.d.ts.map +0 -1
  324. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +0 -1
  325. package/lib/plugins/column-virtualization/column-virtualization.d.ts.map +0 -1
  326. package/lib/plugins/column-virtualization/index.d.ts.map +0 -1
  327. package/lib/plugins/column-virtualization/types.d.ts.map +0 -1
  328. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +0 -1
  329. package/lib/plugins/context-menu/index.d.ts.map +0 -1
  330. package/lib/plugins/context-menu/menu.d.ts.map +0 -1
  331. package/lib/plugins/context-menu/types.d.ts.map +0 -1
  332. package/lib/plugins/editing/EditingPlugin.d.ts.map +0 -1
  333. package/lib/plugins/editing/editors.d.ts.map +0 -1
  334. package/lib/plugins/editing/index.d.ts.map +0 -1
  335. package/lib/plugins/editing/internal/cell-validation.d.ts.map +0 -1
  336. package/lib/plugins/editing/internal/dirty-tracking-manager.d.ts.map +0 -1
  337. package/lib/plugins/editing/internal/dirty-tracking.d.ts.map +0 -1
  338. package/lib/plugins/editing/internal/editor-injection.d.ts.map +0 -1
  339. package/lib/plugins/editing/internal/helpers.d.ts.map +0 -1
  340. package/lib/plugins/editing/types.d.ts.map +0 -1
  341. package/lib/plugins/export/ExportPlugin.d.ts.map +0 -1
  342. package/lib/plugins/export/csv.d.ts.map +0 -1
  343. package/lib/plugins/export/excel.d.ts.map +0 -1
  344. package/lib/plugins/export/index.d.ts.map +0 -1
  345. package/lib/plugins/export/types.d.ts.map +0 -1
  346. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +0 -1
  347. package/lib/plugins/filtering/filter-model.d.ts.map +0 -1
  348. package/lib/plugins/filtering/filter-panel-date.d.ts.map +0 -1
  349. package/lib/plugins/filtering/filter-panel-default.d.ts.map +0 -1
  350. package/lib/plugins/filtering/filter-panel-number.d.ts.map +0 -1
  351. package/lib/plugins/filtering/index.d.ts.map +0 -1
  352. package/lib/plugins/filtering/types.d.ts.map +0 -1
  353. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +0 -1
  354. package/lib/plugins/grouping-columns/grouping-columns.d.ts.map +0 -1
  355. package/lib/plugins/grouping-columns/index.d.ts.map +0 -1
  356. package/lib/plugins/grouping-columns/types.d.ts.map +0 -1
  357. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +0 -1
  358. package/lib/plugins/grouping-rows/grouping-rows.d.ts.map +0 -1
  359. package/lib/plugins/grouping-rows/index.d.ts.map +0 -1
  360. package/lib/plugins/grouping-rows/types.d.ts.map +0 -1
  361. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +0 -1
  362. package/lib/plugins/master-detail/index.d.ts.map +0 -1
  363. package/lib/plugins/master-detail/master-detail.d.ts.map +0 -1
  364. package/lib/plugins/master-detail/types.d.ts.map +0 -1
  365. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts.map +0 -1
  366. package/lib/plugins/multi-sort/index.d.ts.map +0 -1
  367. package/lib/plugins/multi-sort/multi-sort.d.ts.map +0 -1
  368. package/lib/plugins/multi-sort/types.d.ts.map +0 -1
  369. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +0 -1
  370. package/lib/plugins/pinned-columns/index.d.ts.map +0 -1
  371. package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +0 -1
  372. package/lib/plugins/pinned-columns/types.d.ts.map +0 -1
  373. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +0 -1
  374. package/lib/plugins/pinned-rows/index.d.ts.map +0 -1
  375. package/lib/plugins/pinned-rows/pinned-rows.d.ts.map +0 -1
  376. package/lib/plugins/pinned-rows/types.d.ts.map +0 -1
  377. package/lib/plugins/pivot/PivotPlugin.d.ts.map +0 -1
  378. package/lib/plugins/pivot/index.d.ts.map +0 -1
  379. package/lib/plugins/pivot/pivot-engine.d.ts.map +0 -1
  380. package/lib/plugins/pivot/pivot-model.d.ts.map +0 -1
  381. package/lib/plugins/pivot/pivot-panel.d.ts.map +0 -1
  382. package/lib/plugins/pivot/pivot-rows.d.ts.map +0 -1
  383. package/lib/plugins/pivot/types.d.ts.map +0 -1
  384. package/lib/plugins/print/PrintPlugin.d.ts.map +0 -1
  385. package/lib/plugins/print/index.d.ts.map +0 -1
  386. package/lib/plugins/print/print-isolated.d.ts.map +0 -1
  387. package/lib/plugins/print/types.d.ts.map +0 -1
  388. package/lib/plugins/reorder-columns/ReorderPlugin.d.ts.map +0 -1
  389. package/lib/plugins/reorder-columns/column-drag.d.ts.map +0 -1
  390. package/lib/plugins/reorder-columns/index.d.ts.map +0 -1
  391. package/lib/plugins/reorder-columns/types.d.ts.map +0 -1
  392. package/lib/plugins/reorder-rows/RowReorderPlugin.d.ts.map +0 -1
  393. package/lib/plugins/reorder-rows/index.d.ts.map +0 -1
  394. package/lib/plugins/reorder-rows/types.d.ts.map +0 -1
  395. package/lib/plugins/responsive/ResponsivePlugin.d.ts.map +0 -1
  396. package/lib/plugins/responsive/index.d.ts.map +0 -1
  397. package/lib/plugins/responsive/types.d.ts.map +0 -1
  398. package/lib/plugins/selection/SelectionPlugin.d.ts.map +0 -1
  399. package/lib/plugins/selection/index.d.ts.map +0 -1
  400. package/lib/plugins/selection/range-selection.d.ts.map +0 -1
  401. package/lib/plugins/selection/row-selection.d.ts.map +0 -1
  402. package/lib/plugins/selection/types.d.ts.map +0 -1
  403. package/lib/plugins/server-side/ServerSidePlugin.d.ts.map +0 -1
  404. package/lib/plugins/server-side/cache.d.ts.map +0 -1
  405. package/lib/plugins/server-side/datasource.d.ts.map +0 -1
  406. package/lib/plugins/server-side/index.d.ts.map +0 -1
  407. package/lib/plugins/server-side/types.d.ts.map +0 -1
  408. package/lib/plugins/shared/data-collection.d.ts.map +0 -1
  409. package/lib/plugins/tree/TreePlugin.d.ts.map +0 -1
  410. package/lib/plugins/tree/index.d.ts.map +0 -1
  411. package/lib/plugins/tree/tree-data.d.ts.map +0 -1
  412. package/lib/plugins/tree/tree-detect.d.ts.map +0 -1
  413. package/lib/plugins/tree/types.d.ts.map +0 -1
  414. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +0 -1
  415. package/lib/plugins/undo-redo/history.d.ts.map +0 -1
  416. package/lib/plugins/undo-redo/index.d.ts.map +0 -1
  417. package/lib/plugins/undo-redo/types.d.ts.map +0 -1
  418. package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +0 -1
  419. package/lib/plugins/visibility/index.d.ts.map +0 -1
  420. package/lib/plugins/visibility/types.d.ts.map +0 -1
  421. package/lib/plugins/visibility/visibility.d.ts.map +0 -1
  422. package/public.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"multi-sort.umd.js","sources":["../../../../../libs/grid/src/lib/plugins/multi-sort/multi-sort.ts","../../../../../libs/grid/src/lib/plugins/multi-sort/MultiSortPlugin.ts"],"sourcesContent":["/**\n * Multi-Sort Core Logic\n *\n * Pure functions for multi-column sorting operations.\n */\n\nimport type { ColumnConfig } from '../../core/types';\nimport type { SortModel } from './types';\n\n/**\n * Apply multiple sort columns to a row array.\n * Sorts are applied in order - first sort has highest priority.\n *\n * @param rows - Array of row objects to sort\n * @param sorts - Ordered array of sort configurations\n * @param columns - Column configurations (for custom comparators)\n * @returns New sorted array (does not mutate original)\n */\nexport function applySorts<TRow = unknown>(rows: TRow[], sorts: SortModel[], columns: ColumnConfig<TRow>[]): TRow[] {\n if (!sorts.length) return [...rows];\n\n return [...rows].sort((a, b) => {\n for (const sort of sorts) {\n const col = columns.find((c) => c.field === sort.field);\n const comparator = col?.sortComparator ?? defaultComparator;\n const aVal = (a as Record<string, unknown>)[sort.field];\n const bVal = (b as Record<string, unknown>)[sort.field];\n const result = comparator(aVal, bVal, a, b);\n if (result !== 0) {\n return sort.direction === 'asc' ? result : -result;\n }\n }\n return 0;\n });\n}\n\n/**\n * Default comparator for sorting values.\n * Handles nulls, numbers, dates, and strings.\n *\n * @param a - First value\n * @param b - Second value\n * @returns Comparison result (-1, 0, 1)\n */\nexport function defaultComparator(a: unknown, b: unknown): number {\n // Handle nulls/undefined - push to end\n if (a == null && b == null) return 0;\n if (a == null) return 1;\n if (b == null) return -1;\n\n // Type-aware comparison\n if (typeof a === 'number' && typeof b === 'number') {\n return a - b;\n }\n\n if (a instanceof Date && b instanceof Date) {\n return a.getTime() - b.getTime();\n }\n\n // Boolean comparison\n if (typeof a === 'boolean' && typeof b === 'boolean') {\n return a === b ? 0 : a ? -1 : 1;\n }\n\n // String comparison (fallback)\n return String(a).localeCompare(String(b));\n}\n\n/**\n * Toggle sort state for a field.\n * With shift key: adds/toggles in multi-sort list\n * Without shift key: replaces entire sort with single column\n *\n * @param current - Current sort model\n * @param field - Field to toggle\n * @param shiftKey - Whether shift key is held (multi-sort mode)\n * @param maxColumns - Maximum columns allowed in sort\n * @returns New sort model\n */\nexport function toggleSort(current: SortModel[], field: string, shiftKey: boolean, maxColumns: number): SortModel[] {\n const existing = current.find((s) => s.field === field);\n\n if (shiftKey) {\n // Multi-sort: add/toggle in list\n if (existing) {\n if (existing.direction === 'asc') {\n // Flip to descending\n return current.map((s) => (s.field === field ? { ...s, direction: 'desc' as const } : s));\n } else {\n // Remove from sort\n return current.filter((s) => s.field !== field);\n }\n } else if (current.length < maxColumns) {\n // Add new sort column\n return [...current, { field, direction: 'asc' as const }];\n }\n // Max columns reached, return unchanged\n return current;\n } else {\n // Single sort: replace all\n if (existing?.direction === 'asc') {\n return [{ field, direction: 'desc' }];\n } else if (existing?.direction === 'desc') {\n return [];\n }\n return [{ field, direction: 'asc' }];\n }\n}\n\n/**\n * Get the sort index (1-based) for a field in the sort model.\n * Returns undefined if the field is not in the sort model.\n *\n * @param sortModel - Current sort model\n * @param field - Field to check\n * @returns 1-based index or undefined\n */\nexport function getSortIndex(sortModel: SortModel[], field: string): number | undefined {\n const index = sortModel.findIndex((s) => s.field === field);\n return index >= 0 ? index + 1 : undefined;\n}\n\n/**\n * Get the sort direction for a field in the sort model.\n *\n * @param sortModel - Current sort model\n * @param field - Field to check\n * @returns Sort direction or undefined if not sorted\n */\nexport function getSortDirection(sortModel: SortModel[], field: string): 'asc' | 'desc' | undefined {\n return sortModel.find((s) => s.field === field)?.direction;\n}\n","/**\n * Multi-Sort Plugin (Class-based)\n *\n * Provides multi-column sorting capabilities for tbw-grid.\n * Supports shift+click for adding secondary sort columns.\n */\n\nimport { BaseGridPlugin, HeaderClickEvent } from '../../core/plugin/base-plugin';\nimport type { ColumnState } from '../../core/types';\nimport { applySorts, getSortDirection, getSortIndex, toggleSort } from './multi-sort';\nimport styles from './multi-sort.css?inline';\nimport type { MultiSortConfig, SortModel } from './types';\n\n/**\n * Multi-Sort Plugin for tbw-grid\n *\n * Enables sorting by multiple columns at once—hold Shift and click additional column\n * headers to build up a sort stack. Priority badges show the sort order, so users\n * always know which column takes precedence.\n *\n * ## Installation\n *\n * ```ts\n * import { MultiSortPlugin } from '@toolbox-web/grid/plugins/multi-sort';\n * ```\n *\n * ## Configuration Options\n *\n * | Option | Type | Default | Description |\n * |--------|------|---------|-------------|\n * | `maxSortColumns` | `number` | `3` | Maximum columns to sort by |\n * | `showSortIndex` | `boolean` | `true` | Show sort priority badges |\n * | `initialSort` | `SortModel[]` | - | Pre-configured sort order on load |\n *\n * ## Keyboard Shortcuts\n *\n * | Shortcut | Action |\n * |----------|--------|\n * | `Click header` | Sort by column (clears other sorts) |\n * | `Shift + Click` | Add column to multi-sort stack |\n * | `Ctrl + Click` | Toggle sort direction |\n *\n * ## Events\n *\n * | Event | Detail | Description |\n * |-------|--------|-------------|\n * | `sort-change` | `{ sortModel: SortModel[] }` | Fired when sort changes |\n *\n * ## Programmatic API\n *\n * | Method | Signature | Description |\n * |--------|-----------|-------------|\n * | `setSort` | `(sortModel: SortModel[]) => void` | Set sort programmatically |\n * | `getSortModel` | `() => SortModel[]` | Get current sort model |\n * | `clearSort` | `() => void` | Clear all sorting |\n * | `addSort` | `(field, direction) => void` | Add a column to sort |\n * | `removeSort` | `(field) => void` | Remove a column from sort |\n *\n * @example Basic Multi-Column Sorting\n * ```ts\n * import '@toolbox-web/grid';\n * import { MultiSortPlugin } from '@toolbox-web/grid/plugins/multi-sort';\n *\n * const grid = document.querySelector('tbw-grid');\n * grid.gridConfig = {\n * columns: [\n * { field: 'name', header: 'Name', sortable: true },\n * { field: 'department', header: 'Department', sortable: true },\n * { field: 'salary', header: 'Salary', type: 'number', sortable: true },\n * ],\n * plugins: [new MultiSortPlugin({ maxSortColumns: 3, showSortIndex: true })],\n * };\n *\n * grid.addEventListener('sort-change', (e) => {\n * console.log('Active sorts:', e.detail.sortModel);\n * });\n * ```\n *\n * @example Initial Sort Configuration\n * ```ts\n * new MultiSortPlugin({\n * initialSort: [\n * { field: 'department', direction: 'asc' },\n * { field: 'salary', direction: 'desc' },\n * ],\n * })\n * ```\n *\n * @see {@link MultiSortConfig} for all configuration options\n * @see {@link SortModel} for the sort model structure\n *\n * @internal Extends BaseGridPlugin\n */\nexport class MultiSortPlugin extends BaseGridPlugin<MultiSortConfig> {\n /** @internal */\n readonly name = 'multiSort';\n /** @internal */\n override readonly styles = styles;\n\n /** @internal */\n protected override get defaultConfig(): Partial<MultiSortConfig> {\n return {\n maxSortColumns: 3,\n showSortIndex: true,\n };\n }\n\n // #region Internal State\n private sortModel: SortModel[] = [];\n /** Cached sort result — returned as-is while a row edit is active to prevent\n * the edited row from jumping to a new sorted position mid-edit. Row data\n * mutations are still visible because the array holds shared object refs. */\n private cachedSortResult: unknown[] | null = null;\n\n /**\n * Clear the core `_sortState` so that only this plugin's `processRows`\n * sorting applies. `ConfigManager.applyState()` always sets the core sort\n * state when restoring from storage, even when a plugin handles sorting.\n * Without this, the stale core state leaks into `collectState()` and\n * `reapplyCoreSort()` after the plugin clears its own model.\n */\n private clearCoreSortState(): void {\n const el = this.gridElement as unknown as { _sortState: unknown };\n if (el) el._sortState = null;\n }\n // #endregion\n\n // #region Lifecycle\n\n /** @internal */\n override detach(): void {\n this.sortModel = [];\n this.cachedSortResult = null;\n }\n // #endregion\n\n // #region Hooks\n\n /** @internal */\n override processRows(rows: readonly unknown[]): unknown[] {\n if (this.sortModel.length === 0) {\n this.cachedSortResult = null;\n return [...rows];\n }\n\n // Freeze sort order while a row is actively being edited (row mode only).\n // Re-sorting mid-edit would move the edited row to a new index while the\n // editors remain at the old position, causing data/UI mismatch.\n // In grid mode (_isGridEditMode) sorting is safe — afterCellRender\n // re-injects editors into the re-sorted cells.\n // We return the cached previous sort result (same object references, so\n // in-place value mutations are already visible) instead of unsorted input.\n const el = this.gridElement as unknown as Record<string, unknown> | undefined;\n if (el && !el._isGridEditMode && typeof el._activeEditRows === 'number' && el._activeEditRows !== -1) {\n if (this.cachedSortResult && this.cachedSortResult.length === rows.length) {\n return [...this.cachedSortResult];\n }\n }\n\n const sorted = applySorts([...rows], this.sortModel, [...this.columns]);\n this.cachedSortResult = sorted;\n return sorted;\n }\n\n /** @internal */\n override onHeaderClick(event: HeaderClickEvent): boolean {\n const column = this.columns.find((c) => c.field === event.field);\n if (!column?.sortable) return false;\n\n const shiftKey = event.originalEvent.shiftKey;\n const maxColumns = this.config.maxSortColumns ?? 3;\n\n this.sortModel = toggleSort(this.sortModel, event.field, shiftKey, maxColumns);\n this.clearCoreSortState();\n\n this.emit('sort-change', { sortModel: [...this.sortModel] });\n this.requestRender();\n this.grid?.requestStateChange?.();\n\n return true;\n }\n\n /** @internal */\n override afterRender(): void {\n const gridEl = this.gridElement;\n if (!gridEl) return;\n\n const showIndex = this.config.showSortIndex !== false;\n\n // Update all sortable header cells with sort indicators\n const headerCells = gridEl.querySelectorAll('.header-row .cell[data-field]');\n headerCells.forEach((cell) => {\n const field = cell.getAttribute('data-field');\n if (!field) return;\n\n const sortIndex = getSortIndex(this.sortModel, field);\n const sortDir = getSortDirection(this.sortModel, field);\n\n // Remove existing sort index badge (always clean up)\n const existingBadge = cell.querySelector('.sort-index');\n existingBadge?.remove();\n\n if (sortDir) {\n // Column is sorted - remove base indicator and add our own\n const existingIndicator = cell.querySelector('[part~=\"sort-indicator\"], .sort-indicator');\n existingIndicator?.remove();\n\n cell.setAttribute('data-sort', sortDir);\n\n // Add sort arrow indicator - insert BEFORE filter button and resize handle\n // to maintain consistent order: [label, sort-indicator, sort-index, filter-btn, resize-handle]\n const indicator = document.createElement('span');\n indicator.className = 'sort-indicator';\n // Use grid-level icons (fall back to defaults)\n this.setIcon(indicator, this.resolveIcon(sortDir === 'asc' ? 'sortAsc' : 'sortDesc'));\n\n // Find insertion point: before filter button or resize handle\n const filterBtn = cell.querySelector('.tbw-filter-btn');\n const resizeHandle = cell.querySelector('.resize-handle');\n const insertBefore = filterBtn ?? resizeHandle;\n if (insertBefore) {\n cell.insertBefore(indicator, insertBefore);\n } else {\n cell.appendChild(indicator);\n }\n\n // Add sort index badge if multiple columns sorted and showSortIndex is enabled\n if (showIndex && this.sortModel.length > 1 && sortIndex !== undefined) {\n const badge = document.createElement('span');\n badge.className = 'sort-index';\n badge.textContent = String(sortIndex);\n // Insert badge right after the indicator\n if (indicator.nextSibling) {\n cell.insertBefore(badge, indicator.nextSibling);\n } else {\n cell.appendChild(badge);\n }\n }\n } else {\n cell.removeAttribute('data-sort');\n // Remove any stale sort indicators left by a previous afterRender cycle\n // Base indicators use part=\"sort-indicator\", plugin indicators use class=\"sort-indicator\"\n const staleIndicator = cell.querySelector('[part~=\"sort-indicator\"], .sort-indicator');\n staleIndicator?.remove();\n }\n });\n }\n // #endregion\n\n // #region Public API\n\n /**\n * Get the current sort model.\n * @returns Copy of the current sort model\n */\n getSortModel(): SortModel[] {\n return [...this.sortModel];\n }\n\n /**\n * Set the sort model programmatically.\n * @param model - New sort model to apply\n */\n setSortModel(model: SortModel[]): void {\n this.sortModel = [...model];\n this.clearCoreSortState();\n this.emit('sort-change', { sortModel: [...model] });\n this.requestRender();\n this.grid?.requestStateChange?.();\n }\n\n /**\n * Clear all sorting.\n */\n clearSort(): void {\n this.sortModel = [];\n this.clearCoreSortState();\n this.emit('sort-change', { sortModel: [] });\n this.requestRender();\n this.grid?.requestStateChange?.();\n }\n\n /**\n * Get the sort index (1-based) for a specific field.\n * @param field - Field to check\n * @returns 1-based index or undefined if not sorted\n */\n getSortIndex(field: string): number | undefined {\n return getSortIndex(this.sortModel, field);\n }\n\n /**\n * Get the sort direction for a specific field.\n * @param field - Field to check\n * @returns Sort direction or undefined if not sorted\n */\n getSortDirection(field: string): 'asc' | 'desc' | undefined {\n return getSortDirection(this.sortModel, field);\n }\n // #endregion\n\n // #region Column State Hooks\n\n /**\n * Return sort state for a column if it's in the sort model.\n * @internal\n */\n override getColumnState(field: string): Partial<ColumnState> | undefined {\n const index = this.sortModel.findIndex((s) => s.field === field);\n if (index === -1) return undefined;\n\n const sortEntry = this.sortModel[index];\n return {\n sort: {\n direction: sortEntry.direction,\n priority: index,\n },\n };\n }\n\n /**\n * Apply sort state from column state.\n * Rebuilds the sort model from all column states.\n * @internal\n */\n override applyColumnState(field: string, state: ColumnState): void {\n // Only process if the column has sort state\n if (!state.sort) {\n // Remove this field from sortModel if it exists\n this.sortModel = this.sortModel.filter((s) => s.field !== field);\n return;\n }\n\n // Find existing entry or add new one\n const existingIndex = this.sortModel.findIndex((s) => s.field === field);\n const newEntry: SortModel = {\n field,\n direction: state.sort.direction,\n };\n\n if (existingIndex !== -1) {\n // Update existing entry\n this.sortModel[existingIndex] = newEntry;\n } else {\n // Add at the correct priority position\n this.sortModel.splice(state.sort.priority, 0, newEntry);\n }\n\n // Clear core sort state — this plugin exclusively handles sorting via\n // processRows. The core _sortState is set by ConfigManager.applyState()\n // before plugins run; null it so reapplyCoreSort() is a no-op.\n this.clearCoreSortState();\n }\n // #endregion\n}\n"],"names":["defaultComparator","a","b","Date","getTime","String","localeCompare","getSortIndex","sortModel","field","index","findIndex","s","getSortDirection","find","direction","MultiSortPlugin","BaseGridPlugin","name","styles","defaultConfig","maxSortColumns","showSortIndex","cachedSortResult","clearCoreSortState","el","this","gridElement","_sortState","detach","processRows","rows","length","_isGridEditMode","_activeEditRows","sorted","sorts","columns","sort","col","c","result","sortComparator","applySorts","onHeaderClick","event","column","sortable","shiftKey","originalEvent","maxColumns","config","current","existing","map","filter","toggleSort","emit","requestRender","grid","requestStateChange","afterRender","gridEl","showIndex","querySelectorAll","forEach","cell","getAttribute","sortIndex","sortDir","existingBadge","querySelector","remove","existingIndicator","setAttribute","indicator","document","createElement","className","setIcon","resolveIcon","filterBtn","resizeHandle","insertBefore","appendChild","badge","textContent","nextSibling","removeAttribute","staleIndicator","getSortModel","setSortModel","model","clearSort","getColumnState","priority","applyColumnState","state","existingIndex","newEntry","splice"],"mappings":"mVA4CO,SAASA,EAAkBC,EAAYC,GAE5C,OAAS,MAALD,GAAkB,MAALC,EAAkB,EAC1B,MAALD,EAAkB,EACb,MAALC,GAAkB,EAGL,iBAAND,GAA+B,iBAANC,EAC3BD,EAAIC,EAGTD,aAAaE,MAAQD,aAAaC,KAC7BF,EAAEG,UAAYF,EAAEE,UAIR,kBAANH,GAAgC,kBAANC,EAC5BD,IAAMC,EAAI,EAAID,GAAI,EAAK,EAIzBI,OAAOJ,GAAGK,cAAcD,OAAOH,GACxC,CAmDO,SAASK,EAAaC,EAAwBC,GACnD,MAAMC,EAAQF,EAAUG,UAAWC,GAAMA,EAAEH,QAAUA,GACrD,OAAOC,GAAS,EAAIA,EAAQ,OAAI,CAClC,CASO,SAASG,EAAiBL,EAAwBC,GACvD,OAAOD,EAAUM,KAAMF,GAAMA,EAAEH,QAAUA,IAAQM,SACnD,CCtCO,MAAMC,UAAwBC,EAAAA,eAE1BC,KAAO,YAEEC,isBAGlB,iBAAuBC,GACrB,MAAO,CACLC,eAAgB,EAChBC,eAAe,EAEnB,CAGQd,UAAyB,GAIzBe,iBAAqC,KASrC,kBAAAC,GACN,MAAMC,EAAKC,KAAKC,YACZF,MAAOG,WAAa,KAC1B,CAMS,MAAAC,GACPH,KAAKlB,UAAY,GACjBkB,KAAKH,iBAAmB,IAC1B,CAMS,WAA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AKvB,YAGF,IAAlBmF,EAEFxE,KAAKlB,UAAU0F,GAAiBC,EAGhCzE,KAAKlB,UAAU4F,OAAOH,EAAM3D,KAAKyD,SAAU,EAAGI,GAMhDzE,KAAKF,oBACP"}
1
+ {"version":3,"file":"multi-sort.umd.js","sources":["../../../../../libs/grid/src/lib/plugins/multi-sort/multi-sort.ts","../../../../../libs/grid/src/lib/plugins/multi-sort/MultiSortPlugin.ts"],"sourcesContent":["/**\n * Multi-Sort Core Logic\n *\n * Pure functions for multi-column sorting operations.\n */\n\nimport type { ColumnConfig } from '../../core/types';\nimport type { SortModel } from './types';\n\n/**\n * Apply multiple sort columns to a row array.\n * Sorts are applied in order - first sort has highest priority.\n *\n * @param rows - Array of row objects to sort\n * @param sorts - Ordered array of sort configurations\n * @param columns - Column configurations (for custom comparators)\n * @returns New sorted array (does not mutate original)\n */\nexport function applySorts<TRow = unknown>(rows: TRow[], sorts: SortModel[], columns: ColumnConfig<TRow>[]): TRow[] {\n if (!sorts.length) return [...rows];\n\n return [...rows].sort((a, b) => {\n for (const sort of sorts) {\n const col = columns.find((c) => c.field === sort.field);\n const comparator = col?.sortComparator ?? defaultComparator;\n const aVal = (a as Record<string, unknown>)[sort.field];\n const bVal = (b as Record<string, unknown>)[sort.field];\n const result = comparator(aVal, bVal, a, b);\n if (result !== 0) {\n return sort.direction === 'asc' ? result : -result;\n }\n }\n return 0;\n });\n}\n\n/**\n * Default comparator for sorting values.\n * Handles nulls, numbers, dates, and strings.\n *\n * @param a - First value\n * @param b - Second value\n * @returns Comparison result (-1, 0, 1)\n */\nexport function defaultComparator(a: unknown, b: unknown): number {\n // Handle nulls/undefined - push to end\n if (a == null && b == null) return 0;\n if (a == null) return 1;\n if (b == null) return -1;\n\n // Type-aware comparison\n if (typeof a === 'number' && typeof b === 'number') {\n return a - b;\n }\n\n if (a instanceof Date && b instanceof Date) {\n return a.getTime() - b.getTime();\n }\n\n // Boolean comparison\n if (typeof a === 'boolean' && typeof b === 'boolean') {\n return a === b ? 0 : a ? -1 : 1;\n }\n\n // String comparison (fallback)\n return String(a).localeCompare(String(b));\n}\n\n/**\n * Toggle sort state for a field.\n * With shift key: adds/toggles in multi-sort list\n * Without shift key: replaces entire sort with single column\n *\n * @param current - Current sort model\n * @param field - Field to toggle\n * @param shiftKey - Whether shift key is held (multi-sort mode)\n * @param maxColumns - Maximum columns allowed in sort\n * @returns New sort model\n */\nexport function toggleSort(current: SortModel[], field: string, shiftKey: boolean, maxColumns: number): SortModel[] {\n const existing = current.find((s) => s.field === field);\n\n if (shiftKey) {\n // Multi-sort: add/toggle in list\n if (existing) {\n if (existing.direction === 'asc') {\n // Flip to descending\n return current.map((s) => (s.field === field ? { ...s, direction: 'desc' as const } : s));\n } else {\n // Remove from sort\n return current.filter((s) => s.field !== field);\n }\n } else if (current.length < maxColumns) {\n // Add new sort column\n return [...current, { field, direction: 'asc' as const }];\n }\n // Max columns reached, return unchanged\n return current;\n } else {\n // Single sort: replace all\n if (existing?.direction === 'asc') {\n return [{ field, direction: 'desc' }];\n } else if (existing?.direction === 'desc') {\n return [];\n }\n return [{ field, direction: 'asc' }];\n }\n}\n\n/**\n * Get the sort index (1-based) for a field in the sort model.\n * Returns undefined if the field is not in the sort model.\n *\n * @param sortModel - Current sort model\n * @param field - Field to check\n * @returns 1-based index or undefined\n */\nexport function getSortIndex(sortModel: SortModel[], field: string): number | undefined {\n const index = sortModel.findIndex((s) => s.field === field);\n return index >= 0 ? index + 1 : undefined;\n}\n\n/**\n * Get the sort direction for a field in the sort model.\n *\n * @param sortModel - Current sort model\n * @param field - Field to check\n * @returns Sort direction or undefined if not sorted\n */\nexport function getSortDirection(sortModel: SortModel[], field: string): 'asc' | 'desc' | undefined {\n return sortModel.find((s) => s.field === field)?.direction;\n}\n","/**\n * Multi-Sort Plugin (Class-based)\n *\n * Provides multi-column sorting capabilities for tbw-grid.\n * Supports shift+click for adding secondary sort columns.\n */\n\nimport { announce } from '../../core/internal/aria';\nimport { BaseGridPlugin, HeaderClickEvent } from '../../core/plugin/base-plugin';\nimport type { ColumnState, GridHost } from '../../core/types';\nimport { applySorts, getSortDirection, getSortIndex, toggleSort } from './multi-sort';\nimport styles from './multi-sort.css?inline';\nimport type { MultiSortConfig, SortModel } from './types';\n\n/**\n * Multi-Sort Plugin for tbw-grid\n *\n * Enables sorting by multiple columns at once—hold Shift and click additional column\n * headers to build up a sort stack. Priority badges show the sort order, so users\n * always know which column takes precedence.\n *\n * ## Installation\n *\n * ```ts\n * import { MultiSortPlugin } from '@toolbox-web/grid/plugins/multi-sort';\n * ```\n *\n * ## Configuration Options\n *\n * | Option | Type | Default | Description |\n * |--------|------|---------|-------------|\n * | `maxSortColumns` | `number` | `3` | Maximum columns to sort by |\n * | `showSortIndex` | `boolean` | `true` | Show sort priority badges |\n * | `initialSort` | `SortModel[]` | - | Pre-configured sort order on load |\n *\n * ## Keyboard Shortcuts\n *\n * | Shortcut | Action |\n * |----------|--------|\n * | `Click header` | Sort by column (clears other sorts) |\n * | `Shift + Click` | Add column to multi-sort stack |\n * | `Ctrl + Click` | Toggle sort direction |\n *\n * ## Events\n *\n * | Event | Detail | Description |\n * |-------|--------|-------------|\n * | `sort-change` | `{ sortModel: SortModel[] }` | Fired when sort changes |\n *\n * ## Programmatic API\n *\n * | Method | Signature | Description |\n * |--------|-----------|-------------|\n * | `setSort` | `(sortModel: SortModel[]) => void` | Set sort programmatically |\n * | `getSortModel` | `() => SortModel[]` | Get current sort model |\n * | `clearSort` | `() => void` | Clear all sorting |\n * | `addSort` | `(field, direction) => void` | Add a column to sort |\n * | `removeSort` | `(field) => void` | Remove a column from sort |\n *\n * @example Basic Multi-Column Sorting\n * ```ts\n * import '@toolbox-web/grid';\n * import { MultiSortPlugin } from '@toolbox-web/grid/plugins/multi-sort';\n *\n * const grid = document.querySelector('tbw-grid');\n * grid.gridConfig = {\n * columns: [\n * { field: 'name', header: 'Name', sortable: true },\n * { field: 'department', header: 'Department', sortable: true },\n * { field: 'salary', header: 'Salary', type: 'number', sortable: true },\n * ],\n * plugins: [new MultiSortPlugin({ maxSortColumns: 3, showSortIndex: true })],\n * };\n *\n * grid.on('sort-change', ({ sortModel }) => {\n * console.log('Active sorts:', sortModel);\n * });\n * ```\n *\n * @example Initial Sort Configuration\n * ```ts\n * new MultiSortPlugin({\n * initialSort: [\n * { field: 'department', direction: 'asc' },\n * { field: 'salary', direction: 'desc' },\n * ],\n * })\n * ```\n *\n * @see {@link MultiSortConfig} for all configuration options\n * @see {@link SortModel} for the sort model structure\n *\n * @internal Extends BaseGridPlugin\n */\nexport class MultiSortPlugin extends BaseGridPlugin<MultiSortConfig> {\n /** @internal */\n readonly name = 'multiSort';\n /** @internal */\n override readonly styles = styles;\n\n /** @internal */\n protected override get defaultConfig(): Partial<MultiSortConfig> {\n return {\n maxSortColumns: 3,\n showSortIndex: true,\n };\n }\n\n // #region Internal State\n private sortModel: SortModel[] = [];\n /** Cached sort result — returned as-is while a row edit is active to prevent\n * the edited row from jumping to a new sorted position mid-edit. Row data\n * mutations are still visible because the array holds shared object refs. */\n private cachedSortResult: unknown[] | null = null;\n\n /** Typed internal grid accessor. */\n get #internalGrid(): GridHost {\n return this.grid as unknown as GridHost;\n }\n\n /**\n * Clear the core `_sortState` so that only this plugin's `processRows`\n * sorting applies. `ConfigManager.applyState()` always sets the core sort\n * state when restoring from storage, even when a plugin handles sorting.\n * Without this, the stale core state leaks into `collectState()` and\n * `reapplyCoreSort()` after the plugin clears its own model.\n */\n private clearCoreSortState(): void {\n this.#internalGrid._sortState = null;\n }\n // #endregion\n\n // #region Lifecycle\n\n /** @internal */\n override detach(): void {\n this.sortModel = [];\n this.cachedSortResult = null;\n }\n // #endregion\n\n // #region Hooks\n\n /** @internal */\n override processRows(rows: readonly unknown[]): unknown[] {\n if (this.sortModel.length === 0) {\n this.cachedSortResult = null;\n return [...rows];\n }\n\n // Freeze sort order while a row is actively being edited (row mode only).\n // Re-sorting mid-edit would move the edited row to a new index while the\n // editors remain at the old position, causing data/UI mismatch.\n // In grid mode (_isGridEditMode) sorting is safe — afterCellRender\n // re-injects editors into the re-sorted cells.\n // We return the cached previous sort result (same object references, so\n // in-place value mutations are already visible) instead of unsorted input.\n const grid = this.#internalGrid;\n if (!grid._isGridEditMode && typeof grid._activeEditRows === 'number' && grid._activeEditRows !== -1) {\n if (this.cachedSortResult && this.cachedSortResult.length === rows.length) {\n return [...this.cachedSortResult];\n }\n }\n\n const sorted = applySorts([...rows], this.sortModel, [...this.columns]);\n this.cachedSortResult = sorted;\n return sorted;\n }\n\n /** @internal */\n override onHeaderClick(event: HeaderClickEvent): boolean {\n const column = this.columns.find((c) => c.field === event.field);\n if (!column?.sortable) return false;\n\n const shiftKey = event.originalEvent.shiftKey;\n const maxColumns = this.config.maxSortColumns ?? 3;\n\n this.sortModel = toggleSort(this.sortModel, event.field, shiftKey, maxColumns);\n this.clearCoreSortState();\n\n this.emit('sort-change', { sortModel: [...this.sortModel] });\n this.requestRender();\n this.grid?.requestStateChange?.();\n\n // Announce for screen readers\n if (this.sortModel.length > 0) {\n const labels = this.sortModel.map((s) => {\n const col = this.columns.find((c) => c.field === s.field);\n return `${col?.header ?? s.field} ${s.direction === 'asc' ? 'ascending' : 'descending'}`;\n });\n announce(this.gridElement!, `Sorted by ${labels.join(', then ')}`);\n } else {\n announce(this.gridElement!, 'Sort cleared');\n }\n\n return true;\n }\n\n /** @internal */\n override afterRender(): void {\n const gridEl = this.gridElement;\n if (!gridEl) return;\n\n const showIndex = this.config.showSortIndex !== false;\n\n // Update all sortable header cells with sort indicators\n const headerCells = gridEl.querySelectorAll('.header-row .cell[data-field]');\n headerCells.forEach((cell) => {\n const field = cell.getAttribute('data-field');\n if (!field) return;\n\n const sortIndex = getSortIndex(this.sortModel, field);\n const sortDir = getSortDirection(this.sortModel, field);\n\n // Remove existing sort index badge (always clean up)\n const existingBadge = cell.querySelector('.sort-index');\n existingBadge?.remove();\n\n if (sortDir) {\n // Column is sorted - remove base indicator and add our own\n const existingIndicator = cell.querySelector('[part~=\"sort-indicator\"], .sort-indicator');\n existingIndicator?.remove();\n\n cell.setAttribute('data-sort', sortDir);\n\n // Add sort arrow indicator - insert BEFORE filter button and resize handle\n // to maintain consistent order: [label, sort-indicator, sort-index, filter-btn, resize-handle]\n const indicator = document.createElement('span');\n indicator.className = 'sort-indicator';\n // Use grid-level icons (fall back to defaults)\n this.setIcon(indicator, this.resolveIcon(sortDir === 'asc' ? 'sortAsc' : 'sortDesc'));\n\n // Find insertion point: before filter button or resize handle\n const filterBtn = cell.querySelector('.tbw-filter-btn');\n const resizeHandle = cell.querySelector('.resize-handle');\n const insertBefore = filterBtn ?? resizeHandle;\n if (insertBefore) {\n cell.insertBefore(indicator, insertBefore);\n } else {\n cell.appendChild(indicator);\n }\n\n // Add sort index badge if multiple columns sorted and showSortIndex is enabled\n if (showIndex && this.sortModel.length > 1 && sortIndex !== undefined) {\n const badge = document.createElement('span');\n badge.className = 'sort-index';\n badge.textContent = String(sortIndex);\n // Insert badge right after the indicator\n if (indicator.nextSibling) {\n cell.insertBefore(badge, indicator.nextSibling);\n } else {\n cell.appendChild(badge);\n }\n }\n } else {\n cell.removeAttribute('data-sort');\n // Remove any stale sort indicators left by a previous afterRender cycle\n // Base indicators use part=\"sort-indicator\", plugin indicators use class=\"sort-indicator\"\n const staleIndicator = cell.querySelector('[part~=\"sort-indicator\"], .sort-indicator');\n staleIndicator?.remove();\n }\n });\n }\n // #endregion\n\n // #region Public API\n\n /**\n * Get the current sort model.\n * @returns Copy of the current sort model\n */\n getSortModel(): SortModel[] {\n return [...this.sortModel];\n }\n\n /**\n * Set the sort model programmatically.\n * @param model - New sort model to apply\n */\n setSortModel(model: SortModel[]): void {\n this.sortModel = [...model];\n this.clearCoreSortState();\n this.emit('sort-change', { sortModel: [...model] });\n this.requestRender();\n this.grid?.requestStateChange?.();\n if (model.length > 0) {\n const labels = model.map((s) => {\n const col = this.columns.find((c) => c.field === s.field);\n return `${col?.header ?? s.field} ${s.direction === 'asc' ? 'ascending' : 'descending'}`;\n });\n announce(this.gridElement!, `Sorted by ${labels.join(', then ')}`);\n }\n }\n\n /**\n * Clear all sorting.\n */\n clearSort(): void {\n this.sortModel = [];\n this.clearCoreSortState();\n this.emit('sort-change', { sortModel: [] });\n this.requestRender();\n this.grid?.requestStateChange?.();\n announce(this.gridElement!, 'Sort cleared');\n }\n\n /**\n * Get the sort index (1-based) for a specific field.\n * @param field - Field to check\n * @returns 1-based index or undefined if not sorted\n */\n getSortIndex(field: string): number | undefined {\n return getSortIndex(this.sortModel, field);\n }\n\n /**\n * Get the sort direction for a specific field.\n * @param field - Field to check\n * @returns Sort direction or undefined if not sorted\n */\n getSortDirection(field: string): 'asc' | 'desc' | undefined {\n return getSortDirection(this.sortModel, field);\n }\n // #endregion\n\n // #region Column State Hooks\n\n /**\n * Return sort state for a column if it's in the sort model.\n * @internal\n */\n override getColumnState(field: string): Partial<ColumnState> | undefined {\n const index = this.sortModel.findIndex((s) => s.field === field);\n if (index === -1) return undefined;\n\n const sortEntry = this.sortModel[index];\n return {\n sort: {\n direction: sortEntry.direction,\n priority: index,\n },\n };\n }\n\n /**\n * Apply sort state from column state.\n * Rebuilds the sort model from all column states.\n * @internal\n */\n override applyColumnState(field: string, state: ColumnState): void {\n // Only process if the column has sort state\n if (!state.sort) {\n // Remove this field from sortModel if it exists\n this.sortModel = this.sortModel.filter((s) => s.field !== field);\n return;\n }\n\n // Find existing entry or add new one\n const existingIndex = this.sortModel.findIndex((s) => s.field === field);\n const newEntry: SortModel = {\n field,\n direction: state.sort.direction,\n };\n\n if (existingIndex !== -1) {\n // Update existing entry\n this.sortModel[existingIndex] = newEntry;\n } else {\n // Add at the correct priority position\n this.sortModel.splice(state.sort.priority, 0, newEntry);\n }\n\n // Clear core sort state — this plugin exclusively handles sorting via\n // processRows. The core _sortState is set by ConfigManager.applyState()\n // before plugins run; null it so reapplyCoreSort() is a no-op.\n this.clearCoreSortState();\n }\n // #endregion\n}\n"],"names":["defaultComparator","a","b","Date","getTime","String","localeCompare","getSortIndex","sortModel","field","index","findIndex","s","getSortDirection","find","direction","MultiSortPlugin","BaseGridPlugin","name","styles","defaultConfig","maxSortColumns","showSortIndex","cachedSortResult","internalGrid","this","grid","clearCoreSortState","_sortState","detach","processRows","rows","length","_isGridEditMode","_activeEditRows","sorted","sorts","columns","sort","col","c","result","sortComparator","applySorts","onHeaderClick","event","column","sortable","shiftKey","originalEvent","maxColumns","config","current","existing","map","filter","toggleSort","emit","requestRender","requestStateChange","labels","header","announce","gridElement","join","afterRender","gridEl","showIndex","querySelectorAll","forEach","cell","getAttribute","sortIndex","sortDir","existingBadge","querySelector","remove","existingIndicator","setAttribute","indicator","document","createElement","className","setIcon","resolveIcon","filterBtn","resizeHandle","insertBefore","appendChild","badge","textContent","nextSibling","removeAttribute","staleIndicator","getSortModel","setSortModel","model","clearSort","getColumnState","priority","applyColumnState","state","existingIndex","newEntry","splice"],"mappings":"8ZA4CO,SAASA,EAAkBC,EAAYC,GAE5C,OAAS,MAALD,GAAkB,MAALC,EAAkB,EAC1B,MAALD,EAAkB,EACb,MAALC,GAAkB,EAGL,iBAAND,GAA+B,iBAANC,EAC3BD,EAAIC,EAGTD,aAAaE,MAAQD,aAAaC,KAC7BF,EAAEG,UAAYF,EAAEE,UAIR,kBAANH,GAAgC,kBAANC,EAC5BD,IAAMC,EAAI,EAAID,GAAI,EAAK,EAIzBI,OAAOJ,GAAGK,cAAcD,OAAOH,GACxC,CAmDO,SAASK,EAAaC,EAAwBC,GACnD,MAAMC,EAAQF,EAAUG,UAAWC,GAAMA,EAAEH,QAAUA,GACrD,OAAOC,GAAS,EAAIA,EAAQ,OAAI,CAClC,CASO,SAASG,EAAiBL,EAAwBC,GACvD,OAAOD,EAAUM,KAAMF,GAAMA,EAAEH,QAAUA,IAAQM,SACnD,CCrCO,MAAMC,UAAwBC,EAAAA,eAE1BC,KAAO,YAEEC,isBAGlB,iBAAuBC,GACrB,MAAO,CACLC,eAAgB,EAChBC,eAAe,EAEnB,CAG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G,EAAEG,UAAsB,YAAc,iBAE5E+C,WAASrC,KAAKsC,YAAc,aAAaH,EAAOI,KAAK,aACvD,CACF,CAKA,SAAAiC,GACExE,KAAKjB,UAAY,GACjBiB,KAAKE,qBACLF,KAAKgC,KAAK,cAAe,CAAEjD,UAAW,KACtCiB,KAAKiC,gBACLjC,KAAKC,MAAMiC,uBACXG,WAASrC,KAAKsC,YAAc,eAC9B,CAOA,YAAAxD,CAAaE,GACX,OAAOF,EAAakB,KAAKjB,UAAWC,EACtC,CAOA,gBAAAI,CAAiBJ,GACf,OAAOI,EAAiBY,KAAKjB,UAAWC,EAC1C,CASS,cAAAyF,CAAezF,GACtB,MAAMC,EAAQe,KAAKjB,UAAUG,UAAWC,GAAMA,EAAEH,QAAUA,GAC1D,QAAIC,EAAc,OAGlB,MAAO,CACL4B,KAAM,CACJvB,UAHcU,KAAKjB,UAAUE,GAGRK,UACrBoF,SAAUzF,GAGhB,CAOS,gBAAA0F,CAAiB3F,EAAe4F,GAEvC,IAAKA,EAAM/D,KAGT,YADAb,KAAKjB,UAAYiB,KAAKjB,UAAU+C,OAAQ3C,GAAMA,EAAEH,QAAUA,IAK5D,MAAM6F,EAAgB7E,KAAKjB,UAAUG,UAAWC,GAAMA,EAAEH,QAAUA,GAC5D8F,EAAsB,CAC1B9F,QACAM,UAAWsF,EAAM/D,KAAKvB,YAGF,IAAlBuF,EAEF7E,KAAKjB,UAAU8F,GAAiBC,EAGhC9E,KAAKjB,UAAUgG,OAAOH,EAAM/D,KAAK6D,SAAU,EAAGI,GAMhD9E,KAAKE,oBACP"}
@@ -1,2 +1,2 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("../../core/internal/utils"),require("../../core/plugin/base-plugin")):"function"==typeof define&&define.amd?define(["exports","../../core/internal/utils","../../core/plugin/base-plugin"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).TbwGridPlugin_pinnedColumns={},t.TbwGrid,t.TbwGrid)}(this,function(t,e,i){"use strict";function n(t){return t.pinned??t.sticky??t.meta?.pinned??t.meta?.sticky}function s(t,i){return e.resolveInlinePosition(t,i)}function r(t,e){const i=n(t);return!!i&&"left"===s(i,e)}function o(t,e){const i=n(t);return!!i&&"right"===s(i,e)}function l(t){return t.some(t=>null!=n(t))}function c(t,i){const n=Array.from(t.querySelectorAll(".header-row .cell"));if(!n.length)return;const s=e.getDirection(t);let l=0;for(const e of i)if(r(e,s)){const i=n.find(t=>t.getAttribute("data-field")===e.field);i&&(i.classList.add("sticky-left"),i.style.position="sticky",i.style.left=l+"px",t.querySelectorAll(`.data-grid-row .cell[data-field="${e.field}"]`).forEach(t=>{t.classList.add("sticky-left"),t.style.position="sticky",t.style.left=l+"px"}),l+=i.offsetWidth)}let c=0;for(const e of[...i].reverse())if(o(e,s)){const i=n.find(t=>t.getAttribute("data-field")===e.field);i&&(i.classList.add("sticky-right"),i.style.position="sticky",i.style.right=c+"px",t.querySelectorAll(`.data-grid-row .cell[data-field="${e.field}"]`).forEach(t=>{t.classList.add("sticky-right"),t.style.position="sticky",t.style.right=c+"px"}),c+=i.offsetWidth)}}function f(t){t.querySelectorAll(".sticky-left, .sticky-right").forEach(t=>{t.classList.remove("sticky-left","sticky-right"),t.style.position="",t.style.left="",t.style.right=""})}const d="canMoveColumn";class u extends i.BaseGridPlugin{static manifest={ownedProperties:[{property:"pinned",level:"column",description:'the "pinned" column property',isUsed:t=>"left"===t||"right"===t||"start"===t||"end"===t},{property:"sticky",level:"column",description:'the "sticky" column property (deprecated, use "pinned")',isUsed:t=>"left"===t||"right"===t||"start"===t||"end"===t}],incompatibleWith:[{name:"groupingColumns",reason:"Pinning reorders columns to the grid edges, but moving a column out of its column group is not supported. The group header layout cannot accommodate members at different positions."}],queries:[{type:d,description:"Prevents pinned (sticky) columns from being moved/reordered"},{type:"getStickyOffsets",description:"Returns the sticky offsets for left/right pinned columns"},{type:"getContextMenuItems",description:"Contributes pin/unpin items to the header context menu"}]};name="pinnedColumns";get defaultConfig(){return{}}isApplied=!1;leftOffsets=new Map;rightOffsets=new Map;#t=[];detach(){this.leftOffsets.clear(),this.rightOffsets.clear(),this.isApplied=!1,this.#t=[]}static detect(t,e){const i=e?.columns;return!!Array.isArray(i)&&l(i)}processColumns(t){const i=[...t];if(this.isApplied=l(i),!this.isApplied)return i;const r=this.gridElement;return function(t,e="ltr"){const i=[],r=[],o=[];for(const l of t){const t=n(l);t?"left"===s(t,e)?i.push(l):o.push(l):r.push(l)}return[...i,...r,...o]}(i,r?e.getDirection(r):"ltr")}afterRender(){if(!this.isApplied)return;const t=this.grid,e=[...this.columns];if(!l(e))return f(t),void(this.isApplied=!1);queueMicrotask(()=>{c(t,e)})}handleQuery(t){switch(t.type){case d:return null==n(t.context)&&void 0;case"getStickyOffsets":return{left:Object.fromEntries(this.leftOffsets),right:Object.fromEntries(this.rightOffsets)};case"getContextMenuItems":{const e=t.context;if(!e.isHeader)return;const i=e.column;if(!i?.field)return;if(i.meta?.lockPinning)return;const s=this.grid?.getPluginByName("groupingColumns");if(s?.isGroupingActive())return;const r=[];return null!=n(i)?r.push({id:"pinned/unpin",label:"Unpin Column",icon:"📌",order:40,action:()=>this.setPinPosition(i.field,void 0)}):(r.push({id:"pinned/pin-left",label:"Pin Left",icon:"⬅",order:40,action:()=>this.setPinPosition(i.field,"left")}),r.push({id:"pinned/pin-right",label:"Pin Right",icon:"➡",order:41,action:()=>this.setPinPosition(i.field,"right")})),r}default:return}}setPinPosition(t,e){const i=this.columns;if(!i?.length)return;const s=i.findIndex(e=>e.field===t);if(-1===s)return;const r=this.grid;if(e){0===this.#t.length&&(this.#t=i.map(t=>t.field));const n=i.map(i=>{if(i.field!==t)return i;const n={...i};return n.pinned=e,delete n.sticky,n});r.columns=n}else{const e={...i[s]};delete e.pinned,delete e.sticky;const o=[...i];o.splice(s,1);const l=this.#t.indexOf(t);if(l>=0){let t=o.length;for(let e=0;e<o.length;e++){if(n(o[e]))continue;if(this.#t.indexOf(o[e].field)>l){t=e;break}}o.splice(t,0,e)}else o.splice(Math.min(s,o.length),0,e);o.some(t=>null!=n(t))||(this.#t=[]),r.columns=o}}refreshStickyOffsets(){const t=[...this.columns];c(this.grid,t)}getLeftPinnedColumns(){return function(t,e="ltr"){return t.filter(t=>r(t,e))}([...this.columns],e.getDirection(this.grid))}getRightPinnedColumns(){return function(t,e="ltr"){return t.filter(t=>o(t,e))}([...this.columns],e.getDirection(this.grid))}clearStickyPositions(){f(this.grid)}getHorizontalScrollOffsets(t,e){if(!this.isApplied)return;let i=0,n=0;if(t){const e=t.querySelectorAll(".sticky-left"),s=t.querySelectorAll(".sticky-right");e.forEach(t=>{i+=t.offsetWidth}),s.forEach(t=>{n+=t.offsetWidth})}else{this.grid.querySelectorAll(".header-row .cell").forEach(t=>{t.classList.contains("sticky-left")?i+=t.offsetWidth:t.classList.contains("sticky-right")&&(n+=t.offsetWidth)})}const s=e?.classList.contains("sticky-left")||e?.classList.contains("sticky-right");return{left:i,right:n,skipScroll:s}}}t.PinnedColumnsPlugin=u,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("../../core/internal/utils"),require("../../core/plugin/base-plugin")):"function"==typeof define&&define.amd?define(["exports","../../core/internal/utils","../../core/plugin/base-plugin"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).TbwGridPlugin_pinnedColumns={},t.TbwGrid,t.TbwGrid)}(this,function(t,e,i){"use strict";function n(t){return t.pinned??t.sticky??t.meta?.pinned??t.meta?.sticky}function s(t,i){return e.resolveInlinePosition(t,i)}function r(t,e){const i=n(t);return!!i&&"left"===s(i,e)}function o(t,e){const i=n(t);return!!i&&"right"===s(i,e)}function l(t){return t.some(t=>null!=n(t))}function c(t,i){const n=Array.from(t.querySelectorAll(".header-row .cell"));if(!n.length)return;const s=e.getDirection(t);let l=0;for(const e of i)if(r(e,s)){const i=n.find(t=>t.getAttribute("data-field")===e.field);i&&(i.classList.add("sticky-left"),i.style.position="sticky",i.style.left=l+"px",t.querySelectorAll(`.data-grid-row .cell[data-field="${e.field}"]`).forEach(t=>{t.classList.add("sticky-left"),t.style.position="sticky",t.style.left=l+"px"}),l+=i.offsetWidth)}let c=0;for(const e of[...i].reverse())if(o(e,s)){const i=n.find(t=>t.getAttribute("data-field")===e.field);i&&(i.classList.add("sticky-right"),i.style.position="sticky",i.style.right=c+"px",t.querySelectorAll(`.data-grid-row .cell[data-field="${e.field}"]`).forEach(t=>{t.classList.add("sticky-right"),t.style.position="sticky",t.style.right=c+"px"}),c+=i.offsetWidth)}}function f(t){t.querySelectorAll(".sticky-left, .sticky-right").forEach(t=>{t.classList.remove("sticky-left","sticky-right"),t.style.position="",t.style.left="",t.style.right=""})}const d="canMoveColumn";class u extends i.BaseGridPlugin{static manifest={ownedProperties:[{property:"pinned",level:"column",description:'the "pinned" column property',isUsed:t=>"left"===t||"right"===t||"start"===t||"end"===t},{property:"sticky",level:"column",description:'the "sticky" column property (deprecated, use "pinned")',isUsed:t=>"left"===t||"right"===t||"start"===t||"end"===t}],incompatibleWith:[{name:"groupingColumns",reason:"Pinning reorders columns to the grid edges, but moving a column out of its column group is not supported. The group header layout cannot accommodate members at different positions."}],queries:[{type:d,description:"Prevents pinned (sticky) columns from being moved/reordered"},{type:"getStickyOffsets",description:"Returns the sticky offsets for left/right pinned columns"},{type:"getContextMenuItems",description:"Contributes pin/unpin items to the header context menu"}]};name="pinnedColumns";get defaultConfig(){return{}}isApplied=!1;leftOffsets=new Map;rightOffsets=new Map;#t=[];detach(){this.leftOffsets.clear(),this.rightOffsets.clear(),this.isApplied=!1,this.#t=[]}static detect(t,e){const i=e?.columns;return!!Array.isArray(i)&&l(i)}processColumns(t){const i=[...t];if(this.isApplied=l(i),!this.isApplied)return i;const r=this.gridElement;return function(t,e="ltr"){const i=[],r=[],o=[];for(const l of t){const t=n(l);t?"left"===s(t,e)?i.push(l):o.push(l):r.push(l)}return[...i,...r,...o]}(i,r?e.getDirection(r):"ltr")}afterRender(){if(!this.isApplied)return;const t=this.gridElement,e=[...this.columns];if(!l(e))return f(t),void(this.isApplied=!1);queueMicrotask(()=>{c(t,e)})}handleQuery(t){switch(t.type){case d:return null==n(t.context)&&void 0;case"getStickyOffsets":return{left:Object.fromEntries(this.leftOffsets),right:Object.fromEntries(this.rightOffsets)};case"getContextMenuItems":{const e=t.context;if(!e.isHeader)return;const i=e.column;if(!i?.field)return;if(i.meta?.lockPinning)return;const s=this.grid?.getPluginByName("groupingColumns");if(s?.isGroupingActive())return;const r=[];return null!=n(i)?r.push({id:"pinned/unpin",label:"Unpin Column",icon:"📌",order:40,action:()=>this.setPinPosition(i.field,void 0)}):(r.push({id:"pinned/pin-left",label:"Pin Left",icon:"⬅",order:40,action:()=>this.setPinPosition(i.field,"left")}),r.push({id:"pinned/pin-right",label:"Pin Right",icon:"➡",order:41,action:()=>this.setPinPosition(i.field,"right")})),r}default:return}}setPinPosition(t,e){const i=this.columns;if(!i?.length)return;const s=i.findIndex(e=>e.field===t);if(-1===s)return;const r=this.gridElement;if(e){0===this.#t.length&&(this.#t=i.map(t=>t.field));const n=i.map(i=>{if(i.field!==t)return i;const n={...i};return n.pinned=e,delete n.sticky,n});r.columns=n}else{const e={...i[s]};delete e.pinned,delete e.sticky;const o=[...i];o.splice(s,1);const l=this.#t.indexOf(t);if(l>=0){let t=o.length;for(let e=0;e<o.length;e++){if(n(o[e]))continue;if(this.#t.indexOf(o[e].field)>l){t=e;break}}o.splice(t,0,e)}else o.splice(Math.min(s,o.length),0,e);o.some(t=>null!=n(t))||(this.#t=[]),r.columns=o}}refreshStickyOffsets(){const t=[...this.columns];c(this.gridElement,t)}getLeftPinnedColumns(){return function(t,e="ltr"){return t.filter(t=>r(t,e))}([...this.columns],e.getDirection(this.gridElement))}getRightPinnedColumns(){return function(t,e="ltr"){return t.filter(t=>o(t,e))}([...this.columns],e.getDirection(this.gridElement))}clearStickyPositions(){f(this.gridElement)}getHorizontalScrollOffsets(t,e){if(!this.isApplied)return;let i=0,n=0;if(t){const e=t.querySelectorAll(".sticky-left"),s=t.querySelectorAll(".sticky-right");e.forEach(t=>{i+=t.offsetWidth}),s.forEach(t=>{n+=t.offsetWidth})}else{this.gridElement.querySelectorAll(".header-row .cell").forEach(t=>{t.classList.contains("sticky-left")?i+=t.offsetWidth:t.classList.contains("sticky-right")&&(n+=t.offsetWidth)})}const s=e?.classList.contains("sticky-left")||e?.classList.contains("sticky-right");return{left:i,right:n,skipScroll:s}}}t.PinnedColumnsPlugin=u,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=pinned-columns.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pinned-columns.umd.js","sources":["../../../../../libs/grid/src/lib/plugins/pinned-columns/pinned-columns.ts","../../../../../libs/grid/src/lib/plugins/pinned-columns/PinnedColumnsPlugin.ts"],"sourcesContent":["/**\n * Pinned Columns Core Logic\n *\n * Pure functions for applying pinned (sticky) column positioning.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { getDirection, resolveInlinePosition, type TextDirection } from '../../core/internal/utils';\nimport type { PinnedPosition, ResolvedPinnedPosition } from './types';\n\n// Keep deprecated imports working (StickyPosition = PinnedPosition)\ntype StickyPosition = PinnedPosition;\ntype ResolvedStickyPosition = ResolvedPinnedPosition;\n\n/**\n * Get the effective pinned position from a column, checking `pinned` first then `sticky` (deprecated).\n *\n * @param col - Column configuration object\n * @returns The pinned position, or undefined if not pinned\n */\nexport function getColumnPinned(col: any): PinnedPosition | undefined {\n return col.pinned ?? col.sticky ?? col.meta?.pinned ?? col.meta?.sticky;\n}\n\n/**\n * Resolve a pinned position to a physical position based on text direction.\n *\n * - `'left'` / `'right'` → unchanged (physical values)\n * - `'start'` → `'left'` in LTR, `'right'` in RTL\n * - `'end'` → `'right'` in LTR, `'left'` in RTL\n *\n * @param position - The pinned position (logical or physical)\n * @param direction - Text direction ('ltr' or 'rtl')\n * @returns Physical pinned position ('left' or 'right')\n */\nexport function resolveStickyPosition(position: StickyPosition, direction: TextDirection): ResolvedStickyPosition {\n return resolveInlinePosition(position, direction);\n}\n\n/**\n * Check if a column is pinned on the left (after resolving logical positions).\n */\nfunction isResolvedLeft(col: any, direction: TextDirection): boolean {\n const pinned = getColumnPinned(col);\n if (!pinned) return false;\n return resolveStickyPosition(pinned, direction) === 'left';\n}\n\n/**\n * Check if a column is pinned on the right (after resolving logical positions).\n */\nfunction isResolvedRight(col: any, direction: TextDirection): boolean {\n const pinned = getColumnPinned(col);\n if (!pinned) return false;\n return resolveStickyPosition(pinned, direction) === 'right';\n}\n\n/**\n * Get columns that should be sticky on the left.\n *\n * @param columns - Array of column configurations\n * @param direction - Text direction (default: 'ltr')\n * @returns Array of columns with sticky='left' or sticky='start' (in LTR)\n */\nexport function getLeftStickyColumns(columns: any[], direction: TextDirection = 'ltr'): any[] {\n return columns.filter((col) => isResolvedLeft(col, direction));\n}\n\n/**\n * Get columns that should be sticky on the right.\n *\n * @param columns - Array of column configurations\n * @param direction - Text direction (default: 'ltr')\n * @returns Array of columns with sticky='right' or sticky='end' (in LTR)\n */\nexport function getRightStickyColumns(columns: any[], direction: TextDirection = 'ltr'): any[] {\n return columns.filter((col) => isResolvedRight(col, direction));\n}\n\n/**\n * Check if any columns have sticky positioning.\n *\n * @param columns - Array of column configurations\n * @returns True if any column has sticky position\n */\nexport function hasStickyColumns(columns: any[]): boolean {\n return columns.some((col) => getColumnPinned(col) != null);\n}\n\n/**\n * Get the sticky position of a column.\n *\n * @param column - Column configuration\n * @returns The sticky position or null if not sticky\n */\nexport function getColumnStickyPosition(column: any): StickyPosition | null {\n return getColumnPinned(column) ?? null;\n}\n\n\n/**\n * Calculate left offsets for sticky-left columns.\n * Returns a map of field -> offset in pixels.\n *\n * @param columns - Array of column configurations (in order)\n * @param getColumnWidth - Function to get column width by field\n * @param direction - Text direction (default: 'ltr')\n * @returns Map of field to left offset\n */\nexport function calculateLeftStickyOffsets(\n columns: any[],\n getColumnWidth: (field: string) => number,\n direction: TextDirection = 'ltr',\n): Map<string, number> {\n const offsets = new Map<string, number>();\n let currentOffset = 0;\n\n for (const col of columns) {\n if (isResolvedLeft(col, direction)) {\n offsets.set(col.field, currentOffset);\n currentOffset += getColumnWidth(col.field);\n }\n }\n\n return offsets;\n}\n\n/**\n * Calculate right offsets for sticky-right columns.\n * Processes columns in reverse order.\n *\n * @param columns - Array of column configurations (in order)\n * @param getColumnWidth - Function to get column width by field\n * @param direction - Text direction (default: 'ltr')\n * @returns Map of field to right offset\n */\nexport function calculateRightStickyOffsets(\n columns: any[],\n getColumnWidth: (field: string) => number,\n direction: TextDirection = 'ltr',\n): Map<string, number> {\n const offsets = new Map<string, number>();\n let currentOffset = 0;\n\n // Process in reverse for right-sticky columns\n const reversed = [...columns].reverse();\n for (const col of reversed) {\n if (isResolvedRight(col, direction)) {\n offsets.set(col.field, currentOffset);\n currentOffset += getColumnWidth(col.field);\n }\n }\n\n return offsets;\n}\n\n/**\n * Apply sticky offsets to header and body cells.\n * This modifies the DOM elements in place.\n *\n * @param host - The grid host element (render root for DOM queries)\n * @param columns - Array of column configurations\n */\nexport function applyStickyOffsets(host: HTMLElement, columns: any[]): void {\n // With light DOM, query the host element directly\n const headerCells = Array.from(host.querySelectorAll('.header-row .cell')) as HTMLElement[];\n if (!headerCells.length) return;\n\n // Detect text direction from the host element\n const direction = getDirection(host);\n\n // Apply left sticky (includes 'start' in LTR, 'end' in RTL)\n let left = 0;\n for (const col of columns) {\n if (isResolvedLeft(col, direction)) {\n const cell = headerCells.find((c) => c.getAttribute('data-field') === col.field);\n if (cell) {\n cell.classList.add('sticky-left');\n cell.style.position = 'sticky';\n cell.style.left = left + 'px';\n // Body cells: use data-field for reliable matching (data-col indices may differ\n // between _columns and _visibleColumns due to hidden/utility columns)\n host.querySelectorAll(`.data-grid-row .cell[data-field=\"${col.field}\"]`).forEach((el) => {\n el.classList.add('sticky-left');\n (el as HTMLElement).style.position = 'sticky';\n (el as HTMLElement).style.left = left + 'px';\n });\n left += cell.offsetWidth;\n }\n }\n }\n\n // Apply right sticky (includes 'end' in LTR, 'start' in RTL) - process in reverse\n let right = 0;\n for (const col of [...columns].reverse()) {\n if (isResolvedRight(col, direction)) {\n const cell = headerCells.find((c) => c.getAttribute('data-field') === col.field);\n if (cell) {\n cell.classList.add('sticky-right');\n cell.style.position = 'sticky';\n cell.style.right = right + 'px';\n // Body cells: use data-field for reliable matching\n host.querySelectorAll(`.data-grid-row .cell[data-field=\"${col.field}\"]`).forEach((el) => {\n el.classList.add('sticky-right');\n (el as HTMLElement).style.position = 'sticky';\n (el as HTMLElement).style.right = right + 'px';\n });\n right += cell.offsetWidth;\n }\n }\n }\n}\n\n/**\n * Reorder columns so that pinned-left columns come first and pinned-right columns come last.\n * Maintains the relative order within each group (left-pinned, unpinned, right-pinned).\n *\n * @param columns - Array of column configurations (in their current order)\n * @param direction - Text direction ('ltr' or 'rtl'), used to resolve logical positions\n * @returns New array with pinned columns moved to the edges\n */\nexport function reorderColumnsForPinning(columns: readonly any[], direction: TextDirection = 'ltr'): any[] {\n const left: any[] = [];\n const middle: any[] = [];\n const right: any[] = [];\n\n for (const col of columns) {\n const pinned = getColumnPinned(col);\n if (pinned) {\n const resolved = resolveStickyPosition(pinned, direction);\n if (resolved === 'left') left.push(col);\n else right.push(col);\n } else {\n middle.push(col);\n }\n }\n\n return [...left, ...middle, ...right];\n}\n\n/**\n * Clear sticky positioning from all cells.\n *\n * @param host - The grid host element (render root for DOM queries)\n */\nexport function clearStickyOffsets(host: HTMLElement): void {\n // With light DOM, query the host element directly\n const cells = host.querySelectorAll('.sticky-left, .sticky-right');\n cells.forEach((cell) => {\n cell.classList.remove('sticky-left', 'sticky-right');\n (cell as HTMLElement).style.position = '';\n (cell as HTMLElement).style.left = '';\n (cell as HTMLElement).style.right = '';\n });\n}\n","/**\n * Pinned Columns Plugin (Class-based)\n *\n * Enables column pinning (sticky left/right positioning).\n */\n\nimport { getDirection } from '../../core/internal/utils';\nimport type { PluginManifest, PluginQuery } from '../../core/plugin/base-plugin';\nimport { BaseGridPlugin } from '../../core/plugin/base-plugin';\nimport type { ColumnConfig } from '../../core/types';\nimport type { ContextMenuParams, HeaderContextMenuItem } from '../context-menu/types';\nimport {\n applyStickyOffsets,\n clearStickyOffsets,\n getColumnPinned,\n getLeftStickyColumns,\n getRightStickyColumns,\n hasStickyColumns,\n reorderColumnsForPinning,\n} from './pinned-columns';\nimport type { PinnedColumnsConfig, PinnedPosition } from './types';\n\n/** Query type constant for checking if a column can be moved */\nconst QUERY_CAN_MOVE_COLUMN = 'canMoveColumn';\n\n/**\n * Pinned Columns Plugin for tbw-grid\n *\n * Freezes columns to the left or right edge of the grid—essential for keeping key\n * identifiers or action buttons visible while scrolling through wide datasets. Just set\n * `pinned: 'left'` or `pinned: 'right'` on your column definitions.\n *\n * ## Installation\n *\n * ```ts\n * import { PinnedColumnsPlugin } from '@toolbox-web/grid/plugins/pinned-columns';\n * ```\n *\n * ## Column Configuration\n *\n * | Property | Type | Description |\n * |----------|------|-------------|\n * | `pinned` | `'left' \\| 'right' \\| 'start' \\| 'end'` | Pin column to edge (logical or physical) |\n * | `meta.lockPinning` | `boolean` | `false` | Prevent user from pin/unpin via context menu |\n *\n * ### RTL Support\n *\n * Use logical values (`start`/`end`) for grids that work in both LTR and RTL layouts:\n * - `'start'` - Pins to left in LTR, right in RTL\n * - `'end'` - Pins to right in LTR, left in RTL\n *\n * ## CSS Custom Properties\n *\n * | Property | Default | Description |\n * |----------|---------|-------------|\n * | `--tbw-pinned-shadow` | `4px 0 8px rgba(0,0,0,0.1)` | Shadow on pinned column edge |\n * | `--tbw-pinned-border` | `var(--tbw-color-border)` | Border between pinned and scrollable |\n *\n * @example Pin ID Left and Actions Right\n * ```ts\n * import '@toolbox-web/grid';\n * import { PinnedColumnsPlugin } from '@toolbox-web/grid/plugins/pinned-columns';\n *\n * const grid = document.querySelector('tbw-grid');\n * grid.gridConfig = {\n * columns: [\n * { field: 'id', header: 'ID', pinned: 'left', width: 80 },\n * { field: 'name', header: 'Name' },\n * { field: 'email', header: 'Email' },\n * { field: 'department', header: 'Department' },\n * { field: 'actions', header: 'Actions', pinned: 'right', width: 120 },\n * ],\n * plugins: [new PinnedColumnsPlugin()],\n * };\n * ```\n *\n * @example RTL-Compatible Pinning\n * ```ts\n * // Same config works in LTR and RTL\n * grid.gridConfig = {\n * columns: [\n * { field: 'id', header: 'ID', pinned: 'start' }, // Left in LTR, Right in RTL\n * { field: 'name', header: 'Name' },\n * { field: 'actions', header: 'Actions', pinned: 'end' }, // Right in LTR, Left in RTL\n * ],\n * plugins: [new PinnedColumnsPlugin()],\n * };\n * ```\n *\n * @see {@link PinnedColumnsConfig} for configuration options\n *\n * @internal Extends BaseGridPlugin\n */\nexport class PinnedColumnsPlugin extends BaseGridPlugin<PinnedColumnsConfig> {\n /**\n * Plugin manifest - declares owned properties and handled queries.\n * @internal\n */\n static override readonly manifest: PluginManifest = {\n ownedProperties: [\n {\n property: 'pinned',\n level: 'column',\n description: 'the \"pinned\" column property',\n isUsed: (v) => v === 'left' || v === 'right' || v === 'start' || v === 'end',\n },\n {\n property: 'sticky',\n level: 'column',\n description: 'the \"sticky\" column property (deprecated, use \"pinned\")',\n isUsed: (v) => v === 'left' || v === 'right' || v === 'start' || v === 'end',\n },\n ],\n incompatibleWith: [\n {\n name: 'groupingColumns',\n reason:\n 'Pinning reorders columns to the grid edges, but moving a column out of its column group ' +\n 'is not supported. The group header layout cannot accommodate members at different positions.',\n },\n ],\n queries: [\n {\n type: QUERY_CAN_MOVE_COLUMN,\n description: 'Prevents pinned (sticky) columns from being moved/reordered',\n },\n {\n type: 'getStickyOffsets',\n description: 'Returns the sticky offsets for left/right pinned columns',\n },\n {\n type: 'getContextMenuItems',\n description: 'Contributes pin/unpin items to the header context menu',\n },\n ],\n };\n\n /** @internal */\n readonly name = 'pinnedColumns';\n\n /** @internal */\n protected override get defaultConfig(): Partial<PinnedColumnsConfig> {\n return {};\n }\n\n // #region Internal State\n private isApplied = false;\n private leftOffsets = new Map<string, number>();\n private rightOffsets = new Map<string, number>();\n /**\n * Snapshot of the column field order before the first context-menu pin.\n * Used to restore original positions when unpinning.\n */\n #originalColumnOrder: string[] = [];\n // #endregion\n\n // #region Lifecycle\n\n /** @internal */\n override detach(): void {\n this.leftOffsets.clear();\n this.rightOffsets.clear();\n this.isApplied = false;\n this.#originalColumnOrder = [];\n }\n // #endregion\n\n // #region Detection\n\n /**\n * Auto-detect sticky columns from column configuration.\n */\n static detect(rows: readonly unknown[], config: { columns?: ColumnConfig[] }): boolean {\n const columns = config?.columns;\n if (!Array.isArray(columns)) return false;\n return hasStickyColumns(columns);\n }\n // #endregion\n\n // #region Hooks\n\n /** @internal */\n override processColumns(columns: readonly ColumnConfig[]): ColumnConfig[] {\n const cols = [...columns];\n this.isApplied = hasStickyColumns(cols);\n if (!this.isApplied) return cols;\n\n const host = this.gridElement;\n const direction = host ? getDirection(host) : 'ltr';\n return reorderColumnsForPinning(cols, direction) as ColumnConfig[];\n }\n\n /** @internal */\n override afterRender(): void {\n if (!this.isApplied) {\n return;\n }\n\n const host = this.grid as unknown as HTMLElement;\n const columns = [...this.columns];\n\n if (!hasStickyColumns(columns)) {\n clearStickyOffsets(host);\n this.isApplied = false;\n return;\n }\n\n // Apply sticky offsets after a microtask to ensure DOM is ready\n queueMicrotask(() => {\n applyStickyOffsets(host, columns);\n });\n }\n\n /**\n * Handle inter-plugin queries.\n * @internal\n */\n override handleQuery(query: PluginQuery): unknown {\n switch (query.type) {\n case QUERY_CAN_MOVE_COLUMN: {\n // Prevent pinned columns from being moved/reordered.\n // Pinned columns have fixed positions and should not be draggable.\n const column = query.context as ColumnConfig;\n if (getColumnPinned(column) != null) {\n return false;\n }\n return undefined; // Let other plugins or default behavior decide\n }\n case 'getStickyOffsets': {\n // Return the calculated sticky offsets for column virtualization\n return {\n left: Object.fromEntries(this.leftOffsets),\n right: Object.fromEntries(this.rightOffsets),\n };\n }\n case 'getContextMenuItems': {\n const params = query.context as ContextMenuParams;\n if (!params.isHeader) return undefined;\n\n const column = params.column as ColumnConfig;\n if (!column?.field) return undefined;\n\n // Don't offer pin/unpin for locked-pinning columns\n if (column.meta?.lockPinning) return undefined;\n\n // Don't offer pin/unpin when column grouping is active (incompatible)\n const groupingPlugin = this.grid?.getPluginByName('groupingColumns') as\n | { isGroupingActive(): boolean }\n | undefined;\n if (groupingPlugin?.isGroupingActive()) return undefined;\n\n const pinned = getColumnPinned(column);\n const isPinned = pinned != null;\n const items: HeaderContextMenuItem[] = [];\n\n if (isPinned) {\n items.push({\n id: 'pinned/unpin',\n label: 'Unpin Column',\n icon: '📌',\n order: 40,\n action: () => this.setPinPosition(column.field, undefined),\n });\n } else {\n items.push({\n id: 'pinned/pin-left',\n label: 'Pin Left',\n icon: '⬅',\n order: 40,\n action: () => this.setPinPosition(column.field, 'left'),\n });\n items.push({\n id: 'pinned/pin-right',\n label: 'Pin Right',\n icon: '➡',\n order: 41,\n action: () => this.setPinPosition(column.field, 'right'),\n });\n }\n\n return items;\n }\n default:\n return undefined;\n }\n }\n // #endregion\n\n // #region Public API\n\n /**\n * Set the pin position for a column.\n * Updates the column's `pinned` property and triggers a full re-render.\n *\n * @param field - The field name of the column to pin/unpin\n * @param position - The pin position (`'left'`, `'right'`, `'start'`, `'end'`), or `undefined` to unpin\n */\n setPinPosition(field: string, position: PinnedPosition | undefined): void {\n // Read the currently-visible columns from the plugin accessor.\n // These are the post-processColumns result, which is the authoritative column set.\n const currentColumns = this.columns;\n if (!currentColumns?.length) return;\n\n const currentIndex = currentColumns.findIndex((col) => col.field === field);\n if (currentIndex === -1) return;\n\n const gridEl = this.grid as unknown as HTMLElement & { columns?: ColumnConfig[] };\n\n if (position) {\n // PINNING: snapshot original column order if this is the first context-menu pin.\n // The snapshot lets us restore columns to their original positions on unpin.\n if (this.#originalColumnOrder.length === 0) {\n this.#originalColumnOrder = currentColumns.map((c) => c.field);\n }\n\n // Set the pinned property; processColumns will reorder on next render\n const updated = currentColumns.map((col) => {\n if (col.field !== field) return col;\n const copy = { ...col };\n (copy as ColumnConfig & { pinned?: PinnedPosition }).pinned = position;\n delete (copy as ColumnConfig & { sticky?: PinnedPosition }).sticky;\n return copy;\n });\n\n gridEl.columns = updated;\n } else {\n // UNPINNING: restore column to its original position\n const col = currentColumns[currentIndex];\n const copy = { ...col };\n delete (copy as ColumnConfig & { pinned?: PinnedPosition }).pinned;\n delete (copy as ColumnConfig & { sticky?: PinnedPosition }).sticky;\n\n // Remove from current position\n const remaining = [...currentColumns];\n remaining.splice(currentIndex, 1);\n\n // Find the best insertion point using the original order snapshot\n const originalIndex = this.#originalColumnOrder.indexOf(field);\n if (originalIndex >= 0) {\n // Scan remaining non-pinned columns and find the first whose original\n // position is greater than this column's original position.\n let insertIndex = remaining.length;\n for (let i = 0; i < remaining.length; i++) {\n if (getColumnPinned(remaining[i])) continue; // skip pinned columns\n const otherOriginal = this.#originalColumnOrder.indexOf(remaining[i].field);\n if (otherOriginal > originalIndex) {\n insertIndex = i;\n break;\n }\n }\n remaining.splice(insertIndex, 0, copy);\n } else {\n // Original position unknown — keep at current index\n remaining.splice(Math.min(currentIndex, remaining.length), 0, copy);\n }\n\n // If no more pinned columns remain, clear the snapshot\n if (!remaining.some((c) => getColumnPinned(c) != null)) {\n this.#originalColumnOrder = [];\n }\n\n gridEl.columns = remaining;\n }\n }\n\n /**\n * Re-apply sticky offsets (e.g., after column resize).\n */\n refreshStickyOffsets(): void {\n const columns = [...this.columns];\n applyStickyOffsets(this.grid as unknown as HTMLElement, columns);\n }\n\n /**\n * Get columns pinned to the left (after resolving logical positions for current direction).\n */\n getLeftPinnedColumns(): ColumnConfig[] {\n const columns = [...this.columns];\n const direction = getDirection(this.grid as unknown as HTMLElement);\n return getLeftStickyColumns(columns, direction);\n }\n\n /**\n * Get columns pinned to the right (after resolving logical positions for current direction).\n */\n getRightPinnedColumns(): ColumnConfig[] {\n const columns = [...this.columns];\n const direction = getDirection(this.grid as unknown as HTMLElement);\n return getRightStickyColumns(columns, direction);\n }\n\n /**\n * Clear all sticky positioning.\n */\n clearStickyPositions(): void {\n clearStickyOffsets(this.grid as unknown as HTMLElement);\n }\n\n /**\n * Report horizontal scroll boundary offsets for pinned columns.\n * Used by keyboard navigation to ensure focused cells aren't hidden behind sticky columns.\n * @internal\n */\n override getHorizontalScrollOffsets(\n rowEl?: HTMLElement,\n focusedCell?: HTMLElement,\n ): { left: number; right: number; skipScroll?: boolean } | undefined {\n if (!this.isApplied) {\n return undefined;\n }\n\n let left = 0;\n let right = 0;\n\n if (rowEl) {\n // Calculate from rendered cells in the row\n const stickyLeftCells = rowEl.querySelectorAll('.sticky-left');\n const stickyRightCells = rowEl.querySelectorAll('.sticky-right');\n stickyLeftCells.forEach((el) => {\n left += (el as HTMLElement).offsetWidth;\n });\n stickyRightCells.forEach((el) => {\n right += (el as HTMLElement).offsetWidth;\n });\n } else {\n // Fall back to header row if no row element provided\n const host = this.grid as unknown as HTMLElement;\n const headerCells = host.querySelectorAll('.header-row .cell');\n headerCells.forEach((cell) => {\n if (cell.classList.contains('sticky-left')) {\n left += (cell as HTMLElement).offsetWidth;\n } else if (cell.classList.contains('sticky-right')) {\n right += (cell as HTMLElement).offsetWidth;\n }\n });\n }\n\n // Skip horizontal scrolling if focused cell is pinned (it's always visible)\n const skipScroll =\n focusedCell?.classList.contains('sticky-left') || focusedCell?.classList.contains('sticky-right');\n\n return { left, right, skipScroll };\n }\n // #endregion\n}\n"],"names":["getColumnPinned","col","pinned","sticky","meta","resolveStickyPosition","position","direction","resolveInlinePosition","isResolvedLeft","isResolvedRight","hasStickyColumns","columns","some","applyStickyOffsets","host","headerCells","Array","from","querySelectorAll","length","getDirection","left","cell","find","c","getAttribute","field","classList","add","style","forEach","el","offsetWidth","right","reverse","clearStickyOffsets","remove","QUERY_CAN_MOVE_COLUMN","PinnedColumnsPlugin","BaseGridPlugin","static","ownedProperties","property","level","description","isUsed","v","incompatibleWith","name","reason","queries","type","defaultConfig","isApplied","leftOffsets","Map","rightOffsets","originalColumnOrder","detach","this","clear","detect","rows","config","isArray","processColumns","cols","gridElement","middle","push","reorderColumnsForPinning","afterRender","grid","queueMicrotask","handleQuery","query","context","Object","fromEntries","params","isHeader","column","lockPinning","groupingPlugin","getPluginByName","isGroupingActive","items","id","label","icon","order","action","setPinPosition","currentColumns","currentIndex","findIndex","gridEl","map","updated","copy","remaining","splice","originalIndex","indexOf","insertIndex","i","Math","min","refreshStickyOffsets","getLeftPinnedColumns","filter","getLeftStickyColumns","getRightPinnedColumns","getRightStickyColumns","clearStickyPositions","getHorizontalScrollOffsets","rowEl","focusedCell","stickyLeftCells","stickyRightCells","contains","skipScroll"],"mappings":"oaAqBO,SAASA,EAAgBC,GAC9B,OAAOA,EAAIC,QAAUD,EAAIE,QAAUF,EAAIG,MAAMF,QAAUD,EAAIG,MAAMD,MACnE,CAaO,SAASE,EAAsBC,EAA0BC,GAC9D,OAAOC,EAAAA,sBAAsBF,EAAUC,EACzC,CAKA,SAASE,EAAeR,EAAUM,GAChC,MAAML,EAASF,EAAgBC,GAC/B,QAAKC,GAC+C,SAA7CG,EAAsBH,EAAQK,EACvC,CAKA,SAASG,EAAgBT,EAAUM,GACjC,MAAML,EAASF,EAAgBC,GAC/B,QAAKC,GAC+C,UAA7CG,EAAsBH,EAAQK,EACvC,CA8BO,SAASI,EAAiBC,GAC/B,OAAOA,EAAQC,KAAMZ,GAAgC,MAAxBD,EAAgBC,GAC/C,CA4EO,SAASa,EAAmBC,EAAmBH,GAEpD,MAAMI,EAAcC,MAAMC,KAAKH,EAAKI,iBAAiB,sBACrD,IAAKH,EAAYI,OAAQ,OAGzB,MAAMb,EAAYc,EAAAA,aAAaN,GAG/B,IAAIO,EAAO,EACX,IAAA,MAAWrB,KAAOW,EAChB,GAAIH,EAAeR,EAAKM,GAAY,CAClC,MAAMgB,EAAOP,EAAYQ,KAAMC,GAAMA,EAAEC,aAAa,gBAAkBzB,EAAI0B,OACtEJ,IACFA,EAAKK,UA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CsTW2G,CAFS,IAAItD,KAAKhD,SACPS,EAAAA,aAAauC,KAAKa,MAEtC,CAKA,oBAAA0C,GACE/E,EAAmBwB,KAAKa,KAC1B,CAOS,0BAAA2C,CACPC,EACAC,GAEA,IAAK1D,KAAKN,UACR,OAGF,IAAIhC,EAAO,EACPY,EAAQ,EAEZ,GAAImF,EAAO,CAET,MAAME,EAAkBF,EAAMlG,iBAAiB,gBACzCqG,EAAmBH,EAAMlG,iBAAiB,iBAChDoG,EAAgBxF,QAASC,IACvBV,GAASU,EAAmBC,cAE9BuF,EAAiBzF,QAASC,IACxBE,GAAUF,EAAmBC,aAEjC,KAAO,CAEQ2B,KAAKa,KACOtD,iBAAiB,qBAC9BY,QAASR,IACfA,EAAKK,UAAU6F,SAAS,eAC1BnG,GAASC,EAAqBU,YACrBV,EAAKK,UAAU6F,SAAS,kBACjCvF,GAAUX,EAAqBU,cAGrC,CAGA,MAAMyF,EACJJ,GAAa1F,UAAU6F,SAAS,gBAAkBH,GAAa1F,UAAU6F,SAAS,gBAEpF,MAAO,CAAEnG,OAAMY,QAAOwF,aACxB"}
1
+ {"version":3,"file":"pinned-columns.umd.js","sources":["../../../../../libs/grid/src/lib/plugins/pinned-columns/pinned-columns.ts","../../../../../libs/grid/src/lib/plugins/pinned-columns/PinnedColumnsPlugin.ts"],"sourcesContent":["/**\n * Pinned Columns Core Logic\n *\n * Pure functions for applying pinned (sticky) column positioning.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { getDirection, resolveInlinePosition, type TextDirection } from '../../core/internal/utils';\nimport type { PinnedPosition, ResolvedPinnedPosition } from './types';\n\n// Keep deprecated imports working (StickyPosition = PinnedPosition)\ntype StickyPosition = PinnedPosition;\ntype ResolvedStickyPosition = ResolvedPinnedPosition;\n\n/**\n * Get the effective pinned position from a column, checking `pinned` first then `sticky` (deprecated).\n *\n * @param col - Column configuration object\n * @returns The pinned position, or undefined if not pinned\n */\nexport function getColumnPinned(col: any): PinnedPosition | undefined {\n return col.pinned ?? col.sticky ?? col.meta?.pinned ?? col.meta?.sticky;\n}\n\n/**\n * Resolve a pinned position to a physical position based on text direction.\n *\n * - `'left'` / `'right'` → unchanged (physical values)\n * - `'start'` → `'left'` in LTR, `'right'` in RTL\n * - `'end'` → `'right'` in LTR, `'left'` in RTL\n *\n * @param position - The pinned position (logical or physical)\n * @param direction - Text direction ('ltr' or 'rtl')\n * @returns Physical pinned position ('left' or 'right')\n */\nexport function resolveStickyPosition(position: StickyPosition, direction: TextDirection): ResolvedStickyPosition {\n return resolveInlinePosition(position, direction);\n}\n\n/**\n * Check if a column is pinned on the left (after resolving logical positions).\n */\nfunction isResolvedLeft(col: any, direction: TextDirection): boolean {\n const pinned = getColumnPinned(col);\n if (!pinned) return false;\n return resolveStickyPosition(pinned, direction) === 'left';\n}\n\n/**\n * Check if a column is pinned on the right (after resolving logical positions).\n */\nfunction isResolvedRight(col: any, direction: TextDirection): boolean {\n const pinned = getColumnPinned(col);\n if (!pinned) return false;\n return resolveStickyPosition(pinned, direction) === 'right';\n}\n\n/**\n * Get columns that should be sticky on the left.\n *\n * @param columns - Array of column configurations\n * @param direction - Text direction (default: 'ltr')\n * @returns Array of columns with sticky='left' or sticky='start' (in LTR)\n */\nexport function getLeftStickyColumns(columns: any[], direction: TextDirection = 'ltr'): any[] {\n return columns.filter((col) => isResolvedLeft(col, direction));\n}\n\n/**\n * Get columns that should be sticky on the right.\n *\n * @param columns - Array of column configurations\n * @param direction - Text direction (default: 'ltr')\n * @returns Array of columns with sticky='right' or sticky='end' (in LTR)\n */\nexport function getRightStickyColumns(columns: any[], direction: TextDirection = 'ltr'): any[] {\n return columns.filter((col) => isResolvedRight(col, direction));\n}\n\n/**\n * Check if any columns have sticky positioning.\n *\n * @param columns - Array of column configurations\n * @returns True if any column has sticky position\n */\nexport function hasStickyColumns(columns: any[]): boolean {\n return columns.some((col) => getColumnPinned(col) != null);\n}\n\n/**\n * Get the sticky position of a column.\n *\n * @param column - Column configuration\n * @returns The sticky position or null if not sticky\n */\nexport function getColumnStickyPosition(column: any): StickyPosition | null {\n return getColumnPinned(column) ?? null;\n}\n\n\n/**\n * Calculate left offsets for sticky-left columns.\n * Returns a map of field -> offset in pixels.\n *\n * @param columns - Array of column configurations (in order)\n * @param getColumnWidth - Function to get column width by field\n * @param direction - Text direction (default: 'ltr')\n * @returns Map of field to left offset\n */\nexport function calculateLeftStickyOffsets(\n columns: any[],\n getColumnWidth: (field: string) => number,\n direction: TextDirection = 'ltr',\n): Map<string, number> {\n const offsets = new Map<string, number>();\n let currentOffset = 0;\n\n for (const col of columns) {\n if (isResolvedLeft(col, direction)) {\n offsets.set(col.field, currentOffset);\n currentOffset += getColumnWidth(col.field);\n }\n }\n\n return offsets;\n}\n\n/**\n * Calculate right offsets for sticky-right columns.\n * Processes columns in reverse order.\n *\n * @param columns - Array of column configurations (in order)\n * @param getColumnWidth - Function to get column width by field\n * @param direction - Text direction (default: 'ltr')\n * @returns Map of field to right offset\n */\nexport function calculateRightStickyOffsets(\n columns: any[],\n getColumnWidth: (field: string) => number,\n direction: TextDirection = 'ltr',\n): Map<string, number> {\n const offsets = new Map<string, number>();\n let currentOffset = 0;\n\n // Process in reverse for right-sticky columns\n const reversed = [...columns].reverse();\n for (const col of reversed) {\n if (isResolvedRight(col, direction)) {\n offsets.set(col.field, currentOffset);\n currentOffset += getColumnWidth(col.field);\n }\n }\n\n return offsets;\n}\n\n/**\n * Apply sticky offsets to header and body cells.\n * This modifies the DOM elements in place.\n *\n * @param host - The grid host element (render root for DOM queries)\n * @param columns - Array of column configurations\n */\nexport function applyStickyOffsets(host: HTMLElement, columns: any[]): void {\n // With light DOM, query the host element directly\n const headerCells = Array.from(host.querySelectorAll('.header-row .cell')) as HTMLElement[];\n if (!headerCells.length) return;\n\n // Detect text direction from the host element\n const direction = getDirection(host);\n\n // Apply left sticky (includes 'start' in LTR, 'end' in RTL)\n let left = 0;\n for (const col of columns) {\n if (isResolvedLeft(col, direction)) {\n const cell = headerCells.find((c) => c.getAttribute('data-field') === col.field);\n if (cell) {\n cell.classList.add('sticky-left');\n cell.style.position = 'sticky';\n cell.style.left = left + 'px';\n // Body cells: use data-field for reliable matching (data-col indices may differ\n // between _columns and _visibleColumns due to hidden/utility columns)\n host.querySelectorAll(`.data-grid-row .cell[data-field=\"${col.field}\"]`).forEach((el) => {\n el.classList.add('sticky-left');\n (el as HTMLElement).style.position = 'sticky';\n (el as HTMLElement).style.left = left + 'px';\n });\n left += cell.offsetWidth;\n }\n }\n }\n\n // Apply right sticky (includes 'end' in LTR, 'start' in RTL) - process in reverse\n let right = 0;\n for (const col of [...columns].reverse()) {\n if (isResolvedRight(col, direction)) {\n const cell = headerCells.find((c) => c.getAttribute('data-field') === col.field);\n if (cell) {\n cell.classList.add('sticky-right');\n cell.style.position = 'sticky';\n cell.style.right = right + 'px';\n // Body cells: use data-field for reliable matching\n host.querySelectorAll(`.data-grid-row .cell[data-field=\"${col.field}\"]`).forEach((el) => {\n el.classList.add('sticky-right');\n (el as HTMLElement).style.position = 'sticky';\n (el as HTMLElement).style.right = right + 'px';\n });\n right += cell.offsetWidth;\n }\n }\n }\n}\n\n/**\n * Reorder columns so that pinned-left columns come first and pinned-right columns come last.\n * Maintains the relative order within each group (left-pinned, unpinned, right-pinned).\n *\n * @param columns - Array of column configurations (in their current order)\n * @param direction - Text direction ('ltr' or 'rtl'), used to resolve logical positions\n * @returns New array with pinned columns moved to the edges\n */\nexport function reorderColumnsForPinning(columns: readonly any[], direction: TextDirection = 'ltr'): any[] {\n const left: any[] = [];\n const middle: any[] = [];\n const right: any[] = [];\n\n for (const col of columns) {\n const pinned = getColumnPinned(col);\n if (pinned) {\n const resolved = resolveStickyPosition(pinned, direction);\n if (resolved === 'left') left.push(col);\n else right.push(col);\n } else {\n middle.push(col);\n }\n }\n\n return [...left, ...middle, ...right];\n}\n\n/**\n * Clear sticky positioning from all cells.\n *\n * @param host - The grid host element (render root for DOM queries)\n */\nexport function clearStickyOffsets(host: HTMLElement): void {\n // With light DOM, query the host element directly\n const cells = host.querySelectorAll('.sticky-left, .sticky-right');\n cells.forEach((cell) => {\n cell.classList.remove('sticky-left', 'sticky-right');\n (cell as HTMLElement).style.position = '';\n (cell as HTMLElement).style.left = '';\n (cell as HTMLElement).style.right = '';\n });\n}\n","/**\n * Pinned Columns Plugin (Class-based)\n *\n * Enables column pinning (sticky left/right positioning).\n */\n\nimport { getDirection } from '../../core/internal/utils';\nimport type { PluginManifest, PluginQuery } from '../../core/plugin/base-plugin';\nimport { BaseGridPlugin } from '../../core/plugin/base-plugin';\nimport type { ColumnConfig } from '../../core/types';\nimport type { ContextMenuParams, HeaderContextMenuItem } from '../context-menu/types';\nimport {\n applyStickyOffsets,\n clearStickyOffsets,\n getColumnPinned,\n getLeftStickyColumns,\n getRightStickyColumns,\n hasStickyColumns,\n reorderColumnsForPinning,\n} from './pinned-columns';\nimport type { PinnedColumnsConfig, PinnedPosition } from './types';\n\n/** Query type constant for checking if a column can be moved */\nconst QUERY_CAN_MOVE_COLUMN = 'canMoveColumn';\n\n/**\n * Pinned Columns Plugin for tbw-grid\n *\n * Freezes columns to the left or right edge of the grid—essential for keeping key\n * identifiers or action buttons visible while scrolling through wide datasets. Just set\n * `pinned: 'left'` or `pinned: 'right'` on your column definitions.\n *\n * ## Installation\n *\n * ```ts\n * import { PinnedColumnsPlugin } from '@toolbox-web/grid/plugins/pinned-columns';\n * ```\n *\n * ## Column Configuration\n *\n * | Property | Type | Description |\n * |----------|------|-------------|\n * | `pinned` | `'left' \\| 'right' \\| 'start' \\| 'end'` | Pin column to edge (logical or physical) |\n * | `meta.lockPinning` | `boolean` | `false` | Prevent user from pin/unpin via context menu |\n *\n * ### RTL Support\n *\n * Use logical values (`start`/`end`) for grids that work in both LTR and RTL layouts:\n * - `'start'` - Pins to left in LTR, right in RTL\n * - `'end'` - Pins to right in LTR, left in RTL\n *\n * ## CSS Custom Properties\n *\n * | Property | Default | Description |\n * |----------|---------|-------------|\n * | `--tbw-pinned-shadow` | `4px 0 8px rgba(0,0,0,0.1)` | Shadow on pinned column edge |\n * | `--tbw-pinned-border` | `var(--tbw-color-border)` | Border between pinned and scrollable |\n *\n * @example Pin ID Left and Actions Right\n * ```ts\n * import '@toolbox-web/grid';\n * import { PinnedColumnsPlugin } from '@toolbox-web/grid/plugins/pinned-columns';\n *\n * const grid = document.querySelector('tbw-grid');\n * grid.gridConfig = {\n * columns: [\n * { field: 'id', header: 'ID', pinned: 'left', width: 80 },\n * { field: 'name', header: 'Name' },\n * { field: 'email', header: 'Email' },\n * { field: 'department', header: 'Department' },\n * { field: 'actions', header: 'Actions', pinned: 'right', width: 120 },\n * ],\n * plugins: [new PinnedColumnsPlugin()],\n * };\n * ```\n *\n * @example RTL-Compatible Pinning\n * ```ts\n * // Same config works in LTR and RTL\n * grid.gridConfig = {\n * columns: [\n * { field: 'id', header: 'ID', pinned: 'start' }, // Left in LTR, Right in RTL\n * { field: 'name', header: 'Name' },\n * { field: 'actions', header: 'Actions', pinned: 'end' }, // Right in LTR, Left in RTL\n * ],\n * plugins: [new PinnedColumnsPlugin()],\n * };\n * ```\n *\n * @see {@link PinnedColumnsConfig} for configuration options\n *\n * @internal Extends BaseGridPlugin\n */\nexport class PinnedColumnsPlugin extends BaseGridPlugin<PinnedColumnsConfig> {\n /**\n * Plugin manifest - declares owned properties and handled queries.\n * @internal\n */\n static override readonly manifest: PluginManifest = {\n ownedProperties: [\n {\n property: 'pinned',\n level: 'column',\n description: 'the \"pinned\" column property',\n isUsed: (v) => v === 'left' || v === 'right' || v === 'start' || v === 'end',\n },\n {\n property: 'sticky',\n level: 'column',\n description: 'the \"sticky\" column property (deprecated, use \"pinned\")',\n isUsed: (v) => v === 'left' || v === 'right' || v === 'start' || v === 'end',\n },\n ],\n incompatibleWith: [\n {\n name: 'groupingColumns',\n reason:\n 'Pinning reorders columns to the grid edges, but moving a column out of its column group ' +\n 'is not supported. The group header layout cannot accommodate members at different positions.',\n },\n ],\n queries: [\n {\n type: QUERY_CAN_MOVE_COLUMN,\n description: 'Prevents pinned (sticky) columns from being moved/reordered',\n },\n {\n type: 'getStickyOffsets',\n description: 'Returns the sticky offsets for left/right pinned columns',\n },\n {\n type: 'getContextMenuItems',\n description: 'Contributes pin/unpin items to the header context menu',\n },\n ],\n };\n\n /** @internal */\n readonly name = 'pinnedColumns';\n\n /** @internal */\n protected override get defaultConfig(): Partial<PinnedColumnsConfig> {\n return {};\n }\n\n // #region Internal State\n private isApplied = false;\n private leftOffsets = new Map<string, number>();\n private rightOffsets = new Map<string, number>();\n /**\n * Snapshot of the column field order before the first context-menu pin.\n * Used to restore original positions when unpinning.\n */\n #originalColumnOrder: string[] = [];\n // #endregion\n\n // #region Lifecycle\n\n /** @internal */\n override detach(): void {\n this.leftOffsets.clear();\n this.rightOffsets.clear();\n this.isApplied = false;\n this.#originalColumnOrder = [];\n }\n // #endregion\n\n // #region Detection\n\n /**\n * Auto-detect sticky columns from column configuration.\n */\n static detect(rows: readonly unknown[], config: { columns?: ColumnConfig[] }): boolean {\n const columns = config?.columns;\n if (!Array.isArray(columns)) return false;\n return hasStickyColumns(columns);\n }\n // #endregion\n\n // #region Hooks\n\n /** @internal */\n override processColumns(columns: readonly ColumnConfig[]): ColumnConfig[] {\n const cols = [...columns];\n this.isApplied = hasStickyColumns(cols);\n if (!this.isApplied) return cols;\n\n const host = this.gridElement;\n const direction = host ? getDirection(host) : 'ltr';\n return reorderColumnsForPinning(cols, direction) as ColumnConfig[];\n }\n\n /** @internal */\n override afterRender(): void {\n if (!this.isApplied) {\n return;\n }\n\n const host = this.gridElement;\n const columns = [...this.columns];\n\n if (!hasStickyColumns(columns)) {\n clearStickyOffsets(host);\n this.isApplied = false;\n return;\n }\n\n // Apply sticky offsets after a microtask to ensure DOM is ready\n queueMicrotask(() => {\n applyStickyOffsets(host, columns);\n });\n }\n\n /**\n * Handle inter-plugin queries.\n * @internal\n */\n override handleQuery(query: PluginQuery): unknown {\n switch (query.type) {\n case QUERY_CAN_MOVE_COLUMN: {\n // Prevent pinned columns from being moved/reordered.\n // Pinned columns have fixed positions and should not be draggable.\n const column = query.context as ColumnConfig;\n if (getColumnPinned(column) != null) {\n return false;\n }\n return undefined; // Let other plugins or default behavior decide\n }\n case 'getStickyOffsets': {\n // Return the calculated sticky offsets for column virtualization\n return {\n left: Object.fromEntries(this.leftOffsets),\n right: Object.fromEntries(this.rightOffsets),\n };\n }\n case 'getContextMenuItems': {\n const params = query.context as ContextMenuParams;\n if (!params.isHeader) return undefined;\n\n const column = params.column as ColumnConfig;\n if (!column?.field) return undefined;\n\n // Don't offer pin/unpin for locked-pinning columns\n if (column.meta?.lockPinning) return undefined;\n\n // Don't offer pin/unpin when column grouping is active (incompatible)\n const groupingPlugin = this.grid?.getPluginByName('groupingColumns') as\n | { isGroupingActive(): boolean }\n | undefined;\n if (groupingPlugin?.isGroupingActive()) return undefined;\n\n const pinned = getColumnPinned(column);\n const isPinned = pinned != null;\n const items: HeaderContextMenuItem[] = [];\n\n if (isPinned) {\n items.push({\n id: 'pinned/unpin',\n label: 'Unpin Column',\n icon: '📌',\n order: 40,\n action: () => this.setPinPosition(column.field, undefined),\n });\n } else {\n items.push({\n id: 'pinned/pin-left',\n label: 'Pin Left',\n icon: '⬅',\n order: 40,\n action: () => this.setPinPosition(column.field, 'left'),\n });\n items.push({\n id: 'pinned/pin-right',\n label: 'Pin Right',\n icon: '➡',\n order: 41,\n action: () => this.setPinPosition(column.field, 'right'),\n });\n }\n\n return items;\n }\n default:\n return undefined;\n }\n }\n // #endregion\n\n // #region Public API\n\n /**\n * Set the pin position for a column.\n * Updates the column's `pinned` property and triggers a full re-render.\n *\n * @param field - The field name of the column to pin/unpin\n * @param position - The pin position (`'left'`, `'right'`, `'start'`, `'end'`), or `undefined` to unpin\n */\n setPinPosition(field: string, position: PinnedPosition | undefined): void {\n // Read the currently-visible columns from the plugin accessor.\n // These are the post-processColumns result, which is the authoritative column set.\n const currentColumns = this.columns;\n if (!currentColumns?.length) return;\n\n const currentIndex = currentColumns.findIndex((col) => col.field === field);\n if (currentIndex === -1) return;\n\n const gridEl = this.gridElement as HTMLElement & { columns?: ColumnConfig[] };\n\n if (position) {\n // PINNING: snapshot original column order if this is the first context-menu pin.\n // The snapshot lets us restore columns to their original positions on unpin.\n if (this.#originalColumnOrder.length === 0) {\n this.#originalColumnOrder = currentColumns.map((c) => c.field);\n }\n\n // Set the pinned property; processColumns will reorder on next render\n const updated = currentColumns.map((col) => {\n if (col.field !== field) return col;\n const copy = { ...col };\n (copy as ColumnConfig & { pinned?: PinnedPosition }).pinned = position;\n delete (copy as ColumnConfig & { sticky?: PinnedPosition }).sticky;\n return copy;\n });\n\n gridEl.columns = updated;\n } else {\n // UNPINNING: restore column to its original position\n const col = currentColumns[currentIndex];\n const copy = { ...col };\n delete (copy as ColumnConfig & { pinned?: PinnedPosition }).pinned;\n delete (copy as ColumnConfig & { sticky?: PinnedPosition }).sticky;\n\n // Remove from current position\n const remaining = [...currentColumns];\n remaining.splice(currentIndex, 1);\n\n // Find the best insertion point using the original order snapshot\n const originalIndex = this.#originalColumnOrder.indexOf(field);\n if (originalIndex >= 0) {\n // Scan remaining non-pinned columns and find the first whose original\n // position is greater than this column's original position.\n let insertIndex = remaining.length;\n for (let i = 0; i < remaining.length; i++) {\n if (getColumnPinned(remaining[i])) continue; // skip pinned columns\n const otherOriginal = this.#originalColumnOrder.indexOf(remaining[i].field);\n if (otherOriginal > originalIndex) {\n insertIndex = i;\n break;\n }\n }\n remaining.splice(insertIndex, 0, copy);\n } else {\n // Original position unknown — keep at current index\n remaining.splice(Math.min(currentIndex, remaining.length), 0, copy);\n }\n\n // If no more pinned columns remain, clear the snapshot\n if (!remaining.some((c) => getColumnPinned(c) != null)) {\n this.#originalColumnOrder = [];\n }\n\n gridEl.columns = remaining;\n }\n }\n\n /**\n * Re-apply sticky offsets (e.g., after column resize).\n */\n refreshStickyOffsets(): void {\n const columns = [...this.columns];\n applyStickyOffsets(this.gridElement, columns);\n }\n\n /**\n * Get columns pinned to the left (after resolving logical positions for current direction).\n */\n getLeftPinnedColumns(): ColumnConfig[] {\n const columns = [...this.columns];\n const direction = getDirection(this.gridElement);\n return getLeftStickyColumns(columns, direction);\n }\n\n /**\n * Get columns pinned to the right (after resolving logical positions for current direction).\n */\n getRightPinnedColumns(): ColumnConfig[] {\n const columns = [...this.columns];\n const direction = getDirection(this.gridElement);\n return getRightStickyColumns(columns, direction);\n }\n\n /**\n * Clear all sticky positioning.\n */\n clearStickyPositions(): void {\n clearStickyOffsets(this.gridElement);\n }\n\n /**\n * Report horizontal scroll boundary offsets for pinned columns.\n * Used by keyboard navigation to ensure focused cells aren't hidden behind sticky columns.\n * @internal\n */\n override getHorizontalScrollOffsets(\n rowEl?: HTMLElement,\n focusedCell?: HTMLElement,\n ): { left: number; right: number; skipScroll?: boolean } | undefined {\n if (!this.isApplied) {\n return undefined;\n }\n\n let left = 0;\n let right = 0;\n\n if (rowEl) {\n // Calculate from rendered cells in the row\n const stickyLeftCells = rowEl.querySelectorAll('.sticky-left');\n const stickyRightCells = rowEl.querySelectorAll('.sticky-right');\n stickyLeftCells.forEach((el) => {\n left += (el as HTMLElement).offsetWidth;\n });\n stickyRightCells.forEach((el) => {\n right += (el as HTMLElement).offsetWidth;\n });\n } else {\n // Fall back to header row if no row element provided\n const host = this.gridElement;\n const headerCells = host.querySelectorAll('.header-row .cell');\n headerCells.forEach((cell) => {\n if (cell.classList.contains('sticky-left')) {\n left += (cell as HTMLElement).offsetWidth;\n } else if (cell.classList.contains('sticky-right')) {\n right += (cell as HTMLElement).offsetWidth;\n }\n });\n }\n\n // Skip horizontal scrolling if focused cell is pinned (it's always visible)\n const skipScroll =\n focusedCell?.classList.contains('sticky-left') || focusedCell?.classList.contains('sticky-right');\n\n return { left, right, skipScroll };\n }\n // #endregion\n}\n"],"names":["getColumnPinned","col","pinned","sticky","meta","resolveStickyPosition","position","direction","resolveInlinePosition","isResolvedLeft","isResolvedRight","hasStickyColumns","columns","some","applyStickyOffsets","host","headerCells","Array","from","querySelectorAll","length","getDirection","left","cell","find","c","getAttribute","field","classList","add","style","forEach","el","offsetWidth","right","reverse","clearStickyOffsets","remove","QUERY_CAN_MOVE_COLUMN","PinnedColumnsPlugin","BaseGridPlugin","static","ownedProperties","property","level","description","isUsed","v","incompatibleWith","name","reason","queries","type","defaultConfig","isApplied","leftOffsets","Map","rightOffsets","originalColumnOrder","detach","this","clear","detect","rows","config","isArray","processColumns","cols","gridElement","middle","push","reorderColumnsForPinning","afterRender","queueMicrotask","handleQuery","query","context","Object","fromEntries","params","isHeader","column","lockPinning","groupingPlugin","grid","getPluginByName","isGroupingActive","items","id","label","icon","order","action","setPinPosition","currentColumns","currentIndex","findIndex","gridEl","map","updated","copy","remaining","splice","originalIndex","indexOf","insertIndex","i","Math","min","refreshStickyOffsets","getLeftPinnedColumns","filter","getLeftStickyColumns","getRightPinnedColumns","getRightStickyColumns","clearStickyPositions","getHorizontalScrollOffsets","rowEl","focusedCell","stickyLeftCells","stickyRightCells","contains","skipScroll"],"mappings":"oaAqBO,SAASA,EAAgBC,GAC9B,OAAOA,EAAIC,QAAUD,EAAIE,QAAUF,EAAIG,MAAMF,QAAUD,EAAIG,MAAMD,MACnE,CAaO,SAASE,EAAsBC,EAA0BC,GAC9D,OAAOC,EAAAA,sBAAsBF,EAAUC,EACzC,CAKA,SAASE,EAAeR,EAAUM,GAChC,MAAML,EAASF,EAAgBC,GAC/B,QAAKC,GAC+C,SAA7CG,EAAsBH,EAAQK,EACvC,CAKA,SAASG,EAAgBT,EAAUM,GACjC,MAAML,EAASF,EAAgBC,GAC/B,QAAKC,GAC+C,UAA7CG,EAAsBH,EAAQK,EACvC,CA8BO,SAASI,EAAiBC,GAC/B,OAAOA,EAAQC,KAAMZ,GAAgC,MAAxBD,EAAgBC,GAC/C,CA4EO,SAASa,EAAmBC,EAAmBH,GAEpD,MAAMI,EAAcC,MAAMC,KAAKH,EAAKI,iBAAiB,sBACrD,IAAKH,EAAYI,OAAQ,OA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OAAQ9G,GAAQQ,EAAeR,EAAKM,GACrD,CCwTWyG,CAFS,IAAIpD,KAAKhD,SACPS,EAAAA,aAAauC,KAAKQ,aAEtC,CAKA,qBAAA6C,GAGE,ODxTG,SAA+BrG,EAAgBL,EAA2B,OAC/E,OAAOK,EAAQmG,OAAQ9G,GAAQS,EAAgBT,EAAKM,GACtD,CCsTW2G,CAFS,IAAItD,KAAKhD,SACPS,EAAAA,aAAauC,KAAKQ,aAEtC,CAKA,oBAAA+C,GACE/E,EAAmBwB,KAAKQ,YAC1B,CAOS,0BAAAgD,CACPC,EACAC,GAEA,IAAK1D,KAAKN,UACR,OAGF,IAAIhC,EAAO,EACPY,EAAQ,EAEZ,GAAImF,EAAO,CAET,MAAME,EAAkBF,EAAMlG,iBAAiB,gBACzCqG,EAAmBH,EAAMlG,iBAAiB,iBAChDoG,EAAgBxF,QAASC,IACvBV,GAASU,EAAmBC,cAE9BuF,EAAiBzF,QAASC,IACxBE,GAAUF,EAAmBC,aAEjC,KAAO,CAEQ2B,KAAKQ,YACOjD,iBAAiB,qBAC9BY,QAASR,IACfA,EAAKK,UAAU6F,SAAS,eAC1BnG,GAASC,EAAqBU,YACrBV,EAAKK,UAAU6F,SAAS,kBACjCvF,GAAUX,EAAqBU,cAGrC,CAGA,MAAMyF,EACJJ,GAAa1F,UAAU6F,SAAS,gBAAkBH,GAAa1F,UAAU6F,SAAS,gBAEpF,MAAO,CAAEnG,OAAMY,QAAOwF,aACxB"}
@@ -1,2 +1,2 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("../../core/plugin/base-plugin"),require("../../core/internal/aggregators")):"function"==typeof define&&define.amd?define(["exports","../../core/plugin/base-plugin","../../core/internal/aggregators"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).TbwGridPlugin_pinnedRows={},t.TbwGrid,t.TbwGrid)}(this,function(t,e,n){"use strict";function o(t,e){const n=document.createElement("div");n.className="tbw-pinned-rows",n.setAttribute("role","presentation"),n.setAttribute("aria-live","polite");const o=document.createElement("div");o.className="tbw-pinned-rows-left";const i=document.createElement("div");i.className="tbw-pinned-rows-center";const r=document.createElement("div");if(r.className="tbw-pinned-rows-right",!1!==t.showRowCount){const t=document.createElement("span");t.className="tbw-status-panel tbw-status-panel-row-count",t.textContent=`Total: ${e.totalRows} rows`,o.appendChild(t)}if(t.showFilteredCount&&e.filteredRows!==e.totalRows){const t=document.createElement("span");t.className="tbw-status-panel tbw-status-panel-filtered-count",t.textContent=`Filtered: ${e.filteredRows}`,o.appendChild(t)}if(t.showSelectedCount&&e.selectedRows>0){const t=document.createElement("span");t.className="tbw-status-panel tbw-status-panel-selected-count",t.textContent=`Selected: ${e.selectedRows}`,r.appendChild(t)}if(t.customPanels)for(const a of t.customPanels){const t=g(a,e);switch(a.position){case"left":o.appendChild(t);break;case"center":i.appendChild(t);break;case"right":r.appendChild(t)}}return n.appendChild(o),n.appendChild(i),n.appendChild(r),n}function i(t){const e=document.createElement("div");return e.className=`tbw-aggregation-rows tbw-aggregation-rows-${t}`,e.setAttribute("role","presentation"),e}function r(t,e,n,o,i=!1){t.innerHTML="";for(const r of e){const e=document.createElement("div");e.className="tbw-aggregation-row",e.setAttribute("role","presentation"),r.id&&e.setAttribute("data-aggregation-id",r.id);r.fullWidth??i?a(e,r,n,o):s(e,r,n,o),t.appendChild(e)}}function a(t,e,n,o){const i=document.createElement("div");i.className="tbw-aggregation-cell tbw-aggregation-cell-full",i.style.gridColumn="1 / -1";const r="function"==typeof e.label?e.label(o,n):e.label;if(r){const t=document.createElement("span");t.className="tbw-aggregation-label",t.textContent=r,i.appendChild(t)}const a=function(t,e,n){const o=t.aggregators&&Object.keys(t.aggregators).length>0,i=t.cells&&Object.keys(t.cells).length>0;if(!o&&!i)return null;const r=document.createElement("span");r.className="tbw-aggregation-aggregates";for(const a of e){const{value:e,formatter:o}=l(t,a,n);if(null!=e){const t=document.createElement("span");t.className="tbw-aggregation-aggregate",t.setAttribute("data-field",a.field);const n=a.header??a.field,i=o?o(e,a.field,a):String(e);t.textContent=`${n}: ${i}`,r.appendChild(t)}}return r.children.length>0?r:null}(e,n,o);a&&i.appendChild(a),t.appendChild(i)}function s(t,e,n,o){for(const i of n){const n=document.createElement("div");n.className="tbw-aggregation-cell",n.setAttribute("data-field",i.field);const{value:r,formatter:a}=l(e,i,o);n.textContent=null!=r?a?a(r,i.field,i):String(r):"",t.appendChild(n)}}function l(t,e,o){let i,r;const a=t.aggregators?.[e.field];if(a)if("object"==typeof(s=a)&&null!==s&&"aggFunc"in s){const t=n.getAggregator(a.aggFunc);t&&(i=t(o,e.field,e)),r=a.formatter}else{const t=n.getAggregator(a);t&&(i=t(o,e.field,e))}else if(t.cells&&Object.prototype.hasOwnProperty.call(t.cells,e.field)){const n=t.cells[e.field];i="function"==typeof n?n(o,e.field,e):n}var s;return{value:i,formatter:r}}function g(t,e){const n=document.createElement("div");n.className="tbw-status-panel tbw-status-panel-custom",n.id=`status-panel-${t.id}`;const o=t.render(e);return"string"==typeof o?n.innerHTML=o:n.appendChild(o),n}function c(t,e,n,o,i){return{totalRows:t.length,filteredRows:i?.cachedResult?.length??t.length,selectedRows:o?.selected?.size??0,columns:e,rows:t,grid:n}}class d extends e.BaseGridPlugin{name="pinnedRows";styles="@layer tbw-plugins{.tbw-footer{flex-shrink:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-color-panel-bg)}.tbw-pinned-rows{display:flex;align-items:center;justify-content:space-between;padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));background:var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));border-top:1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));min-height:32px;box-sizing:border-box;min-width:fit-content}.tbw-pinned-rows-left,.tbw-pinned-rows-center,.tbw-pinned-rows-right{display:flex;align-items:center;gap:var(--tbw-spacing-xl, 1rem)}.tbw-pinned-rows-left{justify-content:flex-start}.tbw-pinned-rows-center{justify-content:center;flex:1}.tbw-pinned-rows-right{justify-content:flex-end}.tbw-status-panel{white-space:nowrap}.tbw-aggregation-rows{min-width:fit-content;background:var(--tbw-aggregation-bg, var(--tbw-color-header-bg))}.tbw-aggregation-rows-top{border-bottom:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-rows-bottom{border-top:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-row{display:grid;grid-template-columns:var(--tbw-column-template);font-size:var(--tbw-aggregation-font-size, .8em);font-weight:var(--tbw-aggregation-font-weight, 600)}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, .125rem .5rem);min-height:var(--tbw-row-height, 1.75rem);display:block;align-items:center;align-content:center;border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;text-overflow:ellipsis;white-space:var(--tbw-cell-white-space, nowrap)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0;display:flex;align-items:center;gap:var(--tbw-spacing-lg, .75rem)}.tbw-aggregation-label{white-space:nowrap}.tbw-aggregation-aggregates{display:flex;align-items:center;gap:var(--tbw-spacing-lg, .75rem);font-weight:400;opacity:.85}.tbw-aggregation-aggregate{white-space:nowrap}}";get defaultConfig(){return{position:"bottom",showRowCount:!0,showSelectedCount:!0,showFilteredCount:!0}}infoBarElement=null;topAggregationContainer=null;bottomAggregationContainer=null;footerWrapper=null;detach(){this.infoBarElement&&(this.infoBarElement.remove(),this.infoBarElement=null),this.topAggregationContainer&&(this.topAggregationContainer.remove(),this.topAggregationContainer=null),this.bottomAggregationContainer&&(this.bottomAggregationContainer.remove(),this.bottomAggregationContainer=null),this.footerWrapper&&(this.footerWrapper.remove(),this.footerWrapper=null)}afterRender(){const t=this.gridElement;if(!t)return;const e=t.querySelector(".tbw-scroll-area")??t.querySelector(".tbw-grid-content")??t.children[0];if(!e)return;this.footerWrapper&&!e.contains(this.footerWrapper)&&(this.footerWrapper=null,this.bottomAggregationContainer=null,this.infoBarElement=null),this.topAggregationContainer&&!e.contains(this.topAggregationContainer)&&(this.topAggregationContainer=null),this.infoBarElement&&!e.contains(this.infoBarElement)&&(this.infoBarElement=null);const n=this.getSelectionState(),a=this.getFilterState(),s=c(this.sourceRows,this.columns,this.grid,n,a),l=this.config.aggregationRows||[],g=l.filter(t=>"top"===t.position),d=l.filter(t=>"top"!==t.position);if(g.length>0){if(!this.topAggregationContainer){this.topAggregationContainer=i("top");const n=t.querySelector(".header");n&&n.nextSibling?e.insertBefore(this.topAggregationContainer,n.nextSibling):e.appendChild(this.topAggregationContainer)}r(this.topAggregationContainer,g,this.visibleColumns,this.sourceRows,this.config.fullWidth)}else this.topAggregationContainer&&(this.topAggregationContainer.remove(),this.topAggregationContainer=null);const p=!1!==this.config.showRowCount||this.config.showSelectedCount&&s.selectedRows>0||this.config.showFilteredCount&&s.filteredRows!==s.totalRows||this.config.customPanels&&this.config.customPanels.length>0,h=p&&"top"!==this.config.position,f=d.length>0||h;if(p&&"top"===this.config.position)if(this.infoBarElement){const t=o(this.config,s);this.infoBarElement.replaceWith(t),this.infoBarElement=t}else this.infoBarElement=o(this.config,s),e.insertBefore(this.infoBarElement,e.firstChild);else"top"===this.config.position&&this.infoBarElement&&(this.infoBarElement.remove(),this.infoBarElement=null);f?(this.footerWrapper||(this.footerWrapper=document.createElement("div"),this.footerWrapper.className="tbw-footer",e.appendChild(this.footerWrapper)),this.footerWrapper.innerHTML="",d.length>0&&(this.bottomAggregationContainer||(this.bottomAggregationContainer=i("bottom")),this.footerWrapper.appendChild(this.bottomAggregationContainer),r(this.bottomAggregationContainer,d,this.visibleColumns,this.sourceRows,this.config.fullWidth)),h&&(this.infoBarElement=o(this.config,s),this.footerWrapper.appendChild(this.infoBarElement))):this.cleanupFooter()}cleanup(){this.infoBarElement&&(this.infoBarElement.remove(),this.infoBarElement=null),this.topAggregationContainer&&(this.topAggregationContainer.remove(),this.topAggregationContainer=null),this.bottomAggregationContainer&&(this.bottomAggregationContainer.remove(),this.bottomAggregationContainer=null),this.footerWrapper&&(this.footerWrapper.remove(),this.footerWrapper=null)}cleanupFooter(){this.footerWrapper&&(this.footerWrapper.remove(),this.footerWrapper=null),this.bottomAggregationContainer&&(this.bottomAggregationContainer.remove(),this.bottomAggregationContainer=null),this.infoBarElement&&"top"!==this.config.position&&(this.infoBarElement.remove(),this.infoBarElement=null)}getSelectionState(){try{return this.grid?.getPluginState?.("selection")??null}catch{return null}}getFilterState(){try{return this.grid?.getPluginState?.("filtering")??null}catch{return null}}refresh(){this.requestRender()}getContext(){const t=this.getSelectionState(),e=this.getFilterState();return c(this.rows,this.columns,this.grid,t,e)}addPanel(t){this.config.customPanels||(this.config.customPanels=[]),this.config.customPanels.push(t),this.requestRender()}removePanel(t){this.config.customPanels&&(this.config.customPanels=this.config.customPanels.filter(e=>e.id!==t),this.requestRender())}addAggregationRow(t){this.config.aggregationRows||(this.config.aggregationRows=[]),this.config.aggregationRows.push(t),this.requestRender()}removeAggregationRow(t){this.config.aggregationRows&&(this.config.aggregationRows=this.config.aggregationRows.filter(e=>e.id!==t),this.requestRender())}}t.PinnedRowsPlugin=d,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("../../core/plugin/base-plugin"),require("../../core/internal/aggregators")):"function"==typeof define&&define.amd?define(["exports","../../core/plugin/base-plugin","../../core/internal/aggregators"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).TbwGridPlugin_pinnedRows={},t.TbwGrid,t.TbwGrid)}(this,function(t,e,n){"use strict";function o(t,e){const n=document.createElement("div");n.className="tbw-pinned-rows",n.setAttribute("role","presentation"),n.setAttribute("aria-live","polite");const o=document.createElement("div");o.className="tbw-pinned-rows-left";const i=document.createElement("div");i.className="tbw-pinned-rows-center";const r=document.createElement("div");if(r.className="tbw-pinned-rows-right",!1!==t.showRowCount){const t=document.createElement("span");t.className="tbw-status-panel tbw-status-panel-row-count",t.textContent=`Total: ${e.totalRows} rows`,o.appendChild(t)}if(t.showFilteredCount&&e.filteredRows!==e.totalRows){const t=document.createElement("span");t.className="tbw-status-panel tbw-status-panel-filtered-count",t.textContent=`Filtered: ${e.filteredRows}`,o.appendChild(t)}if(t.showSelectedCount&&e.selectedRows>0){const t=document.createElement("span");t.className="tbw-status-panel tbw-status-panel-selected-count",t.textContent=`Selected: ${e.selectedRows}`,r.appendChild(t)}if(t.customPanels)for(const a of t.customPanels){const t=g(a,e);switch(a.position){case"left":o.appendChild(t);break;case"center":i.appendChild(t);break;case"right":r.appendChild(t)}}return n.appendChild(o),n.appendChild(i),n.appendChild(r),n}function i(t){const e=document.createElement("div");return e.className=`tbw-aggregation-rows tbw-aggregation-rows-${t}`,e.setAttribute("role","presentation"),e}function r(t,e,n,o,i=!1){t.innerHTML="";for(const r of e){const e=document.createElement("div");e.className="tbw-aggregation-row",e.setAttribute("role","presentation"),r.id&&e.setAttribute("data-aggregation-id",r.id);r.fullWidth??i?a(e,r,n,o):s(e,r,n,o),t.appendChild(e)}}function a(t,e,n,o){const i=document.createElement("div");i.className="tbw-aggregation-cell tbw-aggregation-cell-full",i.style.gridColumn="1 / -1";const r="function"==typeof e.label?e.label(o,n):e.label;if(r){const t=document.createElement("span");t.className="tbw-aggregation-label",t.textContent=r,i.appendChild(t)}const a=function(t,e,n){const o=t.aggregators&&Object.keys(t.aggregators).length>0,i=t.cells&&Object.keys(t.cells).length>0;if(!o&&!i)return null;const r=document.createElement("span");r.className="tbw-aggregation-aggregates";for(const a of e){const{value:e,formatter:o}=l(t,a,n);if(null!=e){const t=document.createElement("span");t.className="tbw-aggregation-aggregate",t.setAttribute("data-field",a.field);const n=a.header??a.field,i=o?o(e,a.field,a):String(e);t.textContent=`${n}: ${i}`,r.appendChild(t)}}return r.children.length>0?r:null}(e,n,o);a&&i.appendChild(a),t.appendChild(i)}function s(t,e,n,o){for(const i of n){const n=document.createElement("div");n.className="tbw-aggregation-cell",n.setAttribute("data-field",i.field);const{value:r,formatter:a}=l(e,i,o);n.textContent=null!=r?a?a(r,i.field,i):String(r):"",t.appendChild(n)}}function l(t,e,o){let i,r;const a=t.aggregators?.[e.field];if(a)if("object"==typeof(s=a)&&null!==s&&"aggFunc"in s){const t=n.getAggregator(a.aggFunc);t&&(i=t(o,e.field,e)),r=a.formatter}else{const t=n.getAggregator(a);t&&(i=t(o,e.field,e))}else if(t.cells&&Object.prototype.hasOwnProperty.call(t.cells,e.field)){const n=t.cells[e.field];i="function"==typeof n?n(o,e.field,e):n}var s;return{value:i,formatter:r}}function g(t,e){const n=document.createElement("div");n.className="tbw-status-panel tbw-status-panel-custom",n.id=`status-panel-${t.id}`;const o=t.render(e);return"string"==typeof o?n.innerHTML=o:n.appendChild(o),n}function c(t,e,n,o,i){return{totalRows:t.length,filteredRows:i?.cachedResult?.length??t.length,selectedRows:o?.selected?.size??0,columns:e,rows:t,grid:n}}class d extends e.BaseGridPlugin{name="pinnedRows";styles="@layer tbw-plugins{.tbw-footer{flex-shrink:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-color-panel-bg)}.tbw-pinned-rows{display:flex;align-items:center;justify-content:space-between;padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));background:var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));border-top:1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));min-height:32px;box-sizing:border-box;min-width:fit-content}.tbw-pinned-rows-left,.tbw-pinned-rows-center,.tbw-pinned-rows-right{display:flex;align-items:center;gap:var(--tbw-spacing-xl, 1rem)}.tbw-pinned-rows-left{justify-content:flex-start}.tbw-pinned-rows-center{justify-content:center;flex:1}.tbw-pinned-rows-right{justify-content:flex-end}.tbw-status-panel{white-space:nowrap}.tbw-aggregation-rows{min-width:fit-content;background:var(--tbw-aggregation-bg, var(--tbw-color-header-bg))}.tbw-aggregation-rows-top{border-bottom:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-rows-bottom{border-top:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-row{display:grid;grid-template-columns:var(--tbw-column-template);font-size:var(--tbw-aggregation-font-size, .8em);font-weight:var(--tbw-aggregation-font-weight, 600)}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, .125rem .5rem);min-height:var(--tbw-row-height, 1.75rem);display:block;align-items:center;align-content:center;border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;text-overflow:ellipsis;white-space:var(--tbw-cell-white-space, nowrap)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0;display:flex;align-items:center;gap:var(--tbw-spacing-lg, .75rem)}.tbw-aggregation-label{white-space:nowrap}.tbw-aggregation-aggregates{display:flex;align-items:center;gap:var(--tbw-spacing-lg, .75rem);font-weight:400;opacity:.85}.tbw-aggregation-aggregate{white-space:nowrap}}";get defaultConfig(){return{position:"bottom",showRowCount:!0,showSelectedCount:!0,showFilteredCount:!0}}infoBarElement=null;topAggregationContainer=null;bottomAggregationContainer=null;footerWrapper=null;detach(){this.infoBarElement&&(this.infoBarElement.remove(),this.infoBarElement=null),this.topAggregationContainer&&(this.topAggregationContainer.remove(),this.topAggregationContainer=null),this.bottomAggregationContainer&&(this.bottomAggregationContainer.remove(),this.bottomAggregationContainer=null),this.footerWrapper&&(this.footerWrapper.remove(),this.footerWrapper=null)}afterRender(){const t=this.gridElement;if(!t)return;const e=t.querySelector(".tbw-scroll-area")??t.querySelector(".tbw-grid-content")??t.children[0];if(!e)return;this.footerWrapper&&!e.contains(this.footerWrapper)&&(this.footerWrapper=null,this.bottomAggregationContainer=null,this.infoBarElement=null),this.topAggregationContainer&&!e.contains(this.topAggregationContainer)&&(this.topAggregationContainer=null),this.infoBarElement&&!e.contains(this.infoBarElement)&&(this.infoBarElement=null);const n=this.getSelectionState(),a=this.getFilterState(),s=c(this.sourceRows,this.columns,this.gridElement,n,a),l=this.config.aggregationRows||[],g=l.filter(t=>"top"===t.position),d=l.filter(t=>"top"!==t.position);if(g.length>0){if(!this.topAggregationContainer){this.topAggregationContainer=i("top");const n=t.querySelector(".header");n&&n.nextSibling?e.insertBefore(this.topAggregationContainer,n.nextSibling):e.appendChild(this.topAggregationContainer)}r(this.topAggregationContainer,g,this.visibleColumns,this.sourceRows,this.config.fullWidth)}else this.topAggregationContainer&&(this.topAggregationContainer.remove(),this.topAggregationContainer=null);const p=!1!==this.config.showRowCount||this.config.showSelectedCount&&s.selectedRows>0||this.config.showFilteredCount&&s.filteredRows!==s.totalRows||this.config.customPanels&&this.config.customPanels.length>0,h=p&&"top"!==this.config.position,f=d.length>0||h;if(p&&"top"===this.config.position)if(this.infoBarElement){const t=o(this.config,s);this.infoBarElement.replaceWith(t),this.infoBarElement=t}else this.infoBarElement=o(this.config,s),e.insertBefore(this.infoBarElement,e.firstChild);else"top"===this.config.position&&this.infoBarElement&&(this.infoBarElement.remove(),this.infoBarElement=null);f?(this.footerWrapper||(this.footerWrapper=document.createElement("div"),this.footerWrapper.className="tbw-footer",e.appendChild(this.footerWrapper)),this.footerWrapper.innerHTML="",d.length>0&&(this.bottomAggregationContainer||(this.bottomAggregationContainer=i("bottom")),this.footerWrapper.appendChild(this.bottomAggregationContainer),r(this.bottomAggregationContainer,d,this.visibleColumns,this.sourceRows,this.config.fullWidth)),h&&(this.infoBarElement=o(this.config,s),this.footerWrapper.appendChild(this.infoBarElement))):this.cleanupFooter()}cleanup(){this.infoBarElement&&(this.infoBarElement.remove(),this.infoBarElement=null),this.topAggregationContainer&&(this.topAggregationContainer.remove(),this.topAggregationContainer=null),this.bottomAggregationContainer&&(this.bottomAggregationContainer.remove(),this.bottomAggregationContainer=null),this.footerWrapper&&(this.footerWrapper.remove(),this.footerWrapper=null)}cleanupFooter(){this.footerWrapper&&(this.footerWrapper.remove(),this.footerWrapper=null),this.bottomAggregationContainer&&(this.bottomAggregationContainer.remove(),this.bottomAggregationContainer=null),this.infoBarElement&&"top"!==this.config.position&&(this.infoBarElement.remove(),this.infoBarElement=null)}getSelectionState(){try{return this.grid?.getPluginState?.("selection")??null}catch{return null}}getFilterState(){try{return this.grid?.getPluginState?.("filtering")??null}catch{return null}}refresh(){this.requestRender()}getContext(){const t=this.getSelectionState(),e=this.getFilterState();return c(this.rows,this.columns,this.gridElement,t,e)}addPanel(t){this.config.customPanels||(this.config.customPanels=[]),this.config.customPanels.push(t),this.requestRender()}removePanel(t){this.config.customPanels&&(this.config.customPanels=this.config.customPanels.filter(e=>e.id!==t),this.requestRender())}addAggregationRow(t){this.config.aggregationRows||(this.config.aggregationRows=[]),this.config.aggregationRows.push(t),this.requestRender()}removeAggregationRow(t){this.config.aggregationRows&&(this.config.aggregationRows=this.config.aggregationRows.filter(e=>e.id!==t),this.requestRender())}}t.PinnedRowsPlugin=d,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=pinned-rows.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pinned-rows.umd.js","sources":["../../../../../libs/grid/src/lib/plugins/pinned-rows/pinned-rows.ts","../../../../../libs/grid/src/lib/plugins/pinned-rows/PinnedRowsPlugin.ts"],"sourcesContent":["/**\n * Status Bar Rendering Logic\n *\n * Pure functions for creating and updating the status bar UI.\n * Includes both info bar and aggregation row rendering.\n */\n\nimport { getAggregator } from '../../core/internal/aggregators';\nimport type { ColumnConfig } from '../../core/types';\nimport type {\n AggregationRowConfig,\n AggregatorConfig,\n AggregatorDefinition,\n PinnedRowsConfig,\n PinnedRowsContext,\n PinnedRowsPanel,\n} from './types';\n\n/**\n * Check if an aggregator definition is a full config object (with aggFunc and optional formatter).\n */\nfunction isAggregatorConfig(def: AggregatorDefinition): def is AggregatorConfig {\n return typeof def === 'object' && def !== null && 'aggFunc' in def;\n}\n\n/**\n * Creates the info bar DOM element with all configured panels.\n *\n * @param config - The status bar configuration\n * @param context - The current grid context for rendering\n * @returns The complete info bar element\n */\nexport function createInfoBarElement(config: PinnedRowsConfig, context: PinnedRowsContext): HTMLElement {\n const pinnedRows = document.createElement('div');\n pinnedRows.className = 'tbw-pinned-rows';\n pinnedRows.setAttribute('role', 'presentation');\n pinnedRows.setAttribute('aria-live', 'polite');\n\n const left = document.createElement('div');\n left.className = 'tbw-pinned-rows-left';\n\n const center = document.createElement('div');\n center.className = 'tbw-pinned-rows-center';\n\n const right = document.createElement('div');\n right.className = 'tbw-pinned-rows-right';\n\n // Default panels - row count\n if (config.showRowCount !== false) {\n const rowCount = document.createElement('span');\n rowCount.className = 'tbw-status-panel tbw-status-panel-row-count';\n rowCount.textContent = `Total: ${context.totalRows} rows`;\n left.appendChild(rowCount);\n }\n\n // Filtered count panel (only shows when filter is active)\n if (config.showFilteredCount && context.filteredRows !== context.totalRows) {\n const filteredCount = document.createElement('span');\n filteredCount.className = 'tbw-status-panel tbw-status-panel-filtered-count';\n filteredCount.textContent = `Filtered: ${context.filteredRows}`;\n left.appendChild(filteredCount);\n }\n\n // Selected count panel (only shows when rows are selected)\n if (config.showSelectedCount && context.selectedRows > 0) {\n const selectedCount = document.createElement('span');\n selectedCount.className = 'tbw-status-panel tbw-status-panel-selected-count';\n selectedCount.textContent = `Selected: ${context.selectedRows}`;\n right.appendChild(selectedCount);\n }\n\n // Render custom panels\n if (config.customPanels) {\n for (const panel of config.customPanels) {\n const panelEl = renderCustomPanel(panel, context);\n switch (panel.position) {\n case 'left':\n left.appendChild(panelEl);\n break;\n case 'center':\n center.appendChild(panelEl);\n break;\n case 'right':\n right.appendChild(panelEl);\n break;\n }\n }\n }\n\n pinnedRows.appendChild(left);\n pinnedRows.appendChild(center);\n pinnedRows.appendChild(right);\n\n return pinnedRows;\n}\n\n/**\n * Creates a container for aggregation rows at top or bottom.\n *\n * @param position - 'top' or 'bottom'\n * @returns The container element\n */\nexport function createAggregationContainer(position: 'top' | 'bottom'): HTMLElement {\n const container = document.createElement('div');\n container.className = `tbw-aggregation-rows tbw-aggregation-rows-${position}`;\n // Use presentation role since aggregation rows are outside the role=\"grid\" element for layout reasons\n container.setAttribute('role', 'presentation');\n return container;\n}\n\n/**\n * Renders aggregation rows into a container.\n *\n * @param container - The container to render into\n * @param rows - Aggregation row configurations\n * @param columns - Current column configuration\n * @param dataRows - Current row data for aggregation calculations\n * @param globalFullWidth - Global fullWidth default from PinnedRowsConfig (default: false)\n */\nexport function renderAggregationRows(\n container: HTMLElement,\n rows: AggregationRowConfig[],\n columns: ColumnConfig[],\n dataRows: unknown[],\n globalFullWidth = false,\n): void {\n container.innerHTML = '';\n\n for (const rowConfig of rows) {\n const rowEl = document.createElement('div');\n rowEl.className = 'tbw-aggregation-row';\n // Use presentation role since aggregation rows are outside the role=\"grid\" element\n rowEl.setAttribute('role', 'presentation');\n if (rowConfig.id) {\n rowEl.setAttribute('data-aggregation-id', rowConfig.id);\n }\n\n // Per-row fullWidth overrides global default\n const isFullWidth = rowConfig.fullWidth ?? globalFullWidth;\n\n if (isFullWidth) {\n renderFullWidthAggregationRow(rowEl, rowConfig, columns, dataRows);\n } else {\n renderPerColumnAggregationRow(rowEl, rowConfig, columns, dataRows);\n }\n\n container.appendChild(rowEl);\n }\n}\n\n/**\n * Renders a full-width aggregation row: single spanning cell with label and inline aggregated values.\n */\nfunction renderFullWidthAggregationRow(\n rowEl: HTMLElement,\n rowConfig: AggregationRowConfig,\n columns: ColumnConfig[],\n dataRows: unknown[],\n): void {\n const cell = document.createElement('div');\n cell.className = 'tbw-aggregation-cell tbw-aggregation-cell-full';\n cell.style.gridColumn = '1 / -1';\n\n // Label (static string or dynamic function)\n const labelValue = typeof rowConfig.label === 'function' ? rowConfig.label(dataRows, columns) : rowConfig.label;\n if (labelValue) {\n const labelSpan = document.createElement('span');\n labelSpan.className = 'tbw-aggregation-label';\n labelSpan.textContent = labelValue;\n cell.appendChild(labelSpan);\n }\n\n // Inline aggregated values\n const aggregatesContainer = renderInlineAggregates(rowConfig, columns, dataRows);\n if (aggregatesContainer) {\n cell.appendChild(aggregatesContainer);\n }\n\n // If nothing was added (no label, no aggregates), ensure cell is empty but present\n rowEl.appendChild(cell);\n}\n\n/**\n * Renders per-column aggregation cells aligned to the grid template.\n */\nfunction renderPerColumnAggregationRow(\n rowEl: HTMLElement,\n rowConfig: AggregationRowConfig,\n columns: ColumnConfig[],\n dataRows: unknown[],\n): void {\n for (const col of columns) {\n const cell = document.createElement('div');\n cell.className = 'tbw-aggregation-cell';\n cell.setAttribute('data-field', col.field);\n\n const { value, formatter } = resolveAggregatedValue(rowConfig, col, dataRows);\n\n if (value != null) {\n cell.textContent = formatter ? formatter(value, col.field, col) : String(value);\n } else {\n cell.textContent = '';\n }\n rowEl.appendChild(cell);\n }\n}\n\n/**\n * Resolves the aggregated value for a single column in an aggregation row.\n * Returns the computed value and an optional formatter function.\n */\nfunction resolveAggregatedValue(\n rowConfig: AggregationRowConfig,\n col: ColumnConfig,\n dataRows: unknown[],\n): { value: unknown; formatter?: (value: unknown, field: string, column?: ColumnConfig) => string } {\n let value: unknown;\n let formatter: ((value: unknown, field: string, column?: ColumnConfig) => string) | undefined;\n\n // Check for aggregator first\n const aggDef = rowConfig.aggregators?.[col.field];\n if (aggDef) {\n if (isAggregatorConfig(aggDef)) {\n const aggFn = getAggregator(aggDef.aggFunc);\n if (aggFn) {\n value = aggFn(dataRows, col.field, col);\n }\n formatter = aggDef.formatter;\n } else {\n const aggFn = getAggregator(aggDef);\n if (aggFn) {\n value = aggFn(dataRows, col.field, col);\n }\n }\n } else if (rowConfig.cells && Object.prototype.hasOwnProperty.call(rowConfig.cells, col.field)) {\n const staticVal = rowConfig.cells[col.field];\n if (typeof staticVal === 'function') {\n value = staticVal(dataRows, col.field, col);\n } else {\n value = staticVal;\n }\n }\n\n return { value, formatter };\n}\n\n/**\n * Renders inline aggregate values for a full-width aggregation row.\n * Returns a container element with aggregate spans, or null if no aggregates are defined.\n */\nfunction renderInlineAggregates(\n rowConfig: AggregationRowConfig,\n columns: ColumnConfig[],\n dataRows: unknown[],\n): HTMLElement | null {\n // Collect fields that have aggregators or cell values\n const hasAggregators = rowConfig.aggregators && Object.keys(rowConfig.aggregators).length > 0;\n const hasCells = rowConfig.cells && Object.keys(rowConfig.cells).length > 0;\n if (!hasAggregators && !hasCells) return null;\n\n const container = document.createElement('span');\n container.className = 'tbw-aggregation-aggregates';\n\n for (const col of columns) {\n const { value, formatter } = resolveAggregatedValue(rowConfig, col, dataRows);\n if (value != null) {\n const span = document.createElement('span');\n span.className = 'tbw-aggregation-aggregate';\n span.setAttribute('data-field', col.field);\n const header = col.header ?? col.field;\n const displayValue = formatter ? formatter(value, col.field, col) : String(value);\n span.textContent = `${header}: ${displayValue}`;\n container.appendChild(span);\n }\n }\n\n return container.children.length > 0 ? container : null;\n}\n\n/**\n * Renders a custom panel element.\n *\n * @param panel - The panel definition\n * @param context - The current grid context\n * @returns The panel DOM element\n */\nfunction renderCustomPanel(panel: PinnedRowsPanel, context: PinnedRowsContext): HTMLElement {\n const panelEl = document.createElement('div');\n panelEl.className = 'tbw-status-panel tbw-status-panel-custom';\n panelEl.id = `status-panel-${panel.id}`;\n\n const content = panel.render(context);\n\n if (typeof content === 'string') {\n panelEl.innerHTML = content;\n } else {\n panelEl.appendChild(content);\n }\n\n return panelEl;\n}\n\n/**\n * Builds the status bar context from grid state and plugin states.\n *\n * @param rows - Current row data\n * @param columns - Current column configuration\n * @param grid - Grid element reference\n * @param selectionState - Optional selection plugin state\n * @param filterState - Optional filtering plugin state\n * @returns The status bar context\n */\nexport function buildContext(\n rows: unknown[],\n columns: unknown[],\n grid: HTMLElement,\n selectionState?: { selected: Set<number> } | null,\n filterState?: { cachedResult: unknown[] | null } | null,\n): PinnedRowsContext {\n return {\n totalRows: rows.length,\n filteredRows: filterState?.cachedResult?.length ?? rows.length,\n selectedRows: selectionState?.selected?.size ?? 0,\n columns: columns as PinnedRowsContext['columns'],\n rows,\n grid,\n };\n}\n\n// Keep old name as alias for backwards compatibility\nexport const createPinnedRowsElement = createInfoBarElement;\n","/**\n * Pinned Rows Plugin (Class-based)\n *\n * Adds info bars and aggregation rows to the grid.\n * - Info bar: Shows row counts, selection info, and custom panels\n * - Aggregation rows: Footer/header rows with computed values (sum, avg, etc.)\n */\n\nimport { BaseGridPlugin } from '../../core/plugin/base-plugin';\nimport type { ColumnConfig } from '../../core/types';\nimport { buildContext, createAggregationContainer, createInfoBarElement, renderAggregationRows } from './pinned-rows';\nimport styles from './pinned-rows.css?inline';\nimport type { AggregationRowConfig, PinnedRowsConfig, PinnedRowsContext, PinnedRowsPanel } from './types';\n\n/**\n * Pinned Rows (Status Bar) Plugin for tbw-grid\n *\n * Creates fixed status bars at the top or bottom of the grid for displaying aggregations,\n * row counts, or custom content. Think of it as the \"totals row\" you'd see in a spreadsheet—\n * always visible regardless of scroll position.\n *\n * ## Installation\n *\n * ```ts\n * import { PinnedRowsPlugin } from '@toolbox-web/grid/plugins/pinned-rows';\n * ```\n *\n * ## Configuration Options\n *\n * | Option | Type | Default | Description |\n * |--------|------|---------|-------------|\n * | `position` | `'top' \\| 'bottom'` | `'bottom'` | Status bar position |\n * | `showRowCount` | `boolean` | `true` | Show total row count |\n * | `showSelectedCount` | `boolean` | `true` | Show selected row count |\n * | `showFilteredCount` | `boolean` | `true` | Show filtered row count |\n * | `fullWidth` | `boolean` | `false` | Default fullWidth for aggregation rows |\n * | `aggregationRows` | `AggregationRowConfig[]` | - | Aggregation row configs |\n *\n * ## Built-in Aggregation Functions\n *\n * | Function | Description |\n * |----------|-------------|\n * | `sum` | Sum of values |\n * | `avg` | Average of values |\n * | `count` | Count of rows |\n * | `min` | Minimum value |\n * | `max` | Maximum value |\n *\n * ## CSS Custom Properties\n *\n * | Property | Default | Description |\n * |----------|---------|-------------|\n * | `--tbw-pinned-rows-bg` | `var(--tbw-color-panel-bg)` | Status bar background |\n * | `--tbw-pinned-rows-border` | `var(--tbw-color-border)` | Status bar border |\n *\n * @example Status Bar with Aggregation\n * ```ts\n * import '@toolbox-web/grid';\n * import { PinnedRowsPlugin } from '@toolbox-web/grid/plugins/pinned-rows';\n *\n * grid.gridConfig = {\n * columns: [\n * { field: 'product', header: 'Product' },\n * { field: 'quantity', header: 'Qty', type: 'number' },\n * { field: 'price', header: 'Price', type: 'currency' },\n * ],\n * plugins: [\n * new PinnedRowsPlugin({\n * position: 'bottom',\n * showRowCount: true,\n * aggregationRows: [\n * {\n * id: 'totals',\n * aggregators: { quantity: 'sum', price: 'sum' },\n * cells: { product: 'Totals:' },\n * },\n * ],\n * }),\n * ],\n * };\n * ```\n *\n * @see {@link PinnedRowsConfig} for all configuration options\n * @see {@link AggregationRowConfig} for aggregation row structure\n *\n * @internal Extends BaseGridPlugin\n */\nexport class PinnedRowsPlugin extends BaseGridPlugin<PinnedRowsConfig> {\n /** @internal */\n readonly name = 'pinnedRows';\n /** @internal */\n override readonly styles = styles;\n\n /** @internal */\n protected override get defaultConfig(): Partial<PinnedRowsConfig> {\n return {\n position: 'bottom',\n showRowCount: true,\n showSelectedCount: true,\n showFilteredCount: true,\n };\n }\n\n // #region Internal State\n private infoBarElement: HTMLElement | null = null;\n private topAggregationContainer: HTMLElement | null = null;\n private bottomAggregationContainer: HTMLElement | null = null;\n private footerWrapper: HTMLElement | null = null;\n // #endregion\n\n // #region Lifecycle\n /** @internal */\n override detach(): void {\n if (this.infoBarElement) {\n this.infoBarElement.remove();\n this.infoBarElement = null;\n }\n if (this.topAggregationContainer) {\n this.topAggregationContainer.remove();\n this.topAggregationContainer = null;\n }\n if (this.bottomAggregationContainer) {\n this.bottomAggregationContainer.remove();\n this.bottomAggregationContainer = null;\n }\n if (this.footerWrapper) {\n this.footerWrapper.remove();\n this.footerWrapper = null;\n }\n }\n // #endregion\n\n // #region Hooks\n /** @internal */\n override afterRender(): void {\n const gridEl = this.gridElement;\n if (!gridEl) return;\n\n // Use .tbw-scroll-area so footer is inside the horizontal scroll area,\n // otherwise fall back to .tbw-grid-content or root container\n const container =\n gridEl.querySelector('.tbw-scroll-area') ?? gridEl.querySelector('.tbw-grid-content') ?? gridEl.children[0];\n if (!container) return;\n\n // Clear orphaned element references if they were removed from the DOM\n // (e.g., by buildGridDOMIntoShadow calling replaceChildren())\n // We check if the element is still inside the container rather than isConnected,\n // because in unit tests the mock grid may not be attached to document.body\n if (this.footerWrapper && !container.contains(this.footerWrapper)) {\n this.footerWrapper = null;\n this.bottomAggregationContainer = null;\n this.infoBarElement = null;\n }\n if (this.topAggregationContainer && !container.contains(this.topAggregationContainer)) {\n this.topAggregationContainer = null;\n }\n if (this.infoBarElement && !container.contains(this.infoBarElement)) {\n this.infoBarElement = null;\n }\n\n // Build context with plugin states\n const selectionState = this.getSelectionState();\n const filterState = this.getFilterState();\n\n const context = buildContext(\n this.sourceRows as unknown[],\n this.columns as unknown[],\n this.grid as unknown as HTMLElement,\n selectionState,\n filterState,\n );\n\n // #region Handle Aggregation Rows\n const aggregationRows = this.config.aggregationRows || [];\n const topRows = aggregationRows.filter((r) => r.position === 'top');\n const bottomRows = aggregationRows.filter((r) => r.position !== 'top');\n\n // Top aggregation rows\n if (topRows.length > 0) {\n if (!this.topAggregationContainer) {\n this.topAggregationContainer = createAggregationContainer('top');\n const header = gridEl.querySelector('.header');\n if (header && header.nextSibling) {\n container.insertBefore(this.topAggregationContainer, header.nextSibling);\n } else {\n container.appendChild(this.topAggregationContainer);\n }\n }\n renderAggregationRows(\n this.topAggregationContainer,\n topRows,\n this.visibleColumns as ColumnConfig[],\n this.sourceRows as unknown[],\n this.config.fullWidth,\n );\n } else if (this.topAggregationContainer) {\n this.topAggregationContainer.remove();\n this.topAggregationContainer = null;\n }\n\n // Handle footer\n const hasInfoContent =\n this.config.showRowCount !== false ||\n (this.config.showSelectedCount && context.selectedRows > 0) ||\n (this.config.showFilteredCount && context.filteredRows !== context.totalRows) ||\n (this.config.customPanels && this.config.customPanels.length > 0);\n const hasBottomInfoBar = hasInfoContent && this.config.position !== 'top';\n const needsFooter = bottomRows.length > 0 || hasBottomInfoBar;\n\n // Handle top info bar\n if (hasInfoContent && this.config.position === 'top') {\n if (!this.infoBarElement) {\n this.infoBarElement = createInfoBarElement(this.config, context);\n container.insertBefore(this.infoBarElement, container.firstChild);\n } else {\n const newInfoBar = createInfoBarElement(this.config, context);\n this.infoBarElement.replaceWith(newInfoBar);\n this.infoBarElement = newInfoBar;\n }\n } else if (this.config.position === 'top' && this.infoBarElement) {\n this.infoBarElement.remove();\n this.infoBarElement = null;\n }\n\n // Create/manage footer wrapper\n if (needsFooter) {\n if (!this.footerWrapper) {\n this.footerWrapper = document.createElement('div');\n this.footerWrapper.className = 'tbw-footer';\n container.appendChild(this.footerWrapper);\n }\n\n this.footerWrapper.innerHTML = '';\n\n if (bottomRows.length > 0) {\n if (!this.bottomAggregationContainer) {\n this.bottomAggregationContainer = createAggregationContainer('bottom');\n }\n this.footerWrapper.appendChild(this.bottomAggregationContainer);\n renderAggregationRows(\n this.bottomAggregationContainer,\n bottomRows,\n this.visibleColumns as ColumnConfig[],\n this.sourceRows as unknown[],\n this.config.fullWidth,\n );\n }\n\n if (hasBottomInfoBar) {\n this.infoBarElement = createInfoBarElement(this.config, context);\n this.footerWrapper.appendChild(this.infoBarElement);\n }\n } else {\n this.cleanupFooter();\n }\n // #endregion\n }\n // #endregion\n\n // #region Private Methods\n private cleanup(): void {\n if (this.infoBarElement) {\n this.infoBarElement.remove();\n this.infoBarElement = null;\n }\n if (this.topAggregationContainer) {\n this.topAggregationContainer.remove();\n this.topAggregationContainer = null;\n }\n if (this.bottomAggregationContainer) {\n this.bottomAggregationContainer.remove();\n this.bottomAggregationContainer = null;\n }\n if (this.footerWrapper) {\n this.footerWrapper.remove();\n this.footerWrapper = null;\n }\n }\n\n private cleanupFooter(): void {\n if (this.footerWrapper) {\n this.footerWrapper.remove();\n this.footerWrapper = null;\n }\n if (this.bottomAggregationContainer) {\n this.bottomAggregationContainer.remove();\n this.bottomAggregationContainer = null;\n }\n if (this.infoBarElement && this.config.position !== 'top') {\n this.infoBarElement.remove();\n this.infoBarElement = null;\n }\n }\n\n private getSelectionState(): { selected: Set<number> } | null {\n // Try to get selection plugin state\n try {\n return (this.grid?.getPluginState?.('selection') as { selected: Set<number> } | null) ?? null;\n } catch {\n return null;\n }\n }\n\n private getFilterState(): { cachedResult: unknown[] | null } | null {\n try {\n return (this.grid?.getPluginState?.('filtering') as { cachedResult: unknown[] | null } | null) ?? null;\n } catch {\n return null;\n }\n }\n // #endregion\n\n // #region Public API\n /**\n * Refresh the status bar to reflect current grid state.\n */\n refresh(): void {\n this.requestRender();\n }\n\n /**\n * Get the current status bar context.\n * @returns The context with row counts and other info\n */\n getContext(): PinnedRowsContext {\n const selectionState = this.getSelectionState();\n const filterState = this.getFilterState();\n\n return buildContext(\n this.rows as unknown[],\n this.columns as unknown[],\n this.grid as unknown as HTMLElement,\n selectionState,\n filterState,\n );\n }\n\n /**\n * Add a custom panel to the info bar.\n * @param panel - The panel configuration to add\n */\n addPanel(panel: PinnedRowsPanel): void {\n if (!this.config.customPanels) {\n this.config.customPanels = [];\n }\n this.config.customPanels.push(panel);\n this.requestRender();\n }\n\n /**\n * Remove a custom panel by ID.\n * @param id - The panel ID to remove\n */\n removePanel(id: string): void {\n if (this.config.customPanels) {\n this.config.customPanels = this.config.customPanels.filter((p) => p.id !== id);\n this.requestRender();\n }\n }\n\n /**\n * Add an aggregation row.\n * @param row - The aggregation row configuration\n */\n addAggregationRow(row: AggregationRowConfig): void {\n if (!this.config.aggregationRows) {\n this.config.aggregationRows = [];\n }\n this.config.aggregationRows.push(row);\n this.requestRender();\n }\n\n /**\n * Remove an aggregation row by ID.\n * @param id - The aggregation row ID to remove\n */\n removeAggregationRow(id: string): void {\n if (this.config.aggregationRows) {\n this.config.aggregationRows = this.config.aggregationRows.filter((r) => r.id !== id);\n this.requestRender();\n }\n }\n // #endregion\n}\n"],"names":["createInfoBarElement","config","context","pinnedRows","document","createElement","className","setAttribute","left","center","right","showRowCount","rowCount","textContent","totalRows","appendChild","showFilteredCount","filteredRows","filteredCount","showSelectedCount","selectedRows","selectedCount","customPanels","panel","panelEl","renderCustomPanel","position","createAggregationContainer","container","renderAggregationRows","rows","columns","dataRows","globalFullWidth","innerHTML","rowConfig","rowEl","id","fullWidth","renderFullWidthAggregationRow","renderPerColumnAggregationRow","cell","style","gridColumn","labelValue","label","labelSpan","aggregatesContainer","hasAggregators","aggregators","Object","keys","length","hasCells","cells","col","value","formatter","resolveAggregatedValue","span","field","header","displayValue","String","children","renderInlineAggregates","aggDef","def","aggFn","getAggregator","aggFunc","prototype","hasOwnProperty","call","staticVal","content","render","buildContext","grid","selectionState","filterState","cachedResult","selected","size","PinnedRowsPlugin","BaseGridPlugin","name","styles","defaultConfig","infoBarElement","topAggregationContainer","bottomAggregationContainer","footerWrapper","detach","this","remove","afterRender","gridEl","gridElement","querySelector","contains","getSelectionState","getFilterState","sourceRows","aggregationRows","topRows","filter","r","bottomRows","nextSibling","insertBefore","visibleColumns","hasInfoContent","hasBottomInfoBar","needsFooter","newInfoBar","replaceWith","firstChild","cleanupFooter","cleanup","getPluginState","refresh","requestRender","getContext","addPanel","push","removePanel","p","addAggregationRow","row","removeAggregationRow"],"mappings":"6aAgCO,SAASA,EAAqBC,EAA0BC,GAC7D,MAAMC,EAAaC,SAASC,cAAc,OAC1CF,EAAWG,UAAY,kBACvBH,EAAWI,aAAa,OAAQ,gBAChCJ,EAAWI,aAAa,YAAa,UAErC,MAAMC,EAAOJ,SAASC,cAAc,OACpCG,EAAKF,UAAY,uBAEjB,MAAMG,EAASL,SAASC,cAAc,OACtCI,EAAOH,UAAY,yBAEnB,MAAMI,EAAQN,SAASC,cAAc,OAIrC,GAHAK,EAAMJ,UAAY,yBAGU,IAAxBL,EAAOU,aAAwB,CACjC,MAAMC,EAAWR,SAASC,cAAc,QACxCO,EAASN,UAAY,8CACrBM,EAASC,YAAc,UAAUX,EAAQY,iBACzCN,EAAKO,YAA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GACE,MAAM5C,EAAiBe,KAAKO,oBACtBrB,EAAcc,KAAKQ,iBAEzB,OAAOzB,EACLiB,KAAKhE,KACLgE,KAAK/D,QACL+D,KAAKhB,KACLC,EACAC,EAEJ,CAMA,QAAA4C,CAASrG,GACFuE,KAAK7F,OAAOqB,eACfwE,KAAK7F,OAAOqB,aAAe,IAE7BwE,KAAK7F,OAAOqB,aAAauG,KAAKtG,GAC9BuE,KAAK4B,eACP,CAMA,WAAAI,CAAYzF,GACNyD,KAAK7F,OAAOqB,eACdwE,KAAK7F,OAAOqB,aAAewE,KAAK7F,OAAOqB,aAAaoF,OAAQqB,GAAMA,EAAE1F,KAAOA,GAC3EyD,KAAK4B,gBAET,CAMA,iBAAAM,CAAkBC,GACXnC,KAAK7F,OAAOuG,kBACfV,KAAK7F,OAAOuG,gBAAkB,IAEhCV,KAAK7F,OAAOuG,gBAAgBqB,KAAKI,GACjCnC,KAAK4B,eACP,CAMA,oBAAAQ,CAAqB7F,GACfyD,KAAK7F,OAAOuG,kBACdV,KAAK7F,OAAOuG,gBAAkBV,KAAK7F,OAAOuG,gBAAgBE,OAAQC,GAAMA,EAAEtE,KAAOA,GACjFyD,KAAK4B,gBAET"}
1
+ {"version":3,"file":"pinned-rows.umd.js","sources":["../../../../../libs/grid/src/lib/plugins/pinned-rows/pinned-rows.ts","../../../../../libs/grid/src/lib/plugins/pinned-rows/PinnedRowsPlugin.ts"],"sourcesContent":["/**\n * Status Bar Rendering Logic\n *\n * Pure functions for creating and updating the status bar UI.\n * Includes both info bar and aggregation row rendering.\n */\n\nimport { getAggregator } from '../../core/internal/aggregators';\nimport type { ColumnConfig } from '../../core/types';\nimport type {\n AggregationRowConfig,\n AggregatorConfig,\n AggregatorDefinition,\n PinnedRowsConfig,\n PinnedRowsContext,\n PinnedRowsPanel,\n} from './types';\n\n/**\n * Check if an aggregator definition is a full config object (with aggFunc and optional formatter).\n */\nfunction isAggregatorConfig(def: AggregatorDefinition): def is AggregatorConfig {\n return typeof def === 'object' && def !== null && 'aggFunc' in def;\n}\n\n/**\n * Creates the info bar DOM element with all configured panels.\n *\n * @param config - The status bar configuration\n * @param context - The current grid context for rendering\n * @returns The complete info bar element\n */\nexport function createInfoBarElement(config: PinnedRowsConfig, context: PinnedRowsContext): HTMLElement {\n const pinnedRows = document.createElement('div');\n pinnedRows.className = 'tbw-pinned-rows';\n pinnedRows.setAttribute('role', 'presentation');\n pinnedRows.setAttribute('aria-live', 'polite');\n\n const left = document.createElement('div');\n left.className = 'tbw-pinned-rows-left';\n\n const center = document.createElement('div');\n center.className = 'tbw-pinned-rows-center';\n\n const right = document.createElement('div');\n right.className = 'tbw-pinned-rows-right';\n\n // Default panels - row count\n if (config.showRowCount !== false) {\n const rowCount = document.createElement('span');\n rowCount.className = 'tbw-status-panel tbw-status-panel-row-count';\n rowCount.textContent = `Total: ${context.totalRows} rows`;\n left.appendChild(rowCount);\n }\n\n // Filtered count panel (only shows when filter is active)\n if (config.showFilteredCount && context.filteredRows !== context.totalRows) {\n const filteredCount = document.createElement('span');\n filteredCount.className = 'tbw-status-panel tbw-status-panel-filtered-count';\n filteredCount.textContent = `Filtered: ${context.filteredRows}`;\n left.appendChild(filteredCount);\n }\n\n // Selected count panel (only shows when rows are selected)\n if (config.showSelectedCount && context.selectedRows > 0) {\n const selectedCount = document.createElement('span');\n selectedCount.className = 'tbw-status-panel tbw-status-panel-selected-count';\n selectedCount.textContent = `Selected: ${context.selectedRows}`;\n right.appendChild(selectedCount);\n }\n\n // Render custom panels\n if (config.customPanels) {\n for (const panel of config.customPanels) {\n const panelEl = renderCustomPanel(panel, context);\n switch (panel.position) {\n case 'left':\n left.appendChild(panelEl);\n break;\n case 'center':\n center.appendChild(panelEl);\n break;\n case 'right':\n right.appendChild(panelEl);\n break;\n }\n }\n }\n\n pinnedRows.appendChild(left);\n pinnedRows.appendChild(center);\n pinnedRows.appendChild(right);\n\n return pinnedRows;\n}\n\n/**\n * Creates a container for aggregation rows at top or bottom.\n *\n * @param position - 'top' or 'bottom'\n * @returns The container element\n */\nexport function createAggregationContainer(position: 'top' | 'bottom'): HTMLElement {\n const container = document.createElement('div');\n container.className = `tbw-aggregation-rows tbw-aggregation-rows-${position}`;\n // Use presentation role since aggregation rows are outside the role=\"grid\" element for layout reasons\n container.setAttribute('role', 'presentation');\n return container;\n}\n\n/**\n * Renders aggregation rows into a container.\n *\n * @param container - The container to render into\n * @param rows - Aggregation row configurations\n * @param columns - Current column configuration\n * @param dataRows - Current row data for aggregation calculations\n * @param globalFullWidth - Global fullWidth default from PinnedRowsConfig (default: false)\n */\nexport function renderAggregationRows(\n container: HTMLElement,\n rows: AggregationRowConfig[],\n columns: ColumnConfig[],\n dataRows: unknown[],\n globalFullWidth = false,\n): void {\n container.innerHTML = '';\n\n for (const rowConfig of rows) {\n const rowEl = document.createElement('div');\n rowEl.className = 'tbw-aggregation-row';\n // Use presentation role since aggregation rows are outside the role=\"grid\" element\n rowEl.setAttribute('role', 'presentation');\n if (rowConfig.id) {\n rowEl.setAttribute('data-aggregation-id', rowConfig.id);\n }\n\n // Per-row fullWidth overrides global default\n const isFullWidth = rowConfig.fullWidth ?? globalFullWidth;\n\n if (isFullWidth) {\n renderFullWidthAggregationRow(rowEl, rowConfig, columns, dataRows);\n } else {\n renderPerColumnAggregationRow(rowEl, rowConfig, columns, dataRows);\n }\n\n container.appendChild(rowEl);\n }\n}\n\n/**\n * Renders a full-width aggregation row: single spanning cell with label and inline aggregated values.\n */\nfunction renderFullWidthAggregationRow(\n rowEl: HTMLElement,\n rowConfig: AggregationRowConfig,\n columns: ColumnConfig[],\n dataRows: unknown[],\n): void {\n const cell = document.createElement('div');\n cell.className = 'tbw-aggregation-cell tbw-aggregation-cell-full';\n cell.style.gridColumn = '1 / -1';\n\n // Label (static string or dynamic function)\n const labelValue = typeof rowConfig.label === 'function' ? rowConfig.label(dataRows, columns) : rowConfig.label;\n if (labelValue) {\n const labelSpan = document.createElement('span');\n labelSpan.className = 'tbw-aggregation-label';\n labelSpan.textContent = labelValue;\n cell.appendChild(labelSpan);\n }\n\n // Inline aggregated values\n const aggregatesContainer = renderInlineAggregates(rowConfig, columns, dataRows);\n if (aggregatesContainer) {\n cell.appendChild(aggregatesContainer);\n }\n\n // If nothing was added (no label, no aggregates), ensure cell is empty but present\n rowEl.appendChild(cell);\n}\n\n/**\n * Renders per-column aggregation cells aligned to the grid template.\n */\nfunction renderPerColumnAggregationRow(\n rowEl: HTMLElement,\n rowConfig: AggregationRowConfig,\n columns: ColumnConfig[],\n dataRows: unknown[],\n): void {\n for (const col of columns) {\n const cell = document.createElement('div');\n cell.className = 'tbw-aggregation-cell';\n cell.setAttribute('data-field', col.field);\n\n const { value, formatter } = resolveAggregatedValue(rowConfig, col, dataRows);\n\n if (value != null) {\n cell.textContent = formatter ? formatter(value, col.field, col) : String(value);\n } else {\n cell.textContent = '';\n }\n rowEl.appendChild(cell);\n }\n}\n\n/**\n * Resolves the aggregated value for a single column in an aggregation row.\n * Returns the computed value and an optional formatter function.\n */\nfunction resolveAggregatedValue(\n rowConfig: AggregationRowConfig,\n col: ColumnConfig,\n dataRows: unknown[],\n): { value: unknown; formatter?: (value: unknown, field: string, column?: ColumnConfig) => string } {\n let value: unknown;\n let formatter: ((value: unknown, field: string, column?: ColumnConfig) => string) | undefined;\n\n // Check for aggregator first\n const aggDef = rowConfig.aggregators?.[col.field];\n if (aggDef) {\n if (isAggregatorConfig(aggDef)) {\n const aggFn = getAggregator(aggDef.aggFunc);\n if (aggFn) {\n value = aggFn(dataRows, col.field, col);\n }\n formatter = aggDef.formatter;\n } else {\n const aggFn = getAggregator(aggDef);\n if (aggFn) {\n value = aggFn(dataRows, col.field, col);\n }\n }\n } else if (rowConfig.cells && Object.prototype.hasOwnProperty.call(rowConfig.cells, col.field)) {\n const staticVal = rowConfig.cells[col.field];\n if (typeof staticVal === 'function') {\n value = staticVal(dataRows, col.field, col);\n } else {\n value = staticVal;\n }\n }\n\n return { value, formatter };\n}\n\n/**\n * Renders inline aggregate values for a full-width aggregation row.\n * Returns a container element with aggregate spans, or null if no aggregates are defined.\n */\nfunction renderInlineAggregates(\n rowConfig: AggregationRowConfig,\n columns: ColumnConfig[],\n dataRows: unknown[],\n): HTMLElement | null {\n // Collect fields that have aggregators or cell values\n const hasAggregators = rowConfig.aggregators && Object.keys(rowConfig.aggregators).length > 0;\n const hasCells = rowConfig.cells && Object.keys(rowConfig.cells).length > 0;\n if (!hasAggregators && !hasCells) return null;\n\n const container = document.createElement('span');\n container.className = 'tbw-aggregation-aggregates';\n\n for (const col of columns) {\n const { value, formatter } = resolveAggregatedValue(rowConfig, col, dataRows);\n if (value != null) {\n const span = document.createElement('span');\n span.className = 'tbw-aggregation-aggregate';\n span.setAttribute('data-field', col.field);\n const header = col.header ?? col.field;\n const displayValue = formatter ? formatter(value, col.field, col) : String(value);\n span.textContent = `${header}: ${displayValue}`;\n container.appendChild(span);\n }\n }\n\n return container.children.length > 0 ? container : null;\n}\n\n/**\n * Renders a custom panel element.\n *\n * @param panel - The panel definition\n * @param context - The current grid context\n * @returns The panel DOM element\n */\nfunction renderCustomPanel(panel: PinnedRowsPanel, context: PinnedRowsContext): HTMLElement {\n const panelEl = document.createElement('div');\n panelEl.className = 'tbw-status-panel tbw-status-panel-custom';\n panelEl.id = `status-panel-${panel.id}`;\n\n const content = panel.render(context);\n\n if (typeof content === 'string') {\n panelEl.innerHTML = content;\n } else {\n panelEl.appendChild(content);\n }\n\n return panelEl;\n}\n\n/**\n * Builds the status bar context from grid state and plugin states.\n *\n * @param rows - Current row data\n * @param columns - Current column configuration\n * @param grid - Grid element reference\n * @param selectionState - Optional selection plugin state\n * @param filterState - Optional filtering plugin state\n * @returns The status bar context\n */\nexport function buildContext(\n rows: unknown[],\n columns: unknown[],\n grid: HTMLElement,\n selectionState?: { selected: Set<number> } | null,\n filterState?: { cachedResult: unknown[] | null } | null,\n): PinnedRowsContext {\n return {\n totalRows: rows.length,\n filteredRows: filterState?.cachedResult?.length ?? rows.length,\n selectedRows: selectionState?.selected?.size ?? 0,\n columns: columns as PinnedRowsContext['columns'],\n rows,\n grid,\n };\n}\n\n// Keep old name as alias for backwards compatibility\nexport const createPinnedRowsElement = createInfoBarElement;\n","/**\n * Pinned Rows Plugin (Class-based)\n *\n * Adds info bars and aggregation rows to the grid.\n * - Info bar: Shows row counts, selection info, and custom panels\n * - Aggregation rows: Footer/header rows with computed values (sum, avg, etc.)\n */\n\nimport { BaseGridPlugin } from '../../core/plugin/base-plugin';\nimport type { ColumnConfig } from '../../core/types';\nimport { buildContext, createAggregationContainer, createInfoBarElement, renderAggregationRows } from './pinned-rows';\nimport styles from './pinned-rows.css?inline';\nimport type { AggregationRowConfig, PinnedRowsConfig, PinnedRowsContext, PinnedRowsPanel } from './types';\n\n/**\n * Pinned Rows (Status Bar) Plugin for tbw-grid\n *\n * Creates fixed status bars at the top or bottom of the grid for displaying aggregations,\n * row counts, or custom content. Think of it as the \"totals row\" you'd see in a spreadsheet—\n * always visible regardless of scroll position.\n *\n * ## Installation\n *\n * ```ts\n * import { PinnedRowsPlugin } from '@toolbox-web/grid/plugins/pinned-rows';\n * ```\n *\n * ## Configuration Options\n *\n * | Option | Type | Default | Description |\n * |--------|------|---------|-------------|\n * | `position` | `'top' \\| 'bottom'` | `'bottom'` | Status bar position |\n * | `showRowCount` | `boolean` | `true` | Show total row count |\n * | `showSelectedCount` | `boolean` | `true` | Show selected row count |\n * | `showFilteredCount` | `boolean` | `true` | Show filtered row count |\n * | `fullWidth` | `boolean` | `false` | Default fullWidth for aggregation rows |\n * | `aggregationRows` | `AggregationRowConfig[]` | - | Aggregation row configs |\n *\n * ## Built-in Aggregation Functions\n *\n * | Function | Description |\n * |----------|-------------|\n * | `sum` | Sum of values |\n * | `avg` | Average of values |\n * | `count` | Count of rows |\n * | `min` | Minimum value |\n * | `max` | Maximum value |\n *\n * ## CSS Custom Properties\n *\n * | Property | Default | Description |\n * |----------|---------|-------------|\n * | `--tbw-pinned-rows-bg` | `var(--tbw-color-panel-bg)` | Status bar background |\n * | `--tbw-pinned-rows-border` | `var(--tbw-color-border)` | Status bar border |\n *\n * @example Status Bar with Aggregation\n * ```ts\n * import '@toolbox-web/grid';\n * import { PinnedRowsPlugin } from '@toolbox-web/grid/plugins/pinned-rows';\n *\n * grid.gridConfig = {\n * columns: [\n * { field: 'product', header: 'Product' },\n * { field: 'quantity', header: 'Qty', type: 'number' },\n * { field: 'price', header: 'Price', type: 'currency' },\n * ],\n * plugins: [\n * new PinnedRowsPlugin({\n * position: 'bottom',\n * showRowCount: true,\n * aggregationRows: [\n * {\n * id: 'totals',\n * aggregators: { quantity: 'sum', price: 'sum' },\n * cells: { product: 'Totals:' },\n * },\n * ],\n * }),\n * ],\n * };\n * ```\n *\n * @see {@link PinnedRowsConfig} for all configuration options\n * @see {@link AggregationRowConfig} for aggregation row structure\n *\n * @internal Extends BaseGridPlugin\n */\nexport class PinnedRowsPlugin extends BaseGridPlugin<PinnedRowsConfig> {\n /** @internal */\n readonly name = 'pinnedRows';\n /** @internal */\n override readonly styles = styles;\n\n /** @internal */\n protected override get defaultConfig(): Partial<PinnedRowsConfig> {\n return {\n position: 'bottom',\n showRowCount: true,\n showSelectedCount: true,\n showFilteredCount: true,\n };\n }\n\n // #region Internal State\n private infoBarElement: HTMLElement | null = null;\n private topAggregationContainer: HTMLElement | null = null;\n private bottomAggregationContainer: HTMLElement | null = null;\n private footerWrapper: HTMLElement | null = null;\n // #endregion\n\n // #region Lifecycle\n /** @internal */\n override detach(): void {\n if (this.infoBarElement) {\n this.infoBarElement.remove();\n this.infoBarElement = null;\n }\n if (this.topAggregationContainer) {\n this.topAggregationContainer.remove();\n this.topAggregationContainer = null;\n }\n if (this.bottomAggregationContainer) {\n this.bottomAggregationContainer.remove();\n this.bottomAggregationContainer = null;\n }\n if (this.footerWrapper) {\n this.footerWrapper.remove();\n this.footerWrapper = null;\n }\n }\n // #endregion\n\n // #region Hooks\n /** @internal */\n override afterRender(): void {\n const gridEl = this.gridElement;\n if (!gridEl) return;\n\n // Use .tbw-scroll-area so footer is inside the horizontal scroll area,\n // otherwise fall back to .tbw-grid-content or root container\n const container =\n gridEl.querySelector('.tbw-scroll-area') ?? gridEl.querySelector('.tbw-grid-content') ?? gridEl.children[0];\n if (!container) return;\n\n // Clear orphaned element references if they were removed from the DOM\n // (e.g., by buildGridDOMIntoShadow calling replaceChildren())\n // We check if the element is still inside the container rather than isConnected,\n // because in unit tests the mock grid may not be attached to document.body\n if (this.footerWrapper && !container.contains(this.footerWrapper)) {\n this.footerWrapper = null;\n this.bottomAggregationContainer = null;\n this.infoBarElement = null;\n }\n if (this.topAggregationContainer && !container.contains(this.topAggregationContainer)) {\n this.topAggregationContainer = null;\n }\n if (this.infoBarElement && !container.contains(this.infoBarElement)) {\n this.infoBarElement = null;\n }\n\n // Build context with plugin states\n const selectionState = this.getSelectionState();\n const filterState = this.getFilterState();\n\n const context = buildContext(\n this.sourceRows as unknown[],\n this.columns as unknown[],\n this.gridElement,\n selectionState,\n filterState,\n );\n\n // #region Handle Aggregation Rows\n const aggregationRows = this.config.aggregationRows || [];\n const topRows = aggregationRows.filter((r) => r.position === 'top');\n const bottomRows = aggregationRows.filter((r) => r.position !== 'top');\n\n // Top aggregation rows\n if (topRows.length > 0) {\n if (!this.topAggregationContainer) {\n this.topAggregationContainer = createAggregationContainer('top');\n const header = gridEl.querySelector('.header');\n if (header && header.nextSibling) {\n container.insertBefore(this.topAggregationContainer, header.nextSibling);\n } else {\n container.appendChild(this.topAggregationContainer);\n }\n }\n renderAggregationRows(\n this.topAggregationContainer,\n topRows,\n this.visibleColumns as ColumnConfig[],\n this.sourceRows as unknown[],\n this.config.fullWidth,\n );\n } else if (this.topAggregationContainer) {\n this.topAggregationContainer.remove();\n this.topAggregationContainer = null;\n }\n\n // Handle footer\n const hasInfoContent =\n this.config.showRowCount !== false ||\n (this.config.showSelectedCount && context.selectedRows > 0) ||\n (this.config.showFilteredCount && context.filteredRows !== context.totalRows) ||\n (this.config.customPanels && this.config.customPanels.length > 0);\n const hasBottomInfoBar = hasInfoContent && this.config.position !== 'top';\n const needsFooter = bottomRows.length > 0 || hasBottomInfoBar;\n\n // Handle top info bar\n if (hasInfoContent && this.config.position === 'top') {\n if (!this.infoBarElement) {\n this.infoBarElement = createInfoBarElement(this.config, context);\n container.insertBefore(this.infoBarElement, container.firstChild);\n } else {\n const newInfoBar = createInfoBarElement(this.config, context);\n this.infoBarElement.replaceWith(newInfoBar);\n this.infoBarElement = newInfoBar;\n }\n } else if (this.config.position === 'top' && this.infoBarElement) {\n this.infoBarElement.remove();\n this.infoBarElement = null;\n }\n\n // Create/manage footer wrapper\n if (needsFooter) {\n if (!this.footerWrapper) {\n this.footerWrapper = document.createElement('div');\n this.footerWrapper.className = 'tbw-footer';\n container.appendChild(this.footerWrapper);\n }\n\n this.footerWrapper.innerHTML = '';\n\n if (bottomRows.length > 0) {\n if (!this.bottomAggregationContainer) {\n this.bottomAggregationContainer = createAggregationContainer('bottom');\n }\n this.footerWrapper.appendChild(this.bottomAggregationContainer);\n renderAggregationRows(\n this.bottomAggregationContainer,\n bottomRows,\n this.visibleColumns as ColumnConfig[],\n this.sourceRows as unknown[],\n this.config.fullWidth,\n );\n }\n\n if (hasBottomInfoBar) {\n this.infoBarElement = createInfoBarElement(this.config, context);\n this.footerWrapper.appendChild(this.infoBarElement);\n }\n } else {\n this.cleanupFooter();\n }\n // #endregion\n }\n // #endregion\n\n // #region Private Methods\n private cleanup(): void {\n if (this.infoBarElement) {\n this.infoBarElement.remove();\n this.infoBarElement = null;\n }\n if (this.topAggregationContainer) {\n this.topAggregationContainer.remove();\n this.topAggregationContainer = null;\n }\n if (this.bottomAggregationContainer) {\n this.bottomAggregationContainer.remove();\n this.bottomAggregationContainer = null;\n }\n if (this.footerWrapper) {\n this.footerWrapper.remove();\n this.footerWrapper = null;\n }\n }\n\n private cleanupFooter(): void {\n if (this.footerWrapper) {\n this.footerWrapper.remove();\n this.footerWrapper = null;\n }\n if (this.bottomAggregationContainer) {\n this.bottomAggregationContainer.remove();\n this.bottomAggregationContainer = null;\n }\n if (this.infoBarElement && this.config.position !== 'top') {\n this.infoBarElement.remove();\n this.infoBarElement = null;\n }\n }\n\n private getSelectionState(): { selected: Set<number> } | null {\n // Try to get selection plugin state\n try {\n return (this.grid?.getPluginState?.('selection') as { selected: Set<number> } | null) ?? null;\n } catch {\n return null;\n }\n }\n\n private getFilterState(): { cachedResult: unknown[] | null } | null {\n try {\n return (this.grid?.getPluginState?.('filtering') as { cachedResult: unknown[] | null } | null) ?? null;\n } catch {\n return null;\n }\n }\n // #endregion\n\n // #region Public API\n /**\n * Refresh the status bar to reflect current grid state.\n */\n refresh(): void {\n this.requestRender();\n }\n\n /**\n * Get the current status bar context.\n * @returns The context with row counts and other info\n */\n getContext(): PinnedRowsContext {\n const selectionState = this.getSelectionState();\n const filterState = this.getFilterState();\n\n return buildContext(\n this.rows as unknown[],\n this.columns as unknown[],\n this.gridElement,\n selectionState,\n filterState,\n );\n }\n\n /**\n * Add a custom panel to the info bar.\n * @param panel - The panel configuration to add\n */\n addPanel(panel: PinnedRowsPanel): void {\n if (!this.config.customPanels) {\n this.config.customPanels = [];\n }\n this.config.customPanels.push(panel);\n this.requestRender();\n }\n\n /**\n * Remove a custom panel by ID.\n * @param id - The panel ID to remove\n */\n removePanel(id: string): void {\n if (this.config.customPanels) {\n this.config.customPanels = this.config.customPanels.filter((p) => p.id !== id);\n this.requestRender();\n }\n }\n\n /**\n * Add an aggregation row.\n * @param row - The aggregation row configuration\n */\n addAggregationRow(row: AggregationRowConfig): void {\n if (!this.config.aggregationRows) {\n this.config.aggregationRows = [];\n }\n this.config.aggregationRows.push(row);\n this.requestRender();\n }\n\n /**\n * Remove an aggregation row by ID.\n * @param id - The aggregation row ID to remove\n */\n removeAggregationRow(id: string): void {\n if (this.config.aggregationRows) {\n this.config.aggregationRows = this.config.aggregationRows.filter((r) => r.id !== id);\n this.requestRender();\n }\n }\n // #endregion\n}\n"],"names":["createInfoBarElement","config","context","pinnedRows","document","createElement","className","setAttribute","left","center","right","showRowCount","rowCount","textContent","totalRows","appendChild","showFilteredCount","filteredRows","filteredCount","showSelectedCount","selectedRows","selectedCount","customPanels","panel","panelEl","renderCustomPanel","position","createAggregationContainer","container","renderAggregationRows","rows","columns","dataRows","globalFullWidth","innerHTML","rowConfig","rowEl","id","fullWidth","renderFullWidthAggregationRow","renderPerColumnAggregationRow","cell","style","gridColumn","labelValue","label","labelSpan","aggregatesContainer","hasAggregators","aggregators","Object","keys","length","hasCells","cells","col","value","formatter","resolveAggregatedValue","span","field","header","displayValue","String","children","renderInlineAggregates","aggDef","def","aggFn","getAggregator","aggFunc","prototype","hasOwnProperty","call","staticVal","content","render","buildContext","grid","selectionState","filterState","cachedResult","selected","size","PinnedRowsPlugin","BaseGridPlugin","name","styles","defaultConfig","infoBarElement","topAggregationContainer","bottomAggregationContainer","footerWrapper","detach","this","remove","afterRender","gridEl","gridElement","querySelector","contains","getSelectionState","getFilterState","sourceRows","aggregationRows","topRows","filter","r","bottomRows","nextSibling","insertBefore","visibleColumns","hasInfoContent","hasBottomInfoBar","needsFooter","newInfoBar","replaceWith","firstChild","cleanupFooter","cleanup","getPluginState","refresh","requestRender","getContext","addPanel","push","removePanel","p","addAggregationRow","row","removeAggregationRow"],"mappings":"6aAgCO,SAASA,EAAqBC,EAA0BC,GAC7D,MAAMC,EAAaC,SAASC,cAAc,OAC1CF,EAAWG,UAAY,kBACvBH,EAAWI,aAAa,OAAQ,gBAChCJ,EAAWI,aAAa,YAAa,UAErC,MAAMC,EAAOJ,SAASC,cAAc,OACpCG,EAAKF,UAAY,uBAEjB,MAAMG,EAASL,SAASC,cAAc,OACtCI,EAAOH,UAAY,yBAEnB,MAAMI,EAAQN,SAASC,cAAc,OAIrC,GAHAK,EAAMJ,UAAY,yBAGU,IAAxBL,EAAOU,aAAwB,CACjC,MAAMC,EAAWR,SAASC,cAAc,QACxCO,EAASN,UAAY,8CACrBM,EAASC,YAAc,UAAUX,EAAQY,iBAC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