@toolbox-web/grid 0.2.8 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/README.md +13 -13
  2. package/all.d.ts +25 -5659
  3. package/all.d.ts.map +1 -0
  4. package/all.js +524 -450
  5. package/all.js.map +1 -1
  6. package/index.d.ts +8 -2678
  7. package/index.d.ts.map +1 -0
  8. package/index.js +3929 -25
  9. package/index.js.map +1 -1
  10. package/lib/core/constants.d.ts +114 -0
  11. package/lib/core/constants.d.ts.map +1 -0
  12. package/lib/core/grid.d.ts +337 -0
  13. package/lib/core/grid.d.ts.map +1 -0
  14. package/lib/core/internal/aggregators.d.ts +67 -0
  15. package/lib/core/internal/aggregators.d.ts.map +1 -0
  16. package/lib/core/internal/column-state.d.ts +124 -0
  17. package/lib/core/internal/column-state.d.ts.map +1 -0
  18. package/lib/core/internal/columns.d.ts +107 -0
  19. package/lib/core/internal/columns.d.ts.map +1 -0
  20. package/lib/core/internal/dom-builder.d.ts +115 -0
  21. package/lib/core/internal/dom-builder.d.ts.map +1 -0
  22. package/lib/core/internal/editing.d.ts +76 -0
  23. package/lib/core/internal/editing.d.ts.map +1 -0
  24. package/lib/core/internal/editors.d.ts +8 -0
  25. package/lib/core/internal/editors.d.ts.map +1 -0
  26. package/lib/core/internal/event-delegation.d.ts +11 -0
  27. package/lib/core/internal/event-delegation.d.ts.map +1 -0
  28. package/lib/core/internal/grid-internals.d.ts +83 -0
  29. package/lib/core/internal/grid-internals.d.ts.map +1 -0
  30. package/lib/core/internal/header.d.ts +7 -0
  31. package/lib/core/internal/header.d.ts.map +1 -0
  32. package/lib/core/internal/idle-scheduler.d.ts +65 -0
  33. package/lib/core/internal/idle-scheduler.d.ts.map +1 -0
  34. package/lib/core/internal/inference.d.ts +12 -0
  35. package/lib/core/internal/inference.d.ts.map +1 -0
  36. package/lib/core/internal/keyboard.d.ts +18 -0
  37. package/lib/core/internal/keyboard.d.ts.map +1 -0
  38. package/lib/core/internal/resize.d.ts +3 -0
  39. package/lib/core/internal/resize.d.ts.map +1 -0
  40. package/lib/core/internal/rows.d.ts +35 -0
  41. package/lib/core/internal/rows.d.ts.map +1 -0
  42. package/lib/core/internal/sanitize.d.ts +13 -0
  43. package/lib/core/internal/sanitize.d.ts.map +1 -0
  44. package/lib/core/internal/shell.d.ts +228 -0
  45. package/lib/core/internal/shell.d.ts.map +1 -0
  46. package/lib/core/internal/sorting.d.ts +24 -0
  47. package/lib/core/internal/sorting.d.ts.map +1 -0
  48. package/lib/core/internal/touch-scroll.d.ts +54 -0
  49. package/lib/core/internal/touch-scroll.d.ts.map +1 -0
  50. package/lib/core/internal/utils.d.ts +38 -0
  51. package/lib/core/internal/utils.d.ts.map +1 -0
  52. package/lib/core/internal/virtualization.d.ts +66 -0
  53. package/lib/core/internal/virtualization.d.ts.map +1 -0
  54. package/lib/core/plugin/base-plugin.d.ts +616 -0
  55. package/lib/core/plugin/base-plugin.d.ts.map +1 -0
  56. package/lib/core/plugin/index.d.ts +11 -0
  57. package/lib/core/plugin/index.d.ts.map +1 -0
  58. package/lib/core/plugin/plugin-manager.d.ts +183 -0
  59. package/lib/core/plugin/plugin-manager.d.ts.map +1 -0
  60. package/lib/core/plugin/types.d.ts +196 -0
  61. package/lib/core/plugin/types.d.ts.map +1 -0
  62. package/lib/core/types.d.ts +841 -0
  63. package/lib/core/types.d.ts.map +1 -0
  64. package/lib/plugins/clipboard/ClipboardPlugin.d.ts +46 -0
  65. package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -0
  66. package/lib/plugins/clipboard/copy.d.ts +47 -0
  67. package/lib/plugins/clipboard/copy.d.ts.map +1 -0
  68. package/lib/plugins/clipboard/index.d.ts +7 -0
  69. package/lib/plugins/clipboard/index.d.ts.map +1 -0
  70. package/lib/plugins/clipboard/index.js.map +1 -1
  71. package/lib/plugins/clipboard/paste.d.ts +25 -0
  72. package/lib/plugins/clipboard/paste.d.ts.map +1 -0
  73. package/lib/plugins/clipboard/types.d.ts +40 -0
  74. package/lib/plugins/clipboard/types.d.ts.map +1 -0
  75. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +54 -0
  76. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -0
  77. package/lib/plugins/column-virtualization/column-virtualization.d.ts +53 -0
  78. package/lib/plugins/column-virtualization/column-virtualization.d.ts.map +1 -0
  79. package/lib/plugins/column-virtualization/index.d.ts +7 -0
  80. package/lib/plugins/column-virtualization/index.d.ts.map +1 -0
  81. package/lib/plugins/column-virtualization/index.js.map +1 -1
  82. package/lib/plugins/column-virtualization/types.d.ts +41 -0
  83. package/lib/plugins/column-virtualization/types.d.ts.map +1 -0
  84. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +52 -0
  85. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -0
  86. package/lib/plugins/context-menu/index.d.ts +7 -0
  87. package/lib/plugins/context-menu/index.d.ts.map +1 -0
  88. package/lib/plugins/context-menu/index.js +24 -24
  89. package/lib/plugins/context-menu/index.js.map +1 -1
  90. package/lib/plugins/context-menu/menu.d.ts +38 -0
  91. package/lib/plugins/context-menu/menu.d.ts.map +1 -0
  92. package/lib/plugins/context-menu/types.d.ts +77 -0
  93. package/lib/plugins/context-menu/types.d.ts.map +1 -0
  94. package/lib/plugins/export/ExportPlugin.d.ts +53 -0
  95. package/lib/plugins/export/ExportPlugin.d.ts.map +1 -0
  96. package/lib/plugins/export/csv.d.ts +31 -0
  97. package/lib/plugins/export/csv.d.ts.map +1 -0
  98. package/lib/plugins/export/excel.d.ts +12 -0
  99. package/lib/plugins/export/excel.d.ts.map +1 -0
  100. package/lib/plugins/export/index.d.ts +7 -0
  101. package/lib/plugins/export/index.d.ts.map +1 -0
  102. package/lib/plugins/export/index.js.map +1 -1
  103. package/lib/plugins/export/types.d.ts +57 -0
  104. package/lib/plugins/export/types.d.ts.map +1 -0
  105. package/lib/plugins/filtering/FilteringPlugin.d.ts +128 -0
  106. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -0
  107. package/lib/plugins/filtering/filter-model.d.ts +38 -0
  108. package/lib/plugins/filtering/filter-model.d.ts.map +1 -0
  109. package/lib/plugins/filtering/index.d.ts +7 -0
  110. package/lib/plugins/filtering/index.d.ts.map +1 -0
  111. package/lib/plugins/filtering/index.js +5 -5
  112. package/lib/plugins/filtering/index.js.map +1 -1
  113. package/lib/plugins/filtering/types.d.ts +157 -0
  114. package/lib/plugins/filtering/types.d.ts.map +1 -0
  115. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +51 -0
  116. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -0
  117. package/lib/plugins/grouping-columns/grouping-columns.d.ts +41 -0
  118. package/lib/plugins/grouping-columns/grouping-columns.d.ts.map +1 -0
  119. package/lib/plugins/grouping-columns/index.d.ts +7 -0
  120. package/lib/plugins/grouping-columns/index.d.ts.map +1 -0
  121. package/lib/plugins/grouping-columns/index.js +58 -42
  122. package/lib/plugins/grouping-columns/index.js.map +1 -1
  123. package/lib/plugins/grouping-columns/types.d.ts +91 -0
  124. package/lib/plugins/grouping-columns/types.d.ts.map +1 -0
  125. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +120 -0
  126. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -0
  127. package/lib/plugins/grouping-rows/grouping-rows.d.ts +51 -0
  128. package/lib/plugins/grouping-rows/grouping-rows.d.ts.map +1 -0
  129. package/lib/plugins/grouping-rows/index.d.ts +7 -0
  130. package/lib/plugins/grouping-rows/index.d.ts.map +1 -0
  131. package/lib/plugins/grouping-rows/index.js +51 -51
  132. package/lib/plugins/grouping-rows/index.js.map +1 -1
  133. package/lib/plugins/grouping-rows/types.d.ts +95 -0
  134. package/lib/plugins/grouping-rows/types.d.ts.map +1 -0
  135. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +147 -0
  136. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -0
  137. package/lib/plugins/master-detail/index.d.ts +7 -0
  138. package/lib/plugins/master-detail/index.d.ts.map +1 -0
  139. package/lib/plugins/master-detail/index.js +235 -78
  140. package/lib/plugins/master-detail/index.js.map +1 -1
  141. package/lib/plugins/master-detail/master-detail.d.ts +30 -0
  142. package/lib/plugins/master-detail/master-detail.d.ts.map +1 -0
  143. package/lib/plugins/master-detail/types.d.ts +40 -0
  144. package/lib/plugins/master-detail/types.d.ts.map +1 -0
  145. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts +58 -0
  146. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts.map +1 -0
  147. package/lib/plugins/multi-sort/index.d.ts +7 -0
  148. package/lib/plugins/multi-sort/index.d.ts.map +1 -0
  149. package/lib/plugins/multi-sort/index.js.map +1 -1
  150. package/lib/plugins/multi-sort/multi-sort.d.ts +51 -0
  151. package/lib/plugins/multi-sort/multi-sort.d.ts.map +1 -0
  152. package/lib/plugins/multi-sort/types.d.ts +25 -0
  153. package/lib/plugins/multi-sort/types.d.ts.map +1 -0
  154. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +58 -0
  155. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -0
  156. package/lib/plugins/pinned-columns/index.d.ts +7 -0
  157. package/lib/plugins/pinned-columns/index.d.ts.map +1 -0
  158. package/lib/plugins/pinned-columns/index.js.map +1 -1
  159. package/lib/plugins/pinned-columns/pinned-columns.d.ts +62 -0
  160. package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +1 -0
  161. package/lib/plugins/pinned-columns/types.d.ts +20 -0
  162. package/lib/plugins/pinned-columns/types.d.ts.map +1 -0
  163. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +64 -0
  164. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -0
  165. package/lib/plugins/pinned-rows/index.d.ts +7 -0
  166. package/lib/plugins/pinned-rows/index.d.ts.map +1 -0
  167. package/lib/plugins/pinned-rows/index.js +1 -1
  168. package/lib/plugins/pinned-rows/index.js.map +1 -1
  169. package/lib/plugins/pinned-rows/pinned-rows.d.ts +43 -0
  170. package/lib/plugins/pinned-rows/pinned-rows.d.ts.map +1 -0
  171. package/lib/plugins/pinned-rows/types.d.ts +95 -0
  172. package/lib/plugins/pinned-rows/types.d.ts.map +1 -0
  173. package/lib/plugins/pivot/PivotPlugin.d.ts +94 -0
  174. package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -0
  175. package/lib/plugins/pivot/index.d.ts +7 -0
  176. package/lib/plugins/pivot/index.d.ts.map +1 -0
  177. package/lib/plugins/pivot/index.js.map +1 -1
  178. package/lib/plugins/pivot/pivot-engine.d.ts +50 -0
  179. package/lib/plugins/pivot/pivot-engine.d.ts.map +1 -0
  180. package/lib/plugins/pivot/pivot-model.d.ts +6 -0
  181. package/lib/plugins/pivot/pivot-model.d.ts.map +1 -0
  182. package/lib/plugins/pivot/pivot-panel.d.ts +25 -0
  183. package/lib/plugins/pivot/pivot-panel.d.ts.map +1 -0
  184. package/lib/plugins/pivot/pivot-rows.d.ts +33 -0
  185. package/lib/plugins/pivot/pivot-rows.d.ts.map +1 -0
  186. package/lib/plugins/pivot/types.d.ts +62 -0
  187. package/lib/plugins/pivot/types.d.ts.map +1 -0
  188. package/lib/plugins/reorder/ReorderPlugin.d.ts +81 -0
  189. package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -0
  190. package/lib/plugins/reorder/column-drag.d.ts +41 -0
  191. package/lib/plugins/reorder/column-drag.d.ts.map +1 -0
  192. package/lib/plugins/reorder/index.d.ts +7 -0
  193. package/lib/plugins/reorder/index.d.ts.map +1 -0
  194. package/lib/plugins/reorder/index.js +51 -48
  195. package/lib/plugins/reorder/index.js.map +1 -1
  196. package/lib/plugins/reorder/types.d.ts +54 -0
  197. package/lib/plugins/reorder/types.d.ts.map +1 -0
  198. package/lib/plugins/selection/SelectionPlugin.d.ts +77 -0
  199. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -0
  200. package/lib/plugins/selection/index.d.ts +8 -0
  201. package/lib/plugins/selection/index.d.ts.map +1 -0
  202. package/lib/plugins/selection/index.js +86 -75
  203. package/lib/plugins/selection/index.js.map +1 -1
  204. package/lib/plugins/selection/range-selection.d.ts +109 -0
  205. package/lib/plugins/selection/range-selection.d.ts.map +1 -0
  206. package/lib/plugins/selection/row-selection.d.ts +48 -0
  207. package/lib/plugins/selection/row-selection.d.ts.map +1 -0
  208. package/lib/plugins/selection/types.d.ts +80 -0
  209. package/lib/plugins/selection/types.d.ts.map +1 -0
  210. package/lib/plugins/server-side/ServerSidePlugin.d.ts +56 -0
  211. package/lib/plugins/server-side/ServerSidePlugin.d.ts.map +1 -0
  212. package/lib/plugins/server-side/cache.d.ts +14 -0
  213. package/lib/plugins/server-side/cache.d.ts.map +1 -0
  214. package/lib/plugins/server-side/datasource.d.ts +12 -0
  215. package/lib/plugins/server-side/datasource.d.ts.map +1 -0
  216. package/lib/plugins/server-side/index.d.ts +7 -0
  217. package/lib/plugins/server-side/index.d.ts.map +1 -0
  218. package/lib/plugins/server-side/index.js.map +1 -1
  219. package/lib/plugins/server-side/types.d.ts +43 -0
  220. package/lib/plugins/server-side/types.d.ts.map +1 -0
  221. package/lib/plugins/tree/TreePlugin.d.ts +49 -0
  222. package/lib/plugins/tree/TreePlugin.d.ts.map +1 -0
  223. package/lib/plugins/tree/index.d.ts +8 -0
  224. package/lib/plugins/tree/index.d.ts.map +1 -0
  225. package/lib/plugins/tree/index.js.map +1 -1
  226. package/lib/plugins/tree/tree-data.d.ts +42 -0
  227. package/lib/plugins/tree/tree-data.d.ts.map +1 -0
  228. package/lib/plugins/tree/tree-detect.d.ts +24 -0
  229. package/lib/plugins/tree/tree-detect.d.ts.map +1 -0
  230. package/lib/plugins/tree/types.d.ts +61 -0
  231. package/lib/plugins/tree/types.d.ts.map +1 -0
  232. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +68 -0
  233. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -0
  234. package/lib/plugins/undo-redo/history.d.ts +64 -0
  235. package/lib/plugins/undo-redo/history.d.ts.map +1 -0
  236. package/lib/plugins/undo-redo/index.d.ts +7 -0
  237. package/lib/plugins/undo-redo/index.d.ts.map +1 -0
  238. package/lib/plugins/undo-redo/index.js.map +1 -1
  239. package/lib/plugins/undo-redo/types.d.ts +41 -0
  240. package/lib/plugins/undo-redo/types.d.ts.map +1 -0
  241. package/lib/plugins/visibility/VisibilityPlugin.d.ts +135 -0
  242. package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -0
  243. package/lib/plugins/visibility/index.d.ts +8 -0
  244. package/lib/plugins/visibility/index.d.ts.map +1 -0
  245. package/lib/plugins/visibility/index.js.map +1 -1
  246. package/lib/plugins/visibility/types.d.ts +33 -0
  247. package/lib/plugins/visibility/types.d.ts.map +1 -0
  248. package/lib/plugins/visibility/visibility.d.ts +30 -0
  249. package/lib/plugins/visibility/visibility.d.ts.map +1 -0
  250. package/package.json +6 -2
  251. package/public.d.ts +52 -0
  252. package/public.d.ts.map +1 -0
  253. package/umd/grid.all.umd.js +32 -74
  254. package/umd/grid.all.umd.js.map +1 -1
  255. package/umd/grid.umd.js +22 -64
  256. package/umd/grid.umd.js.map +1 -1
  257. package/umd/plugins/context-menu.umd.js +1 -1
  258. package/umd/plugins/context-menu.umd.js.map +1 -1
  259. package/umd/plugins/filtering.umd.js +1 -1
  260. package/umd/plugins/filtering.umd.js.map +1 -1
  261. package/umd/plugins/grouping-columns.umd.js +1 -1
  262. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  263. package/umd/plugins/grouping-rows.umd.js +1 -1
  264. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  265. package/umd/plugins/master-detail.umd.js +1 -1
  266. package/umd/plugins/master-detail.umd.js.map +1 -1
  267. package/umd/plugins/pinned-rows.umd.js +1 -1
  268. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  269. package/umd/plugins/pivot.umd.js.map +1 -1
  270. package/umd/plugins/selection.umd.js +1 -1
  271. package/umd/plugins/selection.umd.js.map +1 -1
  272. package/index-YjW60MHD.js +0 -3235
  273. package/index-YjW60MHD.js.map +0 -1
@@ -0,0 +1,50 @@
1
+ import { PivotConfig, PivotResult, PivotRow, PivotValueField } from './types';
2
+ export type PivotDataRow = Record<string, unknown>;
3
+ /**
4
+ * Build a hierarchical pivot result from flat data.
5
+ * Supports multiple row group fields for nested hierarchy.
6
+ */
7
+ export declare function buildPivot(rows: PivotDataRow[], config: PivotConfig): PivotResult;
8
+ /**
9
+ * Get unique column key combinations from the data.
10
+ */
11
+ export declare function getUniqueColumnKeys(rows: PivotDataRow[], columnFields: string[]): string[];
12
+ /**
13
+ * Group rows by a single field.
14
+ */
15
+ export declare function groupByField(rows: PivotDataRow[], field: string): Map<string, PivotDataRow[]>;
16
+ /**
17
+ * Group rows by multiple fields (legacy flat grouping).
18
+ */
19
+ export declare function groupByFields(rows: PivotDataRow[], fields: string[]): Map<string, PivotDataRow[]>;
20
+ /**
21
+ * Build hierarchical pivot rows recursively.
22
+ * Each level of rowGroupFields creates a new depth level.
23
+ */
24
+ export declare function buildHierarchicalPivotRows(rows: PivotDataRow[], rowGroupFields: string[], columnFields: string[], columnKeys: string[], valueFields: PivotValueField[], depth: number, parentKey: string): PivotRow[];
25
+ /**
26
+ * Aggregate values for a set of rows across all column keys.
27
+ */
28
+ export declare function aggregateValues(rows: PivotDataRow[], columnFields: string[], columnKeys: string[], valueFields: PivotValueField[]): Record<string, number | null>;
29
+ /**
30
+ * Calculate the total for a row's values.
31
+ */
32
+ export declare function calculateRowTotal(values: Record<string, number | null>): number;
33
+ /**
34
+ * Legacy flat pivot row building (for backwards compatibility).
35
+ */
36
+ export declare function buildPivotRows(groupedData: Map<string, PivotDataRow[]>, columnFields: string[], columnKeys: string[], valueFields: PivotValueField[], depth: number): PivotRow[];
37
+ /**
38
+ * Calculate grand totals across all pivot rows.
39
+ */
40
+ export declare function calculateTotals(pivotRows: PivotRow[], columnKeys: string[], valueFields: PivotValueField[]): Record<string, number>;
41
+ /**
42
+ * Flatten hierarchical pivot rows for rendering.
43
+ * Respects expanded state - only includes children of expanded groups.
44
+ */
45
+ export declare function flattenPivotRows(rows: PivotRow[], expandedKeys?: Set<string>, defaultExpanded?: boolean): PivotRow[];
46
+ /**
47
+ * Get all group keys from pivot rows (for expand all / collapse all).
48
+ */
49
+ export declare function getAllGroupKeys(rows: PivotRow[]): string[];
50
+ //# sourceMappingURL=pivot-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pivot-engine.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/pivot/pivot-engine.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEnF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEnD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,WAAW,GAAG,WAAW,CA6BjF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAS1F;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAc7F;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAcjG;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,YAAY,EAAE,EACpB,cAAc,EAAE,MAAM,EAAE,EACxB,YAAY,EAAE,MAAM,EAAE,EACtB,UAAU,EAAE,MAAM,EAAE,EACpB,WAAW,EAAE,eAAe,EAAE,EAC9B,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB,QAAQ,EAAE,CA+DZ;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,YAAY,EAAE,EACpB,YAAY,EAAE,MAAM,EAAE,EACtB,UAAU,EAAE,MAAM,EAAE,EACpB,WAAW,EAAE,eAAe,EAAE,GAC7B,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAqB/B;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GAAG,MAAM,CAM/E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,EACxC,YAAY,EAAE,MAAM,EAAE,EACtB,UAAU,EAAE,MAAM,EAAE,EACpB,WAAW,EAAE,eAAe,EAAE,EAC9B,KAAK,EAAE,MAAM,GACZ,QAAQ,EAAE,CAmBZ;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,QAAQ,EAAE,EACrB,UAAU,EAAE,MAAM,EAAE,EACpB,WAAW,EAAE,eAAe,EAAE,GAC7B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAsBxB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,eAAe,UAAO,GAAG,QAAQ,EAAE,CAsBjH;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,CAmB1D"}
@@ -0,0 +1,6 @@
1
+ import { getValueAggregator } from '../../core/internal/aggregators';
2
+ import { PivotConfig } from './types';
3
+ export declare const getPivotAggregator: typeof getValueAggregator;
4
+ export declare function validatePivotConfig(config: PivotConfig): string[];
5
+ export declare function createValueKey(columnValues: string[], valueField: string): string;
6
+ //# sourceMappingURL=pivot-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pivot-model.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/pivot/pivot-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,eAAO,MAAM,kBAAkB,2BAAqB,CAAC;AAErD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE,CAYjE;AAED,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAEjF"}
@@ -0,0 +1,25 @@
1
+ import { AggFunc, PivotConfig } from './types';
2
+ /** All available aggregation functions */
3
+ export declare const AGG_FUNCS: AggFunc[];
4
+ /** Field info for available fields */
5
+ export interface FieldInfo {
6
+ field: string;
7
+ header: string;
8
+ }
9
+ /** Callbacks for panel interactions */
10
+ export interface PanelCallbacks {
11
+ onTogglePivot: (enabled: boolean) => void;
12
+ onAddFieldToZone: (field: string, zone: 'rowGroups' | 'columnGroups') => void;
13
+ onRemoveFieldFromZone: (field: string, zone: 'rowGroups' | 'columnGroups') => void;
14
+ onAddValueField: (field: string, aggFunc: AggFunc) => void;
15
+ onRemoveValueField: (field: string) => void;
16
+ onUpdateValueAggFunc: (field: string, aggFunc: AggFunc) => void;
17
+ onOptionChange: (option: 'showTotals' | 'showGrandTotal', value: boolean) => void;
18
+ getAvailableFields: () => FieldInfo[];
19
+ }
20
+ /**
21
+ * Render the complete pivot panel content.
22
+ * Returns a cleanup function that removes all event listeners and DOM elements.
23
+ */
24
+ export declare function renderPivotPanel(container: HTMLElement, config: PivotConfig, isActive: boolean, callbacks: PanelCallbacks): () => void;
25
+ //# sourceMappingURL=pivot-panel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pivot-panel.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/pivot/pivot-panel.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAmB,MAAM,SAAS,CAAC;AAErE,0CAA0C;AAC1C,eAAO,MAAM,SAAS,EAAE,OAAO,EAA2D,CAAC;AAE3F,sCAAsC;AACtC,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,uCAAuC;AACvC,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,cAAc,KAAK,IAAI,CAAC;IAC9E,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,cAAc,KAAK,IAAI,CAAC;IACnF,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3D,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAChE,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,GAAG,gBAAgB,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAClF,kBAAkB,EAAE,MAAM,SAAS,EAAE,CAAC;CACvC;AASD;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,WAAW,EACtB,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,OAAO,EACjB,SAAS,EAAE,cAAc,GACxB,MAAM,IAAI,CA8BZ"}
@@ -0,0 +1,33 @@
1
+ import { ColumnConfig, IconValue } from '../../core/types';
2
+ /** Row data with pivot metadata */
3
+ export interface PivotRowData {
4
+ __pivotRowKey?: string;
5
+ __pivotLabel?: string;
6
+ __pivotDepth?: number;
7
+ __pivotIndent?: number;
8
+ __pivotExpanded?: boolean;
9
+ __pivotHasChildren?: boolean;
10
+ __pivotRowCount?: number;
11
+ __pivotIsGrandTotal?: boolean;
12
+ [key: string]: unknown;
13
+ }
14
+ /** Context for row rendering */
15
+ export interface RowRenderContext {
16
+ columns: ColumnConfig[];
17
+ onToggle: (key: string) => void;
18
+ resolveIcon: (iconKey: 'expand' | 'collapse') => IconValue;
19
+ setIcon: (element: HTMLElement, icon: IconValue) => void;
20
+ }
21
+ /**
22
+ * Render a pivot group row (has children, can expand/collapse).
23
+ */
24
+ export declare function renderPivotGroupRow(row: PivotRowData, rowEl: HTMLElement, ctx: RowRenderContext): boolean;
25
+ /**
26
+ * Render a pivot leaf row (no children, just indentation).
27
+ */
28
+ export declare function renderPivotLeafRow(row: PivotRowData, rowEl: HTMLElement, columns: ColumnConfig[]): boolean;
29
+ /**
30
+ * Render the grand total row.
31
+ */
32
+ export declare function renderPivotGrandTotalRow(row: PivotRowData, rowEl: HTMLElement, columns: ColumnConfig[]): boolean;
33
+ //# sourceMappingURL=pivot-rows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pivot-rows.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/pivot/pivot-rows.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEhE,mCAAmC;AACnC,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,gCAAgC;AAChC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,WAAW,EAAE,CAAC,OAAO,EAAE,QAAQ,GAAG,UAAU,KAAK,SAAS,CAAC;IAC3D,OAAO,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CAC1D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAsDzG;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAgC1G;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CA4BhH"}
@@ -0,0 +1,62 @@
1
+ import { ExpandCollapseAnimation } from '../../core/types';
2
+ export type { ExpandCollapseAnimation } from '../../core/types';
3
+ /** Available aggregation function types */
4
+ export type AggFunc = 'sum' | 'avg' | 'count' | 'min' | 'max' | 'first' | 'last';
5
+ export interface PivotConfig {
6
+ /** Whether pivot view is active on load (default: true when fields are configured) */
7
+ active?: boolean;
8
+ rowGroupFields?: string[];
9
+ columnGroupFields?: string[];
10
+ valueFields?: PivotValueField[];
11
+ showTotals?: boolean;
12
+ showGrandTotal?: boolean;
13
+ /** Whether groups are expanded by default (default: true) */
14
+ defaultExpanded?: boolean;
15
+ /** Indent width per depth level in pixels (default: 20) */
16
+ indentWidth?: number;
17
+ /** Whether to show the pivot configuration tool panel (default: true) */
18
+ showToolPanel?: boolean;
19
+ /**
20
+ * Animation style for expanding/collapsing groups.
21
+ * - `false`: No animation
22
+ * - `'slide'`: Slide animation (default)
23
+ * - `'fade'`: Fade animation
24
+ * @default 'slide'
25
+ */
26
+ animation?: ExpandCollapseAnimation;
27
+ }
28
+ export interface PivotValueField {
29
+ field: string;
30
+ aggFunc: AggFunc;
31
+ header?: string;
32
+ }
33
+ export interface PivotState {
34
+ isActive: boolean;
35
+ pivotResult: PivotResult | null;
36
+ expandedKeys: Set<string>;
37
+ }
38
+ export interface PivotResult {
39
+ rows: PivotRow[];
40
+ columnKeys: string[];
41
+ totals: Record<string, number>;
42
+ grandTotal: number;
43
+ }
44
+ export interface PivotRow {
45
+ /** Unique key for this row (hierarchical path) */
46
+ rowKey: string;
47
+ /** Display label for this row */
48
+ rowLabel: string;
49
+ /** Depth level (0 = top level) */
50
+ depth: number;
51
+ /** Aggregated values by column key */
52
+ values: Record<string, number | null>;
53
+ /** Row total across all columns */
54
+ total?: number;
55
+ /** Whether this row has children (is a group header) */
56
+ isGroup: boolean;
57
+ /** Child rows (for hierarchical grouping) */
58
+ children?: PivotRow[];
59
+ /** Number of data rows in this group */
60
+ rowCount?: number;
61
+ }
62
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/pivot/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChE,YAAY,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,2CAA2C;AAC3C,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;AAEjF,MAAM,WAAW,WAAW;IAC1B,sFAAsF;IACtF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;IAChC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,6DAA6D;IAC7D,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,uBAAuB,CAAC;CACrC;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;IACtC,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,OAAO,EAAE,OAAO,CAAC;IACjB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IACtB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,81 @@
1
+ import { BaseGridPlugin } from '../../core/plugin/base-plugin';
2
+ import { ReorderConfig } from './types';
3
+ /**
4
+ * Column Reordering Plugin for tbw-grid
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * new ReorderPlugin()
9
+ * ```
10
+ */
11
+ export declare class ReorderPlugin extends BaseGridPlugin<ReorderConfig> {
12
+ readonly name = "reorder";
13
+ readonly version = "1.0.0";
14
+ protected get defaultConfig(): Partial<ReorderConfig>;
15
+ /**
16
+ * Resolve animation type from plugin config.
17
+ * Respects grid-level animation.mode (disabled = no animation).
18
+ */
19
+ private get animationType();
20
+ /**
21
+ * Check if animations are enabled at the grid level.
22
+ * Respects gridConfig.animation.mode and CSS variable.
23
+ */
24
+ private get isAnimationEnabled();
25
+ /**
26
+ * Get animation duration from CSS variable (set by grid config).
27
+ */
28
+ private get animationDuration();
29
+ private isDragging;
30
+ private draggedField;
31
+ private draggedIndex;
32
+ private dropIndex;
33
+ attach(grid: import('../../core/plugin/base-plugin').GridElement): void;
34
+ detach(): void;
35
+ afterRender(): void;
36
+ /**
37
+ * Handle Alt+Arrow keyboard shortcuts for column reordering.
38
+ */
39
+ onKeyDown(event: KeyboardEvent): boolean | void;
40
+ /**
41
+ * Get the current column order from the grid.
42
+ * @returns Array of field names in display order
43
+ */
44
+ getColumnOrder(): string[];
45
+ /**
46
+ * Move a column to a new position.
47
+ * @param field - The field name of the column to move
48
+ * @param toIndex - The target index
49
+ */
50
+ moveColumn(field: string, toIndex: number): void;
51
+ /**
52
+ * Set a specific column order.
53
+ * @param order - Array of field names in desired order
54
+ */
55
+ setColumnOrder(order: string[]): void;
56
+ /**
57
+ * Reset column order to the original configuration order.
58
+ */
59
+ resetColumnOrder(): void;
60
+ /**
61
+ * Capture header cell positions before reorder.
62
+ */
63
+ private captureHeaderPositions;
64
+ /**
65
+ * Apply FLIP animation for column reorder.
66
+ * Uses CSS transitions - JS sets initial transform and toggles class.
67
+ * @param oldPositions - Header positions captured before DOM change
68
+ */
69
+ private animateFLIP;
70
+ /**
71
+ * Apply crossfade animation for moved columns.
72
+ * Uses CSS keyframes - JS just toggles classes.
73
+ */
74
+ private animateFade;
75
+ /**
76
+ * Update column order with configured animation.
77
+ */
78
+ private updateColumnOrder;
79
+ readonly styles: string;
80
+ }
81
+ //# sourceMappingURL=ReorderPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReorderPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/reorder/ReorderPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAkB,MAAM,+BAA+B,CAAC;AAI/E,OAAO,KAAK,EAAoB,aAAa,EAAE,MAAM,SAAS,CAAC;AAa/D;;;;;;;GAOG;AACH,qBAAa,aAAc,SAAQ,cAAc,CAAC,aAAa,CAAC;IAC9D,QAAQ,CAAC,IAAI,aAAa;IAC1B,SAAkB,OAAO,WAAW;IAEpC,cAAuB,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC,CAI7D;IAED;;;OAGG;IACH,OAAO,KAAK,aAAa,GAYxB;IAED;;;OAGG;IACH,OAAO,KAAK,kBAAkB,GAkB7B;IAED;;OAEG;IACH,OAAO,KAAK,iBAAiB,GAe5B;IAGD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,SAAS,CAAuB;IAK/B,MAAM,CAAC,IAAI,EAAE,OAAO,+BAA+B,EAAE,WAAW,GAAG,IAAI;IAiBvE,MAAM,IAAI,IAAI;IAUd,WAAW,IAAI,IAAI;IAyG5B;;OAEG;IACM,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,GAAG,IAAI;IAuDxD;;;OAGG;IACH,cAAc,IAAI,MAAM,EAAE;IAI1B;;;;OAIG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAkBhD;;;OAGG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAIrC;;OAEG;IACH,gBAAgB,IAAI,IAAI;IAQxB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAS9B;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAmDnB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAgDnB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAqBzB,SAAkB,MAAM,SAAU;CAEnC"}
@@ -0,0 +1,41 @@
1
+ import { ColumnConfig } from '../../core/types';
2
+ /**
3
+ * Check if a column can be moved based on its own metadata.
4
+ * This checks column-level properties like lockPosition and suppressMovable.
5
+ *
6
+ * Note: For full movability checks including plugin constraints (e.g., pinned columns),
7
+ * use `grid.queryPlugins({ type: PLUGIN_QUERIES.CAN_MOVE_COLUMN, context: column })`
8
+ * which queries all plugins via the generic plugin query system.
9
+ *
10
+ * @param column - The column configuration to check
11
+ * @returns True if the column can be moved based on its metadata
12
+ */
13
+ export declare function canMoveColumn<TRow = unknown>(column: ColumnConfig<TRow>): boolean;
14
+ /**
15
+ * Move a column from one position to another in the order array.
16
+ *
17
+ * @param columns - Array of field names in current order
18
+ * @param fromIndex - The current index of the column to move
19
+ * @param toIndex - The target index to move the column to
20
+ * @returns New array with updated order
21
+ */
22
+ export declare function moveColumn(columns: string[], fromIndex: number, toIndex: number): string[];
23
+ /**
24
+ * Calculate the drop index based on the current drag position.
25
+ *
26
+ * @param dragX - The current X position of the drag
27
+ * @param headerRect - The bounding rect of the header container
28
+ * @param columnWidths - Array of column widths in order
29
+ * @returns The index where the column should be dropped
30
+ */
31
+ export declare function getDropIndex(dragX: number, headerRect: DOMRect, columnWidths: number[]): number;
32
+ /**
33
+ * Reorder columns according to a specified order.
34
+ * Columns not in the order array are appended at the end.
35
+ *
36
+ * @param columns - Array of column configurations
37
+ * @param order - Array of field names specifying the desired order
38
+ * @returns New array of columns in the specified order
39
+ */
40
+ export declare function reorderColumns<TRow = unknown>(columns: ColumnConfig<TRow>[], order: string[]): ColumnConfig<TRow>[];
41
+ //# sourceMappingURL=column-drag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column-drag.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/reorder/column-drag.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,IAAI,GAAG,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,GAAG,OAAO,CAIjF;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAS1F;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,CAU/F;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,GAAG,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,EAAE,CAmBnH"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Reorder Plugin Entry Point
3
+ * Re-exports plugin class and types for tree-shakeable imports.
4
+ */
5
+ export { ReorderPlugin } from './ReorderPlugin';
6
+ export type { ReorderAnimation, ReorderConfig } from './types';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/reorder/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
@@ -1,34 +1,37 @@
1
- function E(a, t) {
2
- if (a._virtualization?.enabled) {
3
- const { rowHeight: n, container: o, viewportEl: l } = a._virtualization, s = o, d = l?.clientHeight ?? s?.clientHeight ?? 0;
1
+ function E(n) {
2
+ n && n.querySelectorAll(".cell-focus").forEach((t) => t.classList.remove("cell-focus"));
3
+ }
4
+ const R = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
5
+ function y(n, t) {
6
+ if (n._virtualization?.enabled) {
7
+ const { rowHeight: a, container: o, viewportEl: l } = n._virtualization, s = o, d = l?.clientHeight ?? s?.clientHeight ?? 0;
4
8
  if (s && d > 0) {
5
- const f = a._focusRow * n;
6
- f < s.scrollTop ? s.scrollTop = f : f + n > s.scrollTop + d && (s.scrollTop = f - d + n);
9
+ const f = n._focusRow * a;
10
+ f < s.scrollTop ? s.scrollTop = f : f + a > s.scrollTop + d && (s.scrollTop = f - d + a);
7
11
  }
8
12
  }
9
- a._activeEditRows !== void 0 && a._activeEditRows !== -1 || a.refreshVirtualWindow(!1), Array.from(a._bodyEl.querySelectorAll(".cell-focus")).forEach((n) => n.classList.remove("cell-focus")), Array.from(a._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((n) => {
10
- n.setAttribute("aria-selected", "false");
13
+ const e = n._activeEditRows !== void 0 && n._activeEditRows !== -1;
14
+ e || n.refreshVirtualWindow(!1), E(n._bodyEl), Array.from(n._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((a) => {
15
+ a.setAttribute("aria-selected", "false");
11
16
  });
12
- const i = a._focusRow, r = a._virtualization.start ?? 0, c = a._virtualization.end ?? a._rows.length;
17
+ const i = n._focusRow, r = n._virtualization.start ?? 0, c = n._virtualization.end ?? n._rows.length;
13
18
  if (i >= r && i < c) {
14
- const n = a._bodyEl.querySelectorAll(".data-grid-row")[i - r], o = n?.children[a._focusCol];
19
+ const a = n._bodyEl.querySelectorAll(".data-grid-row")[i - r], o = a?.children[n._focusCol];
15
20
  if (o) {
16
21
  o.classList.add("cell-focus"), o.setAttribute("aria-selected", "true");
17
- const l = a.shadowRoot?.querySelector(".tbw-scroll-area");
18
- if (l && o) {
19
- const s = a._getHorizontalScrollOffsets?.(n ?? void 0, o) ?? { left: 0, right: 0 };
22
+ const l = n.shadowRoot?.querySelector(".tbw-scroll-area");
23
+ if (l && o && !e) {
24
+ const s = n._getHorizontalScrollOffsets?.(a ?? void 0, o) ?? { left: 0, right: 0 };
20
25
  if (!s.skipScroll) {
21
26
  const d = o.getBoundingClientRect(), f = l.getBoundingClientRect(), u = d.left - f.left + l.scrollLeft, g = u + d.width, h = l.scrollLeft + s.left, m = l.scrollLeft + l.clientWidth - s.right;
22
27
  u < h ? l.scrollLeft = u - s.left : g > m && (l.scrollLeft = g - l.clientWidth + s.right);
23
28
  }
24
29
  }
25
- if (a._activeEditRows !== void 0 && a._activeEditRows !== -1 && o.classList.contains("editing")) {
26
- const s = o.querySelector(
27
- 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])'
28
- );
30
+ if (n._activeEditRows !== void 0 && n._activeEditRows !== -1 && o.classList.contains("editing")) {
31
+ const s = o.querySelector(R);
29
32
  if (s && document.activeElement !== s)
30
33
  try {
31
- s.focus();
34
+ s.focus({ preventScroll: !0 });
32
35
  } catch {
33
36
  }
34
37
  } else if (!o.contains(document.activeElement)) {
@@ -41,7 +44,7 @@ function E(a, t) {
41
44
  }
42
45
  }
43
46
  }
44
- const R = {
47
+ const L = {
45
48
  expand: "▶",
46
49
  collapse: "▼",
47
50
  sortAsc: "▲",
@@ -54,7 +57,7 @@ const R = {
54
57
  /** Ask if a column can be moved. Context: ColumnConfig. Response: boolean | undefined */
55
58
  CAN_MOVE_COLUMN: "canMoveColumn"
56
59
  };
57
- class y {
60
+ class A {
58
61
  /** Plugin version - override in subclass if needed */
59
62
  version = "1.0.0";
60
63
  /** CSS styles to inject into the grid's shadow DOM */
@@ -179,7 +182,7 @@ class y {
179
182
  */
180
183
  get gridIcons() {
181
184
  const t = this.grid?.gridConfig?.icons ?? {};
182
- return { ...R, ...t };
185
+ return { ...L, ...t };
183
186
  }
184
187
  /**
185
188
  * Resolve an icon value to string or HTMLElement.
@@ -210,17 +213,17 @@ class y {
210
213
  }
211
214
  // #endregion
212
215
  }
213
- function w(a) {
214
- const t = a.meta ?? {};
216
+ function w(n) {
217
+ const t = n.meta ?? {};
215
218
  return t.lockPosition !== !0 && t.suppressMovable !== !0;
216
219
  }
217
- function v(a, t, e) {
218
- if (t === e || t < 0 || t >= a.length || e < 0 || e > a.length) return a;
219
- const i = [...a], [r] = i.splice(t, 1);
220
+ function v(n, t, e) {
221
+ if (t === e || t < 0 || t >= n.length || e < 0 || e > n.length) return n;
222
+ const i = [...n], [r] = i.splice(t, 1);
220
223
  return i.splice(e, 0, r), i;
221
224
  }
222
- const A = '.header-row>.cell[draggable=true]{cursor:grab;position:relative}.header-row>.cell.dragging{opacity:.5;cursor:grabbing}.header-row>.cell.drop-before:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.header-row>.cell.drop-after:after{content:"";position:absolute;right:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.cell.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}@keyframes reorder-fade-in{0%{opacity:0}to{opacity:1}}.cell.fade-animating{animation:reorder-fade-in var(--tbw-animation-duration, .2s) ease-out backwards}';
223
- class L extends y {
225
+ const O = '.header-row>.cell[draggable=true]{cursor:grab;position:relative}.header-row>.cell.dragging{opacity:.5;cursor:grabbing}.header-row>.cell.drop-before:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.header-row>.cell.drop-after:after{content:"";position:absolute;right:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.cell.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}@keyframes reorder-fade-in{0%{opacity:0}to{opacity:1}}.cell.fade-animating{animation:reorder-fade-in var(--tbw-animation-duration, .2s) ease-out backwards}';
226
+ class x extends A {
224
227
  name = "reorder";
225
228
  version = "1.0.0";
226
229
  get defaultConfig() {
@@ -288,11 +291,11 @@ class L extends y {
288
291
  t.querySelectorAll(".header-row > .cell").forEach((i) => {
289
292
  const r = i, c = r.getAttribute("data-field");
290
293
  if (!c) return;
291
- const n = this.columns.find((d) => d.field === c), s = !this.grid.queryPlugins({
294
+ const a = this.columns.find((d) => d.field === c), s = !this.grid.queryPlugins({
292
295
  type: p.CAN_MOVE_COLUMN,
293
- context: n
296
+ context: a
294
297
  }).includes(!1);
295
- if (!n || !w(n) || !s) {
298
+ if (!a || !w(a) || !s) {
296
299
  r.draggable = !1;
297
300
  return;
298
301
  }
@@ -334,8 +337,8 @@ class L extends y {
334
337
  if (i < 0 || i >= r.length) return;
335
338
  const c = r[i];
336
339
  if (!c || !w(c)) return;
337
- const n = this.grid;
338
- if (n.queryPlugins({
340
+ const a = this.grid;
341
+ if (a.queryPlugins({
339
342
  type: p.CAN_MOVE_COLUMN,
340
343
  context: c
341
344
  }).includes(!1)) return;
@@ -344,11 +347,11 @@ class L extends y {
344
347
  const d = t.key === "ArrowLeft" ? s - 1 : s + 1;
345
348
  if (d < 0 || d >= l.length) return;
346
349
  const f = r.find((u) => u.field === l[d]);
347
- if (!(f && n.queryPlugins({
350
+ if (!(f && a.queryPlugins({
348
351
  type: p.CAN_MOVE_COLUMN,
349
352
  context: f
350
353
  }).includes(!1)))
351
- return this.moveColumn(c.field, d), e._focusCol = d, E(this.grid), t.preventDefault(), t.stopPropagation(), !0;
354
+ return this.moveColumn(c.field, d), e._focusCol = d, y(this.grid), t.preventDefault(), t.stopPropagation(), !0;
352
355
  }
353
356
  // #endregion
354
357
  // #region Public API
@@ -410,30 +413,30 @@ class L extends y {
410
413
  const e = this.shadowRoot;
411
414
  if (!e || t.size === 0) return;
412
415
  const i = /* @__PURE__ */ new Map();
413
- if (e.querySelectorAll(".header-row > .cell[data-field]").forEach((n) => {
414
- const o = n.getAttribute("data-field");
416
+ if (e.querySelectorAll(".header-row > .cell[data-field]").forEach((a) => {
417
+ const o = a.getAttribute("data-field");
415
418
  if (!o) return;
416
419
  const l = t.get(o);
417
420
  if (l === void 0) return;
418
- const s = l - n.getBoundingClientRect().left;
421
+ const s = l - a.getBoundingClientRect().left;
419
422
  Math.abs(s) > 1 && i.set(o, s);
420
423
  }), i.size === 0) return;
421
424
  const r = [];
422
- if (e.querySelectorAll(".cell[data-field]").forEach((n) => {
423
- const o = i.get(n.getAttribute("data-field") ?? "");
425
+ if (e.querySelectorAll(".cell[data-field]").forEach((a) => {
426
+ const o = i.get(a.getAttribute("data-field") ?? "");
424
427
  if (o !== void 0) {
425
- const l = n;
428
+ const l = a;
426
429
  l.style.transform = `translateX(${o}px)`, r.push(l);
427
430
  }
428
431
  }), r.length === 0) return;
429
432
  e.host.offsetHeight;
430
433
  const c = this.animationDuration;
431
434
  requestAnimationFrame(() => {
432
- r.forEach((n) => {
433
- n.classList.add("flip-animating"), n.style.transform = "";
435
+ r.forEach((a) => {
436
+ a.classList.add("flip-animating"), a.style.transform = "";
434
437
  }), setTimeout(() => {
435
- r.forEach((n) => {
436
- n.style.transform = "", n.classList.remove("flip-animating");
438
+ r.forEach((a) => {
439
+ a.style.transform = "", a.classList.remove("flip-animating");
437
440
  });
438
441
  }, c + 50);
439
442
  });
@@ -467,10 +470,10 @@ class L extends y {
467
470
  s.classList.add("fade-animating"), c.push(s);
468
471
  }
469
472
  }), c.length === 0) return;
470
- const n = this.animationDuration;
473
+ const a = this.animationDuration;
471
474
  setTimeout(() => {
472
475
  c.forEach((o) => o.classList.remove("fade-animating"));
473
- }, n + 50);
476
+ }, a + 50);
474
477
  }
475
478
  /**
476
479
  * Update column order with configured animation.
@@ -485,10 +488,10 @@ class L extends y {
485
488
  }
486
489
  // #endregion
487
490
  // #region Styles
488
- styles = A;
491
+ styles = O;
489
492
  // #endregion
490
493
  }
491
494
  export {
492
- L as ReorderPlugin
495
+ x as ReorderPlugin
493
496
  };
494
497
  //# sourceMappingURL=index.js.map