@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,147 @@
1
+ import { BaseGridPlugin, GridElement, RowClickEvent } from '../../core/plugin/base-plugin';
2
+ import { ColumnConfig } from '../../core/types';
3
+ import { MasterDetailConfig } from './types';
4
+ /**
5
+ * Master/Detail Plugin for tbw-grid
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * new MasterDetailPlugin({
10
+ * enabled: true,
11
+ * detailRenderer: (row) => `<div>Details for ${row.name}</div>`,
12
+ * expandOnRowClick: true,
13
+ * })
14
+ * ```
15
+ */
16
+ export declare class MasterDetailPlugin extends BaseGridPlugin<MasterDetailConfig> {
17
+ #private;
18
+ readonly name = "masterDetail";
19
+ readonly version = "1.0.0";
20
+ protected get defaultConfig(): Partial<MasterDetailConfig>;
21
+ /**
22
+ * Called when plugin is attached to the grid.
23
+ * Parses light DOM for `<tbw-grid-detail>` elements to configure detail templates.
24
+ */
25
+ attach(grid: GridElement): void;
26
+ /**
27
+ * Parse `<tbw-grid-detail>` elements from the grid's light DOM.
28
+ *
29
+ * Allows declarative configuration:
30
+ * ```html
31
+ * <tbw-grid [rows]="data">
32
+ * <tbw-grid-detail>
33
+ * <div class="detail-content">
34
+ * <p>Name: {{ row.name }}</p>
35
+ * <p>Email: {{ row.email }}</p>
36
+ * </div>
37
+ * </tbw-grid-detail>
38
+ * </tbw-grid>
39
+ * ```
40
+ *
41
+ * Attributes:
42
+ * - `animation`: 'slide' | 'fade' | 'false' (default: 'slide')
43
+ * - `show-expand-column`: 'true' | 'false' (default: 'true')
44
+ * - `expand-on-row-click`: 'true' | 'false' (default: 'false')
45
+ * - `collapse-on-click-outside`: 'true' | 'false' (default: 'false')
46
+ * - `height`: number (pixels) or 'auto' (default: 'auto')
47
+ */
48
+ private parseLightDomDetail;
49
+ /**
50
+ * Check if animations are enabled at the grid level.
51
+ * Respects gridConfig.animation.mode and CSS variable.
52
+ */
53
+ private get isAnimationEnabled();
54
+ /**
55
+ * Get expand/collapse animation style from plugin config.
56
+ */
57
+ private get animationStyle();
58
+ /**
59
+ * Get animation duration from CSS variable (set by grid).
60
+ */
61
+ private get animationDuration();
62
+ /**
63
+ * Apply expand animation to a detail element.
64
+ */
65
+ private animateExpand;
66
+ /**
67
+ * Apply collapse animation to a detail element and remove after animation.
68
+ */
69
+ private animateCollapse;
70
+ private expandedRows;
71
+ private detailElements;
72
+ detach(): void;
73
+ processColumns(columns: readonly ColumnConfig[]): ColumnConfig[];
74
+ onRowClick(event: RowClickEvent): boolean | void;
75
+ onCellClick(): boolean | void;
76
+ afterRender(): void;
77
+ /**
78
+ * Called on scroll to sync detail elements with visible rows.
79
+ * Removes details for rows that scrolled out of view and reattaches for visible rows.
80
+ */
81
+ onScrollRender(): void;
82
+ /**
83
+ * Return total extra height from all expanded detail rows.
84
+ * Used by grid virtualization to adjust scrollbar height.
85
+ */
86
+ getExtraHeight(): number;
87
+ /**
88
+ * Return extra height that appears before a given row index.
89
+ * This is the sum of heights of all expanded details whose parent row is before the given index.
90
+ */
91
+ getExtraHeightBefore(beforeRowIndex: number): number;
92
+ /**
93
+ * Adjust the virtualization start index to keep expanded row visible while its detail is visible.
94
+ * This ensures the detail scrolls smoothly out of view instead of disappearing abruptly.
95
+ */
96
+ adjustVirtualStart(start: number, scrollTop: number, rowHeight: number): number;
97
+ /**
98
+ * Expand the detail row at the given index.
99
+ * @param rowIndex - Index of the row to expand
100
+ */
101
+ expand(rowIndex: number): void;
102
+ /**
103
+ * Collapse the detail row at the given index.
104
+ * @param rowIndex - Index of the row to collapse
105
+ */
106
+ collapse(rowIndex: number): void;
107
+ /**
108
+ * Toggle the detail row at the given index.
109
+ * @param rowIndex - Index of the row to toggle
110
+ */
111
+ toggle(rowIndex: number): void;
112
+ /**
113
+ * Check if the detail row at the given index is expanded.
114
+ * @param rowIndex - Index of the row to check
115
+ * @returns Whether the detail row is expanded
116
+ */
117
+ isExpanded(rowIndex: number): boolean;
118
+ /**
119
+ * Expand all detail rows.
120
+ */
121
+ expandAll(): void;
122
+ /**
123
+ * Collapse all detail rows.
124
+ */
125
+ collapseAll(): void;
126
+ /**
127
+ * Get the indices of all expanded rows.
128
+ * @returns Array of row indices that are expanded
129
+ */
130
+ getExpandedRows(): number[];
131
+ /**
132
+ * Get the detail element for a specific row.
133
+ * @param rowIndex - Index of the row
134
+ * @returns The detail HTMLElement or undefined
135
+ */
136
+ getDetailElement(rowIndex: number): HTMLElement | undefined;
137
+ /**
138
+ * Re-parse light DOM to refresh the detail renderer.
139
+ * Call this after framework templates are registered (e.g., Angular ngAfterContentInit).
140
+ *
141
+ * This allows frameworks to register templates asynchronously and then
142
+ * update the plugin's detailRenderer.
143
+ */
144
+ refreshDetailRenderer(): void;
145
+ readonly styles: string;
146
+ }
147
+ //# sourceMappingURL=MasterDetailPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MasterDetailPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/master-detail/MasterDetailPlugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,kBAAkB,CAAC;AASjE,OAAO,KAAK,EAA+C,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAO/F;;;;;;;;;;;GAWG;AACH,qBAAa,kBAAmB,SAAQ,cAAc,CAAC,kBAAkB,CAAC;;IACxE,QAAQ,CAAC,IAAI,kBAAkB;IAC/B,SAAkB,OAAO,WAAW;IAEpC,cAAuB,aAAa,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAQlE;IAID;;;OAGG;IACM,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAKxC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,mBAAmB;IAqE3B;;;OAGG;IACH,OAAO,KAAK,kBAAkB,GAc7B;IAED;;OAEG;IACH,OAAO,KAAK,cAAc,GAGzB;IAED;;OAEG;IACH,OAAO,KAAK,iBAAiB,GAQ5B;IAED;;OAEG;IACH,OAAO,CAAC,aAAa;IAarB;;OAEG;IACH,OAAO,CAAC,eAAe;IAmBvB,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,cAAc,CAAoC;IAKjD,MAAM,IAAI,IAAI;IAQd,cAAc,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,YAAY,EAAE;IAyEhE,UAAU,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,GAAG,IAAI;IAehD,WAAW,IAAI,OAAO,GAAG,IAAI;IAS7B,WAAW,IAAI,IAAI;IAI5B;;;OAGG;IACM,cAAc,IAAI,IAAI;IA2E/B;;;OAGG;IACM,cAAc,IAAI,MAAM;IAejC;;;OAGG;IACM,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM;IAkB7D;;;OAGG;IACM,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;IAgDxF;;;OAGG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQ9B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQhC;;;OAGG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQ9B;;;;OAIG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAKrC;;OAEG;IACH,SAAS,IAAI,IAAI;IAOjB;;OAEG;IACH,WAAW,IAAI,IAAI;IAKnB;;;OAGG;IACH,eAAe,IAAI,MAAM,EAAE;IAS3B;;;;OAIG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAK3D;;;;;;OAMG;IACH,qBAAqB,IAAI,IAAI;IAc7B,SAAkB,MAAM,SAAU;CAEnC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Master Detail Plugin Entry Point
3
+ * Re-exports plugin class and types for tree-shakeable imports.
4
+ */
5
+ export { MasterDetailPlugin } from './MasterDetailPlugin';
6
+ export type { ExpandCollapseAnimation, MasterDetailConfig } 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/master-detail/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
@@ -1,4 +1,98 @@
1
- const w = {
1
+ const R = /{{\s*([^}]+)\s*}}/g, f = "__DG_EMPTY__", x = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, b = /__(proto|defineGetter|defineSetter)|constructor|window|globalThis|global|process|Function|import|eval|Reflect|Proxy|Error|arguments|document|location|cookie|localStorage|sessionStorage|indexedDB|fetch|XMLHttpRequest|WebSocket|Worker|SharedWorker|ServiceWorker|opener|parent|top|frames|self|this\b/, E = /* @__PURE__ */ new Set([
2
+ "script",
3
+ "iframe",
4
+ "object",
5
+ "embed",
6
+ "form",
7
+ "input",
8
+ "button",
9
+ "textarea",
10
+ "select",
11
+ "link",
12
+ "meta",
13
+ "base",
14
+ "style",
15
+ "template",
16
+ "slot",
17
+ "portal",
18
+ "frame",
19
+ "frameset",
20
+ "applet",
21
+ "noscript",
22
+ "noembed",
23
+ "plaintext",
24
+ "xmp",
25
+ "listing"
26
+ ]), w = /^on\w+$/i, v = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), y = /^\s*(javascript|vbscript|data|blob):/i;
27
+ function S(i) {
28
+ if (!i || typeof i != "string") return "";
29
+ if (i.indexOf("<") === -1) return i;
30
+ const e = document.createElement("template");
31
+ return e.innerHTML = i, C(e.content), e.innerHTML;
32
+ }
33
+ function C(i) {
34
+ const e = [], t = i.querySelectorAll("*");
35
+ for (const n of t) {
36
+ const o = n.tagName.toLowerCase();
37
+ if (E.has(o)) {
38
+ e.push(n);
39
+ continue;
40
+ }
41
+ if ((o === "svg" || n.namespaceURI === "http://www.w3.org/2000/svg") && Array.from(n.attributes).some(
42
+ (s) => w.test(s.name) || s.name === "href" || s.name === "xlink:href"
43
+ )) {
44
+ e.push(n);
45
+ continue;
46
+ }
47
+ const l = [];
48
+ for (const r of n.attributes) {
49
+ const s = r.name.toLowerCase();
50
+ if (w.test(s)) {
51
+ l.push(r.name);
52
+ continue;
53
+ }
54
+ if (v.has(s) && y.test(r.value)) {
55
+ l.push(r.name);
56
+ continue;
57
+ }
58
+ if (s === "style" && /expression\s*\(|javascript:|behavior\s*:/i.test(r.value)) {
59
+ l.push(r.name);
60
+ continue;
61
+ }
62
+ }
63
+ l.forEach((r) => n.removeAttribute(r));
64
+ }
65
+ e.forEach((n) => n.remove());
66
+ }
67
+ function A(i, e) {
68
+ if (!i || i.indexOf("{{") === -1) return i;
69
+ const t = [], n = i.replace(R, (s, a) => {
70
+ const d = D(a, e);
71
+ return t.push({ expr: a.trim(), result: d }), d;
72
+ }), o = H(n), l = t.length && t.every((s) => s.result === "" || s.result === f);
73
+ return /Reflect\.|\bProxy\b|ownKeys\(/.test(i) || l ? "" : o;
74
+ }
75
+ function D(i, e) {
76
+ if (i = (i || "").trim(), !i || /\b(Reflect|Proxy|ownKeys)\b/.test(i)) return f;
77
+ if (i === "value") return e.value == null ? f : String(e.value);
78
+ if (i.startsWith("row.") && !/[()?]/.test(i) && !i.includes(":")) {
79
+ const n = i.slice(4), o = e.row ? e.row[n] : void 0;
80
+ return o == null ? f : String(o);
81
+ }
82
+ if (i.length > 80 || !x.test(i) || b.test(i)) return f;
83
+ const t = i.match(/\./g);
84
+ if (t && t.length > 1) return f;
85
+ try {
86
+ const o = new Function("value", "row", `return (${i});`)(e.value, e.row), l = o == null ? "" : String(o);
87
+ return /Reflect|Proxy|ownKeys/.test(l) ? f : l || f;
88
+ } catch {
89
+ return f;
90
+ }
91
+ }
92
+ function H(i) {
93
+ return i && i.replace(new RegExp(f, "g"), "").replace(/Reflect\.[^<>{}\s]+/g, "").replace(/\bProxy\b/g, "").replace(/ownKeys\([^)]*\)/g, "");
94
+ }
95
+ const k = {
2
96
  expand: "▶",
3
97
  collapse: "▼",
4
98
  sortAsc: "▲",
@@ -8,7 +102,7 @@ const w = {
8
102
  dragHandle: "⋮⋮",
9
103
  toolPanel: "☰"
10
104
  };
11
- class m {
105
+ class _ {
12
106
  /** Plugin version - override in subclass if needed */
13
107
  version = "1.0.0";
14
108
  /** CSS styles to inject into the grid's shadow DOM */
@@ -133,7 +227,7 @@ class m {
133
227
  */
134
228
  get gridIcons() {
135
229
  const e = this.grid?.gridConfig?.icons ?? {};
136
- return { ...w, ...e };
230
+ return { ...k, ...e };
137
231
  }
138
232
  /**
139
233
  * Resolve an icon value to string or HTMLElement.
@@ -164,31 +258,31 @@ class m {
164
258
  }
165
259
  // #endregion
166
260
  }
167
- function p(c, e) {
168
- const t = new Set(c);
261
+ function p(i, e) {
262
+ const t = new Set(i);
169
263
  return t.has(e) ? t.delete(e) : t.add(e), t;
170
264
  }
171
- function x(c, e) {
172
- const t = new Set(c);
265
+ function L(i, e) {
266
+ const t = new Set(i);
173
267
  return t.add(e), t;
174
268
  }
175
- function R(c, e) {
176
- const t = new Set(c);
269
+ function T(i, e) {
270
+ const t = new Set(i);
177
271
  return t.delete(e), t;
178
272
  }
179
- function b(c, e) {
180
- return c.has(e);
273
+ function I(i, e) {
274
+ return i.has(e);
181
275
  }
182
- function E(c, e, t, i) {
276
+ function O(i, e, t, n) {
183
277
  const o = document.createElement("div");
184
278
  o.className = "master-detail-row", o.setAttribute("data-detail-for", String(e)), o.setAttribute("role", "row");
185
- const a = document.createElement("div");
186
- a.className = "master-detail-cell", a.setAttribute("role", "cell"), a.style.gridColumn = `1 / ${i + 1}`;
187
- const r = t(c, e);
188
- return typeof r == "string" ? a.innerHTML = r : r instanceof HTMLElement && a.appendChild(r), o.appendChild(a), o;
279
+ const l = document.createElement("div");
280
+ l.className = "master-detail-cell", l.setAttribute("role", "cell"), l.style.gridColumn = `1 / ${n + 1}`;
281
+ const r = t(i, e);
282
+ return typeof r == "string" ? l.innerHTML = r : r instanceof HTMLElement && l.appendChild(r), o.appendChild(l), o;
189
283
  }
190
- const y = ".master-detail-cell-wrapper{display:flex;align-items:center;gap:4px}.master-detail-toggle{cursor:pointer;opacity:.7;-webkit-user-select:none;user-select:none;display:inline-flex;align-items:center;justify-content:center}.master-detail-toggle:hover{opacity:1}.master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}.master-detail-cell{padding:16px;overflow:auto}.master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:500px;padding-top:16px;padding-bottom:16px}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:500px}to{opacity:0;max-height:0}}";
191
- class C extends m {
284
+ const N = ".master-detail-cell-wrapper{display:flex;align-items:center;gap:4px}.master-detail-toggle{cursor:pointer;opacity:.7;-webkit-user-select:none;user-select:none;display:inline-flex;align-items:center;justify-content:center}.master-detail-toggle:hover{opacity:1}.master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}.master-detail-cell{padding:16px;overflow:auto}.master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:500px;padding-top:16px;padding-bottom:16px}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:500px}to{opacity:0;max-height:0}}";
285
+ class q extends _ {
192
286
  name = "masterDetail";
193
287
  version = "1.0.0";
194
288
  get defaultConfig() {
@@ -201,6 +295,58 @@ class C extends m {
201
295
  // Plugin's own default
202
296
  };
203
297
  }
298
+ // #region Light DOM Parsing
299
+ /**
300
+ * Called when plugin is attached to the grid.
301
+ * Parses light DOM for `<tbw-grid-detail>` elements to configure detail templates.
302
+ */
303
+ attach(e) {
304
+ super.attach(e), this.parseLightDomDetail();
305
+ }
306
+ /**
307
+ * Parse `<tbw-grid-detail>` elements from the grid's light DOM.
308
+ *
309
+ * Allows declarative configuration:
310
+ * ```html
311
+ * <tbw-grid [rows]="data">
312
+ * <tbw-grid-detail>
313
+ * <div class="detail-content">
314
+ * <p>Name: {{ row.name }}</p>
315
+ * <p>Email: {{ row.email }}</p>
316
+ * </div>
317
+ * </tbw-grid-detail>
318
+ * </tbw-grid>
319
+ * ```
320
+ *
321
+ * Attributes:
322
+ * - `animation`: 'slide' | 'fade' | 'false' (default: 'slide')
323
+ * - `show-expand-column`: 'true' | 'false' (default: 'true')
324
+ * - `expand-on-row-click`: 'true' | 'false' (default: 'false')
325
+ * - `collapse-on-click-outside`: 'true' | 'false' (default: 'false')
326
+ * - `height`: number (pixels) or 'auto' (default: 'auto')
327
+ */
328
+ parseLightDomDetail() {
329
+ const e = this.grid;
330
+ if (!e || typeof e.querySelector != "function") return;
331
+ const t = e.querySelector("tbw-grid-detail");
332
+ if (!t) return;
333
+ const n = e;
334
+ if (n.__frameworkAdapter?.parseDetailElement) {
335
+ const c = n.__frameworkAdapter.parseDetailElement(t);
336
+ if (c) {
337
+ this.config = { ...this.config, detailRenderer: c };
338
+ return;
339
+ }
340
+ }
341
+ const o = t.getAttribute("animation"), l = t.getAttribute("show-expand-column"), r = t.getAttribute("expand-on-row-click"), s = t.getAttribute("collapse-on-click-outside"), a = t.getAttribute("height"), d = {};
342
+ o !== null && (d.animation = o === "false" ? !1 : o), l !== null && (d.showExpandColumn = l !== "false"), r !== null && (d.expandOnRowClick = r === "true"), s !== null && (d.collapseOnClickOutside = s === "true"), a !== null && (d.detailHeight = a === "auto" ? "auto" : parseInt(a, 10));
343
+ const u = t.innerHTML.trim();
344
+ u && !this.config.detailRenderer && (d.detailRenderer = (c, h) => {
345
+ const g = A(u, { value: c, row: c });
346
+ return S(g);
347
+ }), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
348
+ }
349
+ // #endregion
204
350
  // #region Animation Helpers
205
351
  /**
206
352
  * Check if animations are enabled at the grid level.
@@ -210,8 +356,8 @@ class C extends m {
210
356
  const t = this.grid.effectiveConfig?.animation?.mode ?? "reduced-motion";
211
357
  if (t === !1 || t === "off") return !1;
212
358
  if (t === !0 || t === "on") return !0;
213
- const i = this.shadowRoot?.host;
214
- return i ? getComputedStyle(i).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
359
+ const n = this.shadowRoot?.host;
360
+ return n ? getComputedStyle(n).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
215
361
  }
216
362
  /**
217
363
  * Get expand/collapse animation style from plugin config.
@@ -225,8 +371,8 @@ class C extends m {
225
371
  get animationDuration() {
226
372
  const e = this.shadowRoot?.host;
227
373
  if (e) {
228
- const t = getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(), i = parseInt(t, 10);
229
- if (!isNaN(i)) return i;
374
+ const t = getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(), n = parseInt(t, 10);
375
+ if (!isNaN(n)) return n;
230
376
  }
231
377
  return 200;
232
378
  }
@@ -251,10 +397,10 @@ class C extends m {
251
397
  return;
252
398
  }
253
399
  e.classList.add("tbw-collapsing");
254
- const i = () => {
400
+ const n = () => {
255
401
  e.classList.remove("tbw-collapsing"), t();
256
402
  };
257
- e.addEventListener("animationend", i, { once: !0 }), setTimeout(i, this.animationDuration + 50);
403
+ e.addEventListener("animationend", n, { once: !0 }), setTimeout(n, this.animationDuration + 50);
258
404
  }
259
405
  // #endregion
260
406
  // #region Internal State
@@ -272,31 +418,31 @@ class C extends m {
272
418
  return [...e];
273
419
  const t = [...e];
274
420
  if (t.length > 0) {
275
- const i = { ...t[0] }, o = i.viewRenderer;
421
+ const n = { ...t[0] }, o = n.viewRenderer;
276
422
  if (o?.__masterDetailWrapped)
277
423
  return t;
278
- const a = (r) => {
279
- const { value: s, row: n } = r, d = this.expandedRows.has(n), l = document.createElement("span");
280
- l.className = "master-detail-cell-wrapper";
281
- const h = document.createElement("span");
282
- h.className = `master-detail-toggle${d ? " expanded" : ""}`, this.setIcon(h, this.resolveIcon(d ? "collapse" : "expand")), h.setAttribute("role", "button"), h.setAttribute("tabindex", "0"), h.setAttribute("aria-expanded", String(d)), h.setAttribute("aria-label", d ? "Collapse details" : "Expand details"), h.addEventListener("click", (g) => {
424
+ const l = (r) => {
425
+ const { value: s, row: a } = r, d = this.expandedRows.has(a), u = document.createElement("span");
426
+ u.className = "master-detail-cell-wrapper";
427
+ const c = document.createElement("span");
428
+ c.className = `master-detail-toggle${d ? " expanded" : ""}`, this.setIcon(c, this.resolveIcon(d ? "collapse" : "expand")), c.setAttribute("role", "button"), c.setAttribute("tabindex", "0"), c.setAttribute("aria-expanded", String(d)), c.setAttribute("aria-label", d ? "Collapse details" : "Expand details"), c.addEventListener("click", (g) => {
283
429
  g.stopPropagation();
284
- const f = this.rows.indexOf(n);
285
- this.expandedRows = p(this.expandedRows, n), this.emit("detail-expand", {
286
- rowIndex: f,
287
- row: n,
288
- expanded: this.expandedRows.has(n)
430
+ const m = this.rows.indexOf(a);
431
+ this.expandedRows = p(this.expandedRows, a), this.emit("detail-expand", {
432
+ rowIndex: m,
433
+ row: a,
434
+ expanded: this.expandedRows.has(a)
289
435
  }), this.requestRender();
290
- }), l.appendChild(h);
291
- const u = document.createElement("span");
436
+ }), u.appendChild(c);
437
+ const h = document.createElement("span");
292
438
  if (o) {
293
439
  const g = o(r);
294
- g instanceof Node ? u.appendChild(g) : u.textContent = String(g ?? s ?? "");
440
+ g instanceof Node ? h.appendChild(g) : h.textContent = String(g ?? s ?? "");
295
441
  } else
296
- u.textContent = String(s ?? "");
297
- return l.appendChild(u), l;
442
+ h.textContent = String(s ?? "");
443
+ return u.appendChild(h), u;
298
444
  };
299
- a.__masterDetailWrapped = !0, i.viewRenderer = a, t[0] = i;
445
+ l.__masterDetailWrapped = !0, n.viewRenderer = l, t[0] = n;
300
446
  }
301
447
  return t;
302
448
  }
@@ -329,26 +475,26 @@ class C extends m {
329
475
  if (!this.config.detailRenderer) return;
330
476
  const e = this.shadowRoot?.querySelector(".rows");
331
477
  if (!e) return;
332
- const t = /* @__PURE__ */ new Map(), i = e.querySelectorAll(".data-grid-row"), o = this.columns.length;
333
- for (const r of i) {
334
- const s = r.querySelector(".cell[data-row]"), n = s ? parseInt(s.getAttribute("data-row") ?? "-1", 10) : -1;
335
- n >= 0 && t.set(n, r);
478
+ const t = /* @__PURE__ */ new Map(), n = e.querySelectorAll(".data-grid-row"), o = this.columns.length;
479
+ for (const r of n) {
480
+ const s = r.querySelector(".cell[data-row]"), a = s ? parseInt(s.getAttribute("data-row") ?? "-1", 10) : -1;
481
+ a >= 0 && t.set(a, r);
336
482
  }
337
- const a = e.querySelectorAll(".master-detail-row");
338
- for (const r of a) {
339
- const s = parseInt(r.getAttribute("data-detail-for") ?? "-1", 10), n = s >= 0 ? this.rows[s] : void 0, d = n && this.expandedRows.has(n), l = t.has(s);
340
- (!d || !l) && (r.remove(), n && this.detailElements.delete(n));
483
+ const l = e.querySelectorAll(".master-detail-row");
484
+ for (const r of l) {
485
+ const s = parseInt(r.getAttribute("data-detail-for") ?? "-1", 10), a = s >= 0 ? this.rows[s] : void 0, d = a && this.expandedRows.has(a), u = t.has(s);
486
+ (!d || !u) && (r.remove(), a && this.detailElements.delete(a));
341
487
  }
342
488
  for (const [r, s] of t) {
343
- const n = this.rows[r];
344
- if (!n || !this.expandedRows.has(n)) continue;
345
- const d = this.detailElements.get(n);
489
+ const a = this.rows[r];
490
+ if (!a || !this.expandedRows.has(a)) continue;
491
+ const d = this.detailElements.get(a);
346
492
  if (d) {
347
493
  d.previousElementSibling !== s && s.after(d);
348
494
  continue;
349
495
  }
350
- const l = E(n, r, this.config.detailRenderer, o);
351
- typeof this.config.detailHeight == "number" && (l.style.height = `${this.config.detailHeight}px`), s.after(l), this.detailElements.set(n, l), this.animateExpand(l);
496
+ const u = O(a, r, this.config.detailRenderer, o);
497
+ typeof this.config.detailHeight == "number" && (u.style.height = `${this.config.detailHeight}px`), s.after(u), this.detailElements.set(a, u), this.animateExpand(u);
352
498
  }
353
499
  }
354
500
  /**
@@ -358,9 +504,9 @@ class C extends m {
358
504
  getExtraHeight() {
359
505
  let e = 0;
360
506
  for (const t of this.expandedRows) {
361
- const i = this.detailElements.get(t);
362
- if (i)
363
- e += i.offsetHeight;
507
+ const n = this.detailElements.get(t);
508
+ if (n)
509
+ e += n.offsetHeight;
364
510
  else {
365
511
  const o = this.config?.detailHeight;
366
512
  e += typeof o == "number" ? o : 150;
@@ -374,12 +520,12 @@ class C extends m {
374
520
  */
375
521
  getExtraHeightBefore(e) {
376
522
  let t = 0;
377
- for (const i of this.expandedRows) {
378
- const o = this.rows.indexOf(i);
523
+ for (const n of this.expandedRows) {
524
+ const o = this.rows.indexOf(n);
379
525
  if (o >= 0 && o < e) {
380
- const a = this.detailElements.get(i);
381
- if (a)
382
- t += a.offsetHeight;
526
+ const l = this.detailElements.get(n);
527
+ if (l)
528
+ t += l.offsetHeight;
383
529
  else {
384
530
  const r = this.config?.detailHeight;
385
531
  t += typeof r == "number" ? r : 150;
@@ -392,20 +538,20 @@ class C extends m {
392
538
  * Adjust the virtualization start index to keep expanded row visible while its detail is visible.
393
539
  * This ensures the detail scrolls smoothly out of view instead of disappearing abruptly.
394
540
  */
395
- adjustVirtualStart(e, t, i) {
541
+ adjustVirtualStart(e, t, n) {
396
542
  if (this.expandedRows.size === 0) return e;
397
543
  const o = [];
398
544
  for (const s of this.expandedRows) {
399
- const n = this.rows.indexOf(s);
400
- n >= 0 && o.push({ index: n, row: s });
545
+ const a = this.rows.indexOf(s);
546
+ a >= 0 && o.push({ index: a, row: s });
401
547
  }
402
- o.sort((s, n) => s.index - n.index);
403
- let a = e, r = 0;
404
- for (const { index: s, row: n } of o) {
405
- const d = s * i + r, h = this.detailElements.get(n)?.offsetHeight ?? (typeof this.config?.detailHeight == "number" ? this.config.detailHeight : 150), u = d + i + h;
406
- r += h, !(s >= e) && u > t && s < a && (a = s);
548
+ o.sort((s, a) => s.index - a.index);
549
+ let l = e, r = 0;
550
+ for (const { index: s, row: a } of o) {
551
+ const d = s * n + r, c = this.detailElements.get(a)?.offsetHeight ?? (typeof this.config?.detailHeight == "number" ? this.config.detailHeight : 150), h = d + n + c;
552
+ r += c, !(s >= e) && h > t && s < l && (l = s);
407
553
  }
408
- return a;
554
+ return l;
409
555
  }
410
556
  // #endregion
411
557
  // #region Public API
@@ -415,7 +561,7 @@ class C extends m {
415
561
  */
416
562
  expand(e) {
417
563
  const t = this.rows[e];
418
- t && (this.expandedRows = x(this.expandedRows, t), this.requestRender());
564
+ t && (this.expandedRows = L(this.expandedRows, t), this.requestRender());
419
565
  }
420
566
  /**
421
567
  * Collapse the detail row at the given index.
@@ -423,7 +569,7 @@ class C extends m {
423
569
  */
424
570
  collapse(e) {
425
571
  const t = this.rows[e];
426
- t && (this.expandedRows = R(this.expandedRows, t), this.requestRender());
572
+ t && (this.expandedRows = T(this.expandedRows, t), this.requestRender());
427
573
  }
428
574
  /**
429
575
  * Toggle the detail row at the given index.
@@ -440,7 +586,7 @@ class C extends m {
440
586
  */
441
587
  isExpanded(e) {
442
588
  const t = this.rows[e];
443
- return t ? b(this.expandedRows, t) : !1;
589
+ return t ? I(this.expandedRows, t) : !1;
444
590
  }
445
591
  /**
446
592
  * Expand all detail rows.
@@ -463,8 +609,8 @@ class C extends m {
463
609
  getExpandedRows() {
464
610
  const e = [];
465
611
  for (const t of this.expandedRows) {
466
- const i = this.rows.indexOf(t);
467
- i >= 0 && e.push(i);
612
+ const n = this.rows.indexOf(t);
613
+ n >= 0 && e.push(n);
468
614
  }
469
615
  return e;
470
616
  }
@@ -477,12 +623,23 @@ class C extends m {
477
623
  const t = this.rows[e];
478
624
  return t ? this.detailElements.get(t) : void 0;
479
625
  }
626
+ /**
627
+ * Re-parse light DOM to refresh the detail renderer.
628
+ * Call this after framework templates are registered (e.g., Angular ngAfterContentInit).
629
+ *
630
+ * This allows frameworks to register templates asynchronously and then
631
+ * update the plugin's detailRenderer.
632
+ */
633
+ refreshDetailRenderer() {
634
+ const e = this.config.detailRenderer;
635
+ this.config = { ...this.config, detailRenderer: void 0 }, this.parseLightDomDetail(), !this.config.detailRenderer && e && (this.config = { ...this.config, detailRenderer: e });
636
+ }
480
637
  // #endregion
481
638
  // #region Styles
482
- styles = y;
639
+ styles = N;
483
640
  // #endregion
484
641
  }
485
642
  export {
486
- C as MasterDetailPlugin
643
+ q as MasterDetailPlugin
487
644
  };
488
645
  //# sourceMappingURL=index.js.map